Commit: 8eee1a312b308460f8cae3022e87142164a01833 Author: Lukas Stockner Date: Thu Jul 26 18:22:19 2018 +0200 Branches: temp-udim-images https://developer.blender.org/rB8eee1a312b308460f8cae3022e87142164a01833
a =================================================================== M source/blender/blenkernel/intern/image.c M source/blender/editors/space_image/image_ops.c =================================================================== diff --git a/source/blender/blenkernel/intern/image.c b/source/blender/blenkernel/intern/image.c index 870949018bc..c0537d5ce9f 100644 --- a/source/blender/blenkernel/intern/image.c +++ b/source/blender/blenkernel/intern/image.c @@ -732,7 +732,7 @@ static ImBuf *add_ibuf_size(unsigned int width, unsigned int height, const char /* adds new image block, creates ImBuf and initializes color */ Image *BKE_image_add_generated( Main *bmain, unsigned int width, unsigned int height, const char *name, - int depth, int floatbuf, short gen_type, const float color[4], const bool stereo3d) + int depth, int floatbuf, short gen_type, const float color[4], const bool stereo3d, const bool tiled) { /* on save, type is changed to FILE in editsima.c */ Image *ima = image_alloc(bmain, name, IMA_SRC_GENERATED, IMA_TYPE_UV_TEST); @@ -750,6 +750,8 @@ Image *BKE_image_add_generated( copy_v4_v4(ima->gen_color, color); for (view_id = 0; view_id < 2; view_id++) { + char ibuf_name[FILE_MAX]; + BLI_strncpy(ibuf_name, ima->name, sizeof(ibuf_name)); ImBuf *ibuf; ibuf = add_ibuf_size(width, height, ima->name, depth, floatbuf, gen_type, color, &ima->colorspace_settings); image_assign_ibuf(ima, ibuf, stereo3d ? view_id : IMA_NO_INDEX, 0); diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 998a27fba54..7be1dbedd38 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -2547,6 +2547,12 @@ static int image_new_exec(bContext *C, wmOperator *op) RNA_float_get_array(op->ptr, "color", color); alpha = RNA_boolean_get(op->ptr, "alpha"); stereo3d = RNA_boolean_get(op->ptr, "use_stereo_3d"); + bool tiled = RNA_boolean_get(op->ptr, "tiled"); + + if (tiled && (strstr(name, "1001") == NULL)) { + BKE_report(op->reports, RPT_ERROR, "Tiled images need to contain 1001 in their name!"); + return OPERATOR_CANCELLED; + } if (!alpha) color[3] = 1.0f; @@ -2635,6 +2641,9 @@ static void image_new_draw(bContext *UNUSED(C), wmOperator *op) uiItemL(col[0], "", ICON_NONE); uiItemR(col[1], &ptr, "float", 0, NULL, ICON_NONE); + uiItemL(col[0], "", ICON_NONE); + uiItemR(col[1], &ptr, "tiled", 0, NULL, ICON_NONE); + #if 0 if (is_multiview) { uiItemL(col[0], "", ICON_NONE); @@ -2683,6 +2692,8 @@ void IMAGE_OT_new(wmOperatorType *ot) RNA_def_property_flag(prop, PROP_HIDDEN); prop = RNA_def_boolean(ot->srna, "use_stereo_3d", 0, "Stereo 3D", "Create an image with left and right views"); RNA_def_property_flag(prop, PROP_SKIP_SAVE | PROP_HIDDEN); + prop = RNA_def_boolean(ot->srna, "tiled", 0, "Tiled", "Create a tiled image"); + RNA_def_property_flag(prop, PROP_SKIP_SAVE); } #undef IMA_DEF_NAME _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org https://lists.blender.org/mailman/listinfo/bf-blender-cvs