[Bf-blender-cvs] [3f9299e45d3] master: Sculpt: Fix redo panel bugs

Joseph Eagar noreply at git.blender.org
Mon Aug 15 23:53:16 CEST 2022


Commit: 3f9299e45d39051f341fcc2d6415defcc01eca93
Author: Joseph Eagar
Date:   Mon Aug 15 14:52:02 2022 -0700
Branches: master
https://developer.blender.org/rB3f9299e45d39051f341fcc2d6415defcc01eca93

Sculpt: Fix redo panel bugs

SCULPT_undo_push_begin no longer takes an explicit
name.  Instead it takes a wmOperator pointer and uses
op->type->name for the name.  This is necassary for
the redo panel to work and should fix the entire class
of bugs related to misspelled undo push names.

Cases where the calling operator is not registered
may use SCULPT_undo_push_begin_ex if desired; it
takes a name string as before.

===================================================================

M	source/blender/editors/include/ED_sculpt.h
M	source/blender/editors/mesh/editmesh_mask_extract.c
M	source/blender/editors/object/object_remesh.cc
M	source/blender/editors/sculpt_paint/paint_hide.c
M	source/blender/editors/sculpt_paint/paint_mask.c
M	source/blender/editors/sculpt_paint/paint_vertex.cc
M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_cloth.c
M	source/blender/editors/sculpt_paint/sculpt_detail.c
M	source/blender/editors/sculpt_paint/sculpt_dyntopo.c
M	source/blender/editors/sculpt_paint/sculpt_expand.c
M	source/blender/editors/sculpt_paint/sculpt_face_set.c
M	source/blender/editors/sculpt_paint/sculpt_filter_color.c
M	source/blender/editors/sculpt_paint/sculpt_filter_mask.c
M	source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
M	source/blender/editors/sculpt_paint/sculpt_intern.h
M	source/blender/editors/sculpt_paint/sculpt_mask_expand.c
M	source/blender/editors/sculpt_paint/sculpt_mask_init.c
M	source/blender/editors/sculpt_paint/sculpt_ops.c
M	source/blender/editors/sculpt_paint/sculpt_transform.c
M	source/blender/editors/sculpt_paint/sculpt_undo.c
M	source/blender/editors/transform/transform.h
M	source/blender/editors/transform/transform_convert_sculpt.c
M	source/blender/editors/transform/transform_ops.c

===================================================================

diff --git a/source/blender/editors/include/ED_sculpt.h b/source/blender/editors/include/ED_sculpt.h
index 550040d2bc6..5efeeaa29e1 100644
--- a/source/blender/editors/include/ED_sculpt.h
+++ b/source/blender/editors/include/ED_sculpt.h
@@ -20,6 +20,7 @@ struct rcti;
 struct wmMsgSubscribeKey;
 struct wmMsgSubscribeValue;
 struct wmRegionMessageSubscribeParams;
+struct wmOperator;
 
 /* sculpt.c */
 
