[Bf-blender-cvs] [0704846250e] temp-sculpt-colors: temp-sculpt-colors: fix crash with color filter

Joseph Eagar noreply at git.blender.org
Wed Feb 16 16:16:07 CET 2022


Commit: 0704846250ee78d0de80d5ce2f4e4fd4a0e03bf1
Author: Joseph Eagar
Date:   Wed Feb 16 07:15:47 2022 -0800
Branches: temp-sculpt-colors
https://developer.blender.org/rB0704846250ee78d0de80d5ce2f4e4fd4a0e03bf1

temp-sculpt-colors: fix crash with color filter

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

M	source/blender/editors/sculpt_paint/sculpt.c
M	source/blender/editors/sculpt_paint/sculpt_filter_color.c

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 48f2b634d9d..459c1a3b87d 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -3955,7 +3955,12 @@ bool SCULPT_mode_poll(bContext *C)
 
 bool SCULPT_vertex_colors_poll(bContext *C)
 {
-  return SCULPT_mode_poll(C);
+  if (!SCULPT_mode_poll(C)) {
+    return false;
+  }
+
+  Object *ob = CTX_data_active_object(C);
+  return ob->sculpt && SCULPT_has_colors(ob->sculpt);
 }
 
 bool SCULPT_mode_poll_view3d(bContext *C)
diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_color.c b/source/blender/editors/sculpt_paint/sculpt_filter_color.c
index dbbbabc9cd7..d07797410e3 100644
--- a/source/blender/editors/sculpt_paint/sculpt_filter_color.c
+++ b/source/blender/editors/sculpt_paint/sculpt_filter_color.c
@@ -251,7 +251,6 @@ static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent
   Object *ob = CTX_data_active_object(C);
   Sculpt *sd = CTX_data_tool_settings(C)->sculpt;
   SculptSession *ss = ob->sculpt;
-  int mode = RNA_enum_get(op->ptr, "type");
   PBVH *pbvh = ob->sculpt->pbvh;
 
   const bool use_automasking = SCULPT_is_automasking_enabled(sd, ss, NULL);
@@ -284,10 +283,9 @@ static int sculpt_color_filter_invoke(bContext *C, wmOperator *op, const wmEvent
   /* CTX_data_ensure_evaluated_depsgraph should be used at the end to include the updates of
    * earlier steps modifying the data. */
   Depsgraph *depsgraph = CTX_data_ensure_evaluated_depsgraph(C);
-  const bool needs_topology_info = mode == COLOR_FILTER_SMOOTH || use_automasking;
-  BKE_sculpt_update_object_for_edit(depsgraph, ob, needs_topology_info, false, true);
+  BKE_sculpt_update_object_for_edit(depsgraph, ob, true, false, true);
 
-  if (BKE_pbvh_type(pbvh) == PBVH_FACES && needs_topology_info && !ob->sculpt->pmap) {
+  if (BKE_pbvh_type(pbvh) == PBVH_FACES && !ob->sculpt->pmap) {
     return OPERATOR_CANCELLED;
   }



More information about the Bf-blender-cvs mailing list