diff options
Diffstat (limited to 'source/blender/editors/space_image/image_ops.c')
-rw-r--r-- | source/blender/editors/space_image/image_ops.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/source/blender/editors/space_image/image_ops.c b/source/blender/editors/space_image/image_ops.c index 69c141c2bbb..6a72066f031 100644 --- a/source/blender/editors/space_image/image_ops.c +++ b/source/blender/editors/space_image/image_ops.c @@ -1896,6 +1896,7 @@ static int image_new_exec(bContext *C, wmOperator *op) SpaceImage *sima; Scene *scene; Object *obedit; + Object *ob; Image *ima; Main *bmain; PointerRNA ptr, idptr; @@ -1910,6 +1911,7 @@ static int image_new_exec(bContext *C, wmOperator *op) scene = CTX_data_scene(C); obedit = CTX_data_edit_object(C); bmain = CTX_data_main(C); + ob = OBACT; prop = RNA_struct_find_property(op->ptr, "name"); RNA_property_string_get(op->ptr, prop, name); @@ -1955,6 +1957,13 @@ static int image_new_exec(bContext *C, wmOperator *op) tex->ima = ima; ED_area_tag_redraw(CTX_wm_area(C)); } + else if (ob && ob->mode == OB_MODE_TEXTURE_PAINT) { + ImagePaintSettings *imapaint = &(CTX_data_tool_settings(C)->imapaint); + + if (imapaint->stencil) + id_us_min(&imapaint->stencil->id); + imapaint->stencil = ima; + } } BKE_image_signal(ima, (sima) ? &sima->iuser : NULL, IMA_SIGNAL_USER_NEW_IMAGE); @@ -2037,7 +2046,7 @@ static int image_invert_exec(bContext *C, wmOperator *op) if (support_undo) { ED_undo_paint_push_begin(UNDO_PAINT_IMAGE, op->type->name, - ED_image_undo_restore, ED_image_undo_free); + ED_image_undo_restore, ED_image_undo_free, NULL); /* not strictly needed, because we only imapaint_dirty_region to invalidate all tiles * but better do this right in case someone copies this for a tool that uses partial redraw better */ ED_imapaint_clear_partial_redraw(); |