@@ -33,7 +34,7 @@ bool ED_sculpt_mask_box_select(struct bContext *C,
 /* sculpt_transform.c */
 
 void ED_sculpt_update_modal_transform(struct bContext *C, struct Object *ob);
-void ED_sculpt_init_transform(struct bContext *C, struct Object *ob);
+void ED_sculpt_init_transform(struct bContext *C, struct Object *ob, const char *undo_name);
 void ED_sculpt_end_transform(struct bContext *C, struct Object *ob);
 
 /* sculpt_undo.c */
@@ -41,7 +42,12 @@ void ED_sculpt_end_transform(struct bContext *C, struct Object *ob);
 /** Export for ED_undo_sys. */
 void ED_sculpt_undosys_type(struct UndoType *ut);
 
-void ED_sculpt_undo_geometry_begin(struct Object *ob, const char *name);
+/* Pushes an undo step using the operator name.  This is necassary for
+ * redo panels to work; operators that do not support that may use
+ * ED_sculpt_undo_geometry_begin_ex instead if so desired.
+ */
+void ED_sculpt_undo_geometry_begin(struct Object *ob, const struct wmOperator *op);
+void ED_sculpt_undo_geometry_begin_ex(struct Object *ob, const char *name);
 void ED_sculpt_undo_geometry_end(struct Object *ob);
 
 /* Face sets. */
diff --git a/source/blender/editors/mesh/editmesh_mask_extract.c b/source/blender/editors/mesh/editmesh_mask_extract.c
index 7634ce6af9e..6a080e78086 100644
--- a/source/blender/editors/mesh/editmesh_mask_extract.c
+++ b/source/blender/editors/mesh/editmesh_mask_extract.c
@@ -486,7 +486,7 @@ static int paint_mask_slice_exec(bContext *C, wmOperator *op)
   Mesh *new_mesh = (Mesh *)BKE_id_copy(bmain, &mesh->id);
 
   if (ob->mode == OB_MODE_SCULPT) {
-    ED_sculpt_undo_geometry_begin(ob, "mask slice");
+    ED_sculpt_undo_geometry_begin(ob, op);
   }
 
   BMesh *bm;
diff --git a/source/blender/editors/object/object_remesh.cc b/source/blender/editors/object/object_remesh.cc
index ac4fb40d832..812d9bbbc08 100644
--- a/source/blender/editors/object/object_remesh.cc
+++ b/source/blender/editors/object/object_remesh.cc
@@ -144,7 +144,7 @@ static int voxel_remesh_exec(bContext *C, wmOperator *op)
   }
 
   if (ob->mode == OB_MODE_SCULPT) {
-    ED_sculpt_undo_geometry_begin(ob, op->type->name);
+    ED_sculpt_undo_geometry_begin(ob, op);
   }
 
   if (mesh->flag & ME_REMESH_FIX_POLES && mesh->remesh_voxel_adaptivity <= 0.0f) {
@@ -654,6 +654,7 @@ struct QuadriFlowJob {
   short *stop, *do_update;
   float *progress;
 
+  const struct wmOperator *op;
   Scene *scene;
   int target_faces;
   int seed;
@@ -891,7 +892,7 @@ static void quadriflow_start_job(void *customdata, short *stop, short *do_update
   new_mesh = remesh_symmetry_mirror(qj->owner, new_mesh, qj->symmetry_axes);
 
   if (ob->mode == OB_MODE_SCULPT) {
-    ED_sculpt_undo_geometry_begin(ob, "QuadriFlow Remesh");
+    ED_sculpt_undo_geometry_begin(ob, qj->op);
   }
 
   if (qj->preserve_paint_mask) {
@@ -949,6 +950,7 @@ static int quadriflow_remesh_exec(bContext *C, wmOperator *op)
 {
   QuadriFlowJob *job = (QuadriFlowJob *)MEM_mallocN(sizeof(QuadriFlowJob), "QuadriFlowJob");
 
+  job->op = op;
   job->owner = CTX_data_active_object(C);
   job->scene = CTX_data_scene(C);
 
diff --git a/source/blender/editors/sculpt_paint/paint_hide.c b/source/blender/editors/sculpt_paint/paint_hide.c
index c904d533db8..a7aa29853e6 100644
--- a/source/blender/editors/sculpt_paint/paint_hide.c
+++ b/source/blender/editors/sculpt_paint/paint_hide.c
@@ -351,10 +351,10 @@ static int hide_show_exec(bContext *C, wmOperator *op)
   /* Start undo. */
   switch (action) {
     case PARTIALVIS_HIDE:
-      SCULPT_undo_push_begin(ob, "Hide area");
+      SCULPT_undo_push_begin_ex(ob, "Hide area");
       break;
     case PARTIALVIS_SHOW:
-      SCULPT_undo_push_begin(ob, "Show area");
+      SCULPT_undo_push_begin_ex(ob, "Show area");
       break;
   }
 
diff --git a/source/blender/editors/sculpt_paint/paint_mask.c b/source/blender/editors/sculpt_paint/paint_mask.c
index 2e57886fd95..dcc6e734cf4 100644
--- a/source/blender/editors/sculpt_paint/paint_mask.c
+++ b/source/blender/editors/sculpt_paint/paint_mask.c
@@ -152,7 +152,7 @@ static int mask_flood_fill_exec(bContext *C, wmOperator *op)
 
   BKE_pbvh_search_gather(pbvh, NULL, NULL, &nodes, &totnode);
 
-  SCULPT_undo_push_begin(ob, "Mask flood fill");
+  SCULPT_undo_push_begin(ob, op);
 
   MaskTaskData data = {
       .ob = ob,
@@ -687,10 +687,10 @@ static bool sculpt_gesture_is_vertex_effected(SculptGestureContext *sgcontext, P
   return false;
 }
 
-static void sculpt_gesture_apply(bContext *C, SculptGestureContext *sgcontext)
+static void sculpt_gesture_apply(bContext *C, SculptGestureContext *sgcontext, wmOperator *op)
 {
   SculptGestureOperation *operation = sgcontext->operation;
-  SCULPT_undo_push_begin(CTX_data_active_object(C), "Sculpt Gesture Apply");
+  SCULPT_undo_push_begin(CTX_data_active_object(C), op);
 
   operation->sculpt_gesture_begin(C, sgcontext);
 
@@ -1502,7 +1502,7 @@ static int paint_mask_gesture_box_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
   sculpt_gesture_init_mask_properties(sgcontext, op);
-  sculpt_gesture_apply(C, sgcontext);
+  sculpt_gesture_apply(C, sgcontext, op);
   sculpt_gesture_context_free(sgcontext);
   return OPERATOR_FINISHED;
 }
@@ -1514,7 +1514,7 @@ static int paint_mask_gesture_lasso_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
   sculpt_gesture_init_mask_properties(sgcontext, op);
-  sculpt_gesture_apply(C, sgcontext);
+  sculpt_gesture_apply(C, sgcontext, op);
   sculpt_gesture_context_free(sgcontext);
   return OPERATOR_FINISHED;
 }
@@ -1526,7 +1526,7 @@ static int paint_mask_gesture_line_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
   sculpt_gesture_init_mask_properties(sgcontext, op);
-  sculpt_gesture_apply(C, sgcontext);
+  sculpt_gesture_apply(C, sgcontext, op);
   sculpt_gesture_context_free(sgcontext);
   return OPERATOR_FINISHED;
 }
@@ -1538,7 +1538,7 @@ static int face_set_gesture_box_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
   sculpt_gesture_init_face_set_properties(sgcontext, op);
-  sculpt_gesture_apply(C, sgcontext);
+  sculpt_gesture_apply(C, sgcontext, op);
   sculpt_gesture_context_free(sgcontext);
   return OPERATOR_FINISHED;
 }
@@ -1550,7 +1550,7 @@ static int face_set_gesture_lasso_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
   sculpt_gesture_init_face_set_properties(sgcontext, op);
-  sculpt_gesture_apply(C, sgcontext);
+  sculpt_gesture_apply(C, sgcontext, op);
   sculpt_gesture_context_free(sgcontext);
   return OPERATOR_FINISHED;
 }
@@ -1575,7 +1575,7 @@ static int sculpt_trim_gesture_box_exec(bContext *C, wmOperator *op)
   }
 
   sculpt_gesture_init_trim_properties(sgcontext, op);
-  sculpt_gesture_apply(C, sgcontext);
+  sculpt_gesture_apply(C, sgcontext, op);
   sculpt_gesture_context_free(sgcontext);
   return OPERATOR_FINISHED;
 }
