[Bf-blender-cvs] [995f757049d] blender-v3.4-release: Fix T102940: "Mask by Color" sculpt tool crash

Hans Goudey noreply at git.blender.org
Tue Dec 6 17:00:32 CET 2022


Commit: 995f757049dc9c05a9405f84ed9311d5c6acdde7
Author: Hans Goudey
Date:   Tue Dec 6 10:00:12 2022 -0600
Branches: blender-v3.4-release
https://developer.blender.org/rB995f757049dc9c05a9405f84ed9311d5c6acdde7

Fix T102940: "Mask by Color" sculpt tool crash

We need to ensure the mask layer exists before running the operator.
I made the order of function calls here the same as in newer code later
on in this file for consistency.

Differential Revision: https://developer.blender.org/D16696

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

M	source/blender/editors/sculpt_paint/sculpt_ops.c

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

diff --git a/source/blender/editors/sculpt_paint/sculpt_ops.c b/source/blender/editors/sculpt_paint/sculpt_ops.c
index dfe1be8ebaa..9350f3e9d4e 100644
--- a/source/blender/editors/sculpt_paint/sculpt_ops.c
+++ b/source/blender/editors/sculpt_paint/sculpt_ops.c
@@ -909,13 +909,15 @@ static int sculpt_mask_by_color_invoke(bContext *C, wmOperator *op, const wmEven
     v3d->shading.color_type = V3D_SHADING_VERTEX_COLOR;
   }
 
-  BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false);
-
   /* Color data is not available in multi-resolution or dynamic topology. */
   if (!SCULPT_handles_colors_report(ss, op->reports)) {
     return OPERATOR_CANCELLED;
   }
 
+  MultiresModifierData *mmd = BKE_sculpt_multires_active(CTX_data_scene(C), ob);
+  BKE_sculpt_mask_layers_ensure(depsgraph, CTX_data_main(C), ob, mmd);
+
+  BKE_sculpt_update_object_for_edit(depsgraph, ob, true, true, false);
   SCULPT_vertex_random_access_ensure(ss);
 
   /* Tools that are not brushes do not have the brush gizmo to update the vertex as the mouse move,



More information about the Bf-blender-cvs mailing list