[Bf-blender-cvs] [f838fbde06c] sculpt-dev: Sculpt: fix crash in PBVH_FACES

Joseph Eagar noreply at git.blender.org
Sat Oct 16 10:48:25 CEST 2021


Commit: f838fbde06ce787fdbb523c0f1ae9004b4eac174
Author: Joseph Eagar
Date:   Sat Oct 16 01:48:14 2021 -0700
Branches: sculpt-dev
https://developer.blender.org/rBf838fbde06ce787fdbb523c0f1ae9004b4eac174

Sculpt: fix crash in PBVH_FACES

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

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

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

diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c
index 639e0cf11a9..51a25bf452d 100644
--- a/source/blender/editors/sculpt_paint/sculpt.c
+++ b/source/blender/editors/sculpt_paint/sculpt.c
@@ -2986,6 +2986,7 @@ void SCULPT_orig_vert_data_unode_init(SculptOrigVertData *data, Object *ob, Scul
 
   memset(data, 0, sizeof(*data));
   data->unode = unode;
+  data->datatype = unode ? unode->type : SCULPT_UNDO_COORDS;
 
   data->pbvh = ss->pbvh;
   data->ss = ss;
@@ -2993,10 +2994,6 @@ void SCULPT_orig_vert_data_unode_init(SculptOrigVertData *data, Object *ob, Scul
   if (bm) {
     data->bm_log = ss->bm_log;
   }
-
-  else {
-    // data->datatype = data->unode->type;
-  }
 }
 
 /**
diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c
index 3cfba8acc1e..8fdf25a0a49 100644
--- a/source/blender/editors/sculpt_paint/sculpt_undo.c
+++ b/source/blender/editors/sculpt_paint/sculpt_undo.c
@@ -1632,6 +1632,13 @@ static void sculpt_undo_store_coords(Object *ob, SculptUndoNode *unode)
   SculptOrigVertData orig_data;
   SCULPT_orig_vert_data_unode_init(&orig_data, ob, unode);
 
+  int totvert, allvert;
+  BKE_pbvh_node_num_verts(ss->pbvh, unode->node, &totvert, &allvert);
+
+  if (ss->deform_modifiers_active && !unode->orig_co) {
+    unode->orig_co = MEM_malloc_arrayN(allvert, sizeof(float) * 3, "sculpt unode undo coords");
+  }
+
   BKE_pbvh_vertex_iter_begin (ss->pbvh, unode->node, vd, PBVH_ITER_ALL) {
     copy_v3_v3(unode->co[vd.i], vd.co);
     if (vd.no) {



More information about the Bf-blender-cvs mailing list