@@ -1616,7 +1616,7 @@ static int sculpt_trim_gesture_lasso_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
   sculpt_gesture_init_trim_properties(sgcontext, op);
-  sculpt_gesture_apply(C, sgcontext);
+  sculpt_gesture_apply(C, sgcontext, op);
   sculpt_gesture_context_free(sgcontext);
   return OPERATOR_FINISHED;
 }
@@ -1645,7 +1645,7 @@ static int project_gesture_line_exec(bContext *C, wmOperator *op)
     return OPERATOR_CANCELLED;
   }
   sculpt_gesture_init_project_properties(sgcontext, op);
-  sculpt_gesture_apply(C, sgcontext);
+  sculpt_gesture_apply(C, sgcontext, op);
   sculpt_gesture_context_free(sgcontext);
   return OPERATOR_FINISHED;
 }
diff --git a/source/blender/editors/sculpt_paint/paint_vertex.cc b/source/blender/editors/sculpt_paint/paint_vertex.cc
index 6dc8375bb0d..ccaf8b1ba37 100644
--- a/source/blender/editors/sculpt_paint/paint_vertex.cc
+++ b/source/blender/editors/sculpt_paint/paint_vertex.cc
@@ -3957,7 +3957,7 @@ static int vpaint_invoke(bContext *C, wmOperator *op, const wmEvent *event)
     BKE_pbvh_ensure_node_loops(ob->sculpt->pbvh);
   }
 
-  SCULPT_undo_push_begin(ob, "Vertex Paint");
+  SCULPT_undo_push_begin_ex(ob, "Vertex Paint");
 
   if ((retval = op->type->modal(C, op, event)) == OPERATOR_FINISHED) {
     paint_stroke_free(C, op, (PaintStroke *)op->customdata);
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index ded3363bfe2..43193a98b26 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5382,7 +5382,7 @@ static bool sculpt_stroke_test_start(bContext *C, struct wmOperator *op, const f
       ED_image_undo_push_begin(op->type->name, PAINT_MODE_SCULPT);
     }
     else {
-      SCULPT_undo_push_begin(ob, sculpt_tool_name(sd));
+      SCULPT_undo_push_begin_ex(ob, sculpt_tool_name(sd));
     }
 
     return true;
diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c
index b4b2c4e48c8..691dfa21851 100644
--- a/source/blender/editors/sculpt_paint/sculpt_cloth.c
+++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c
@@ -1579,7 +1579,7 @@ static int sculpt_cloth_filter_invoke(bContext *C, wmOperator *op, const wmEvent
   /* Needs mask data to be available as it is used when solving the constraints. */
   BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false);
 
-  SCULPT_undo_push_begin(ob, "Cloth filter");
+  SCULPT_undo_push_begin(ob, op);
   SCULPT_filter_cache_init(C, ob, sd, SCULPT_UNDO_COORDS);
 
   ss->filter_cache->automasking = SCULPT_automasking_cache_init(sd, NULL, ob);
diff --git a/source/blender/editors/sculpt_paint/sculpt_detail.c b/source/blender/editors/sculpt_paint/sculpt_detail.c
index ebbb0fa429e..8f87cd1b6ed 100644
--- a/source/blender/editors/sculpt_paint/sculpt_detail.c
+++ b/source/blender/editors/sculpt_paint/sculpt_detail.c
@@ -76,7 +76,7 @@ static boo

@@ Diff output truncated at 10240 characters. @@



More information about the Bf-blender-cvs mailing list