[Bf-blender-cvs] [910b4210454] blender-v2.83-release: Fix T77328: Crash on undo Draw Face Sets stroke with dyntopo active

Pablo Dobarro noreply at git.blender.org
Thu Jul 2 09:33:38 CEST 2020


Commit: 910b4210454bd51aa86cbf63ed2dcd90c6e2b298
Author: Pablo Dobarro
Date:   Wed Jun 10 01:08:35 2020 +0200
Branches: blender-v2.83-release
https://developer.blender.org/rB910b4210454bd51aa86cbf63ed2dcd90c6e2b298

Fix T77328: Crash on undo Draw Face Sets stroke with dyntopo active

Draw Face Sets does not work in Dyntopo and the sculpt API should be
responsible for that without needing to add checks all over the code,
but it was doing an undo push of type SCULPT_UNDO_FACE_SETS which is not
supported, causing the crash.

Reviewed By: sergey

Maniphest Tasks: T77328

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

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

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

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index c42170695c2..1cac680a56f 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -5299,7 +5299,14 @@ static void do_brush_action(Sculpt *sd, Object *ob, Brush *brush, UnifiedPaintSe
    * and the number of nodes under the brush influence. */
   if (brush->sculpt_tool == SCULPT_TOOL_DRAW_FACE_SETS && ss->cache->first_time &&
       ss->cache->mirror_symmetry_pass == 0 && !ss->cache->alt_smooth) {
-    SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_FACE_SETS);
+
+    /* Dyntopo does not support Face Sets data, so it can't store/restore it from undo. */
+    /* TODO (pablodp606): This check should be done in the undo code and not here, but the rest of
+     * the sculpt code is not checking for unsupported undo types that may return a null node. */
+    if (BKE_pbvh_type(ss->pbvh) != PBVH_BMESH) {
+      SCULPT_undo_push_node(ob, NULL, SCULPT_UNDO_FACE_SETS);
+    }
+
     if (ss->cache->invert) {
       /* When inverting the brush, pick the paint face mask ID from the mesh. */
       ss->cache->paint_face_set = SCULPT_active_face_set_get(ss);



More information about the Bf-blender-cvs mailing list