Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPablo Dobarro <pablodp606@gmail.com>2020-03-09 21:39:45 +0300
committerPablo Dobarro <pablodp606@gmail.com>2020-03-09 21:39:57 +0300
commit0030e6a2fc265258be7e02bedb89d81feda2adda (patch)
tree97ce57399a15978c812be3a897f1bf300475e552 /source/blender/editors
parent503d5c0c652dbce9dad428ab4b19e021c0ca8a39 (diff)
Fix T74500: Rebuild the Face Sets datalayer after slicing the geometry
Was crashing SculptSession data will not longer be valid if the total number of polys is modified when rendering the mesh again. This deletes all face sets in the mesh when slicing the mask. I'll try to add code to generate a new face set in with faces that are created when filling the holes, but for now this avoids the crash. Reviewed By: brecht Maniphest Tasks: T74500 Differential Revision: https://developer.blender.org/D7049
Diffstat (limited to 'source/blender/editors')
-rw-r--r--source/blender/editors/mesh/editmesh_mask_extract.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/blender/editors/mesh/editmesh_mask_extract.c b/source/blender/editors/mesh/editmesh_mask_extract.c
index e604248874a..d688e2cb658 100644
--- a/source/blender/editors/mesh/editmesh_mask_extract.c
+++ b/source/blender/editors/mesh/editmesh_mask_extract.c
@@ -348,6 +348,10 @@ static int paint_mask_slice_exec(bContext *C, wmOperator *op)
if (ob->mode == OB_MODE_SCULPT) {
ED_sculpt_undo_geometry_begin(ob, "mask slice");
+ /* TODO: The ideal functionality would be to preserve the current face sets and add a new one
+ * for the new triangles, but this datalayer needs to be rebuild in order to make sculpt mode
+ * not crash when modifying the geometry. */
+ CustomData_free_layers(&mesh->pdata, CD_SCULPT_FACE_SETS, mesh->totpoly);
}
BMesh *bm;
@@ -420,6 +424,13 @@ static int paint_mask_slice_exec(bContext *C, wmOperator *op)
if (ob->mode == OB_MODE_SCULPT) {
ED_sculpt_undo_geometry_end(ob);
+ SculptSession *ss = ob->sculpt;
+ /* Rebuild a new valid Face Set layer for the object. */
+ ss->face_sets = CustomData_add_layer(
+ &mesh->pdata, CD_SCULPT_FACE_SETS, CD_CALLOC, NULL, mesh->totpoly);
+ for (int i = 0; i < mesh->totpoly; i++) {
+ ss->face_sets[i] = 1;
+ }
}
BKE_mesh_batch_cache_dirty_tag(ob->data, BKE_MESH_BATCH_DIRTY_ALL);