diff --git a/source/blender/editors/space_view3d/space_view3d.c b/source/blender/editors/space_view3d/space_view3d.c index ff212a1d74e..a564de8e005 100644 --- a/source/blender/editors/space_view3d/space_view3d.c +++ b/source/blender/editors/space_view3d/space_view3d.c @@ -904,8 +904,15 @@ static void view3d_main_area_listener(bScreen *sc, ScrArea *sa, ARegion *ar, wmN ED_region_tag_redraw(ar); break; case NC_BRUSH: - if (wmn->action == NA_EDITED) - ED_region_tag_redraw_overlay(ar); + switch (wmn->action) { + case NA_EDITED: + ED_region_tag_redraw_overlay(ar); + /* used on brush changes - needed because 3d cursor + * has to be drawn if clone brush is selected */ + case NA_SELECTED: + ED_region_tag_redraw(ar); + break; + } break; case NC_MATERIAL: switch (wmn->data) { diff --git a/source/blender/editors/space_view3d/view3d_draw.c b/source/blender/editors/space_view3d/view3d_draw.c index 0f57a831ec9..ba031c83e3e 100644 --- a/source/blender/editors/space_view3d/view3d_draw.c +++ b/source/blender/editors/space_view3d/view3d_draw.c @@ -42,6 +42,7 @@ #include "DNA_lamp_types.h" #include "DNA_scene_types.h" #include "DNA_world_types.h" +#include "DNA_brush_types.h" #include "MEM_guardedalloc.h" @@ -3576,6 +3577,36 @@ static void view3d_main_area_draw_objects(const bContext *C, Scene *scene, View3 } +static bool is_cursor_visible(Scene *scene) +{ + Object *ob = OBACT; + + /* don't draw cursor in paint modes, but with a few exceptions */ + if (ob && ob->mode & OB_MODE_ALL_PAINT) { + /* exception: object is in weight paint and has deforming armature in pose mode */ + if (ob->mode & OB_MODE_WEIGHT_PAINT) { + if (BKE_object_pose_armature_get(ob) != NULL) { + return true; + } + } + /* exception: object in texture paint mode, clone brush, use_clone_layer disabled */ + else if (ob->mode & OB_MODE_TEXTURE_PAINT) { + const Paint *p = BKE_paint_get_active(scene); + + if (p && p->brush->imagepaint_tool == PAINT_TOOL_CLONE) { + if ((scene->toolsettings->imapaint.flag & IMAGEPAINT_PROJECT_LAYER_CLONE) == 0) { + return true; + } + } + } + + /* no exception met? then don't draw cursor! */ + return false; + } + + return true; +} + static void view3d_main_area_draw_info(const bContext *C, Scene *scene, ARegion *ar, View3D *v3d, const char *grid_unit, bool render_border) @@ -3609,7 +3640,10 @@ static void view3d_main_area_draw_info(const bContext *C, Scene *scene, if ((v3d->flag2 & V3D_RENDER_OVERRIDE) == 0) { Object *ob; - drawcursor(scene, ar, v3d); + /* 3d cursor */ + if (is_cursor_visible(scene)) { + drawcursor(scene, ar, v3d); + } if (U.uiflag & USER_SHOW_ROTVIEWICON) draw_view_axis(rv3d, &rect); diff --git a/source/blender/makesrna/intern/rna_sculpt_paint.c b/source/blender/makesrna/intern/rna_sculpt_paint.c index 09307674f5c..e09e0354e0b 100644 --- a/source/blender/makesrna/intern/rna_sculpt_paint.c +++ b/source/blender/makesrna/intern/rna_sculpt_paint.c @@ -292,7 +292,7 @@ static void rna_Paint_brush_update(Main *UNUSED(bmain), Scene *UNUSED(scene), Po Paint *paint = ptr->data; Brush *br = paint->brush; BKE_paint_invalidate_overlay_all(); - WM_main_add_notifier(NC_BRUSH | NA_EDITED, br); + WM_main_add_notifier(NC_BRUSH | NA_SELECTED, br); } static void rna_ImaPaint_viewport_update(Main *UNUSED(bmain), Scene *UNUSED(scene), PointerRNA *UNUSED(ptr)) @@ -730,7 +730,7 @@ static void rna_def_image_paint(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, NULL, "flag", IMAGEPAINT_PROJECT_LAYER_CLONE); RNA_def_property_ui_text(prop, "Clone Map", "Use another UV map as clone source, otherwise use the 3D cursor as the source"); - RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, NULL); + RNA_def_property_update(prop, NC_SCENE | ND_TOOLSETTINGS, "rna_ImaPaint_viewport_update"); /* integers */