Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-10-14 02:54:46 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-10-20 02:32:02 +0300
commitf780bfafcfa988d1415f5758ceebbe1b4aee9ba7 (patch)
treee866f7a6d02bf33c905810f2f1f927b28386adb3 /source/blender
parent48fd10a77dd8e53eb0ef063ce11bf4086fdb9f17 (diff)
Fix missing Sculpt Overlays updates when using modifiers
Now that sculpt mask and face sets can also be drawn without using the PBVH, these operators need these extra updates when the data changes. Reviewed By: sergey Differential Revision: https://developer.blender.org/D8956
Diffstat (limited to 'source/blender')
-rw-r--r--source/blender/editors/sculpt_paint/paint_mask.c5
-rw-r--r--source/blender/editors/sculpt_paint/sculpt.c15
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_face_set.c43
-rw-r--r--source/blender/editors/sculpt_paint/sculpt_intern.h3
4 files changed, 28 insertions, 38 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 8c912290997..4eef43d0d03 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -150,7 +150,6 @@ static void mask_flood_fill_task_cb(void *__restrict userdata,
static int mask_flood_fill_exec(bContext *C, wmOperator *op)
{
- ARegion *region = CTX_wm_region(C);
Object *ob = CTX_data_active_object(C);
Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
PaintMaskFloodMode mode;
@@ -196,9 +195,7 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
MEM_freeN(nodes);
}
- ED_region_tag_redraw(region);
-
- WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ SCULPT_tag_update_overlays(C);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 5ef0b49adf7..3ded57d938f 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -1047,6 +1047,21 @@ bool SCULPT_is_vertex_inside_brush_radius_symm(const float vertex[3],
return false;
}
+void SCULPT_tag_update_overlays(bContext *C)
+{
+ ARegion *region = CTX_wm_region(C);
+ ED_region_tag_redraw(region);
+
+ Object *ob = CTX_data_active_object(C);
+ WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+
+ DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
+ View3D *v3d = CTX_wm_view3d(C);
+ if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
+ DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ }
+}
+
/* Sculpt Flood Fill API
*
* Iterate over connected vertices, starting from one or more initial vertices. */
diff --git a/source/blender/editors/sculpt_paint/sculpt_face_set.c b/source/blender/editors/sculpt_paint/sculpt_face_set.c
index 152d23dfa5b..af6a06caf69 100644
--- a/source/blender/editors/sculpt_paint/sculpt_face_set.c
+++ b/source/blender/editors/sculpt_paint/sculpt_face_set.c
@@ -303,7 +303,6 @@ static int sculpt_face_set_create_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
- ARegion *region = CTX_wm_region(C);
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
const int mode = RNA_enum_get(op->ptr, "mode");
@@ -406,8 +405,7 @@ static int sculpt_face_set_create_exec(bContext *C, wmOperator *op)
SCULPT_undo_push_end();
- ED_region_tag_redraw(region);
- WM_event_add_notifier(C, NC_OBJECT | ND_DRAW, ob);
+ SCULPT_tag_update_overlays(C);
return OPERATOR_FINISHED;
}
@@ -664,7 +662,6 @@ static int sculpt_face_set_init_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
- ARegion *region = CTX_wm_region(C);
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
const int mode = RNA_enum_get(op->ptr, "mode");
@@ -734,13 +731,7 @@ static int sculpt_face_set_init_exec(bContext *C, wmOperator *op)
BKE_mesh_flush_hidden_from_verts(ob->data);
}
- ED_region_tag_redraw(region);
- DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
-
- View3D *v3d = CTX_wm_view3d(C);
- if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- }
+ SCULPT_tag_update_overlays(C);
return OPERATOR_FINISHED;
}
@@ -823,7 +814,6 @@ static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op)
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
- ARegion *region = CTX_wm_region(C);
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
/* Dyntopo not supported. */
@@ -924,13 +914,12 @@ static int sculpt_face_sets_change_visibility_exec(bContext *C, wmOperator *op)
MEM_SAFE_FREE(nodes);
- ED_region_tag_redraw(region);
- DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
-
- View3D *v3d = CTX_wm_view3d(C);
- if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
+ if (BKE_pbvh_type(pbvh) == PBVH_FACES) {
+ BKE_mesh_flush_hidden_from_verts(ob->data);
}
+
+ SCULPT_tag_update_overlays(C);
+
return OPERATOR_FINISHED;
}
@@ -980,7 +969,6 @@ static int sculpt_face_sets_randomize_colors_exec(bContext *C, wmOperator *UNUSE
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
- ARegion *region = CTX_wm_region(C);
/* Dyntopo not supported. */
if (BKE_pbvh_type(ss->pbvh) == PBVH_BMESH) {
@@ -1008,13 +996,7 @@ static int sculpt_face_sets_randomize_colors_exec(bContext *C, wmOperator *UNUSE
MEM_SAFE_FREE(nodes);
- View3D *v3d = CTX_wm_view3d(C);
- if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
- DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
- }
-
- ED_region_tag_redraw(region);
- WM_event_add_notifier(C, NC_GEOM | ND_DATA, ob->data);
+ SCULPT_tag_update_overlays(C);
return OPERATOR_FINISHED;
}
@@ -1139,7 +1121,6 @@ static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEven
{
Object *ob = CTX_data_active_object(C);
SculptSession *ss = ob->sculpt;
- ARegion *region = CTX_wm_region(C);
Depsgraph *depsgraph = CTX_data_depsgraph_pointer(C);
const int mode = RNA_enum_get(op->ptr, "mode");
@@ -1198,13 +1179,7 @@ static int sculpt_face_set_edit_invoke(bContext *C, wmOperator *op, const wmEven
BKE_mesh_flush_hidden_from_verts(ob->data);
}
- ED_region_tag_redraw(region);
- DEG_id_tag_update(&ob->id, ID_RECALC_SHADING);
-
- View3D *v3d = CTX_wm_view3d(C);
- if (!BKE_sculptsession_use_pbvh_draw(ob, v3d)) {
- DEG_id_tag_update(&ob->id, ID_RECALC_GEOMETRY);
- }
+ SCULPT_tag_update_overlays(C);
return OPERATOR_FINISHED;
}
diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h
index f03a9631b0c..4216f23bea4 100644
--- a/source/blender/editors/sculpt_paint/sculpt_intern.h
+++ b/source/blender/editors/sculpt_paint/sculpt_intern.h
@@ -66,6 +66,9 @@ void SCULPT_flush_update_step(bContext *C, SculptUpdateType update_flags);
void SCULPT_flush_update_done(const bContext *C, Object *ob, SculptUpdateType update_flags);
void SCULPT_flush_stroke_deform(struct Sculpt *sd, Object *ob, bool is_proxy_used);
+/* Should be used after modifying the mask or Face Sets IDs. */
+void SCULPT_tag_update_overlays(bContext *C);
+
/* Stroke */
typedef struct SculptCursorGeometryInfo {