[Bf-blender-cvs] [92c9111cae4] sculpt-mode-features: odd crashes on deleting objects and on load seem to be solved

Martin Felke noreply at git.blender.org
Tue Apr 9 18:25:19 CEST 2019


Commit: 92c9111cae4f7ddfa4701372b34e594c1e930c82
Author: Martin Felke
Date:   Tue Apr 9 17:57:50 2019 +0200
Branches: sculpt-mode-features
https://developer.blender.org/rB92c9111cae4f7ddfa4701372b34e594c1e930c82

odd crashes on deleting objects and on load seem to be solved

turned out I needed to copy the csg operand list as well, so the walk
function has it available when it needs it.

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

M	source/blender/makesrna/intern/rna_modifier.c
M	source/blender/modifiers/intern/MOD_remesh.c

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

diff --git a/source/blender/makesrna/intern/rna_modifier.c b/source/blender/makesrna/intern/rna_modifier.c
index d4192e04fe2..8477485681a 100644
--- a/source/blender/makesrna/intern/rna_modifier.c
+++ b/source/blender/makesrna/intern/rna_modifier.c
@@ -643,6 +643,11 @@ static void rna_CSGVolume_object_set(PointerRNA *ptr, PointerRNA value)
 	Object *ob = (Object *)value.data;
 	id_lib_extern((ID *)ob);
 	vcob->object = ob;
+	if (ob) {
+		ob->dt = OB_WIRE;
+		DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
+		WM_main_add_notifier(NC_OBJECT | ND_DRAW, ob);
+	}
 }
 
 static void rna_RemeshModifier_voxel_size_set(PointerRNA *ptr, float value)
@@ -4255,6 +4260,7 @@ static void rna_def_modifier_remesh(BlenderRNA *brna)
 
 	prop = RNA_def_property(srna, "object", PROP_POINTER, PROP_NONE);
 	RNA_def_property_struct_type(prop, "Object");
+	RNA_def_property_pointer_sdna(prop, NULL, "object");
 	RNA_def_property_pointer_funcs(prop, "rna_CSGVolume_object_get",
 	                                     "rna_CSGVolume_object_set",
 	                                     NULL,
diff --git a/source/blender/modifiers/intern/MOD_remesh.c b/source/blender/modifiers/intern/MOD_remesh.c
index e7d6e6af11e..09b06e40aca 100644
--- a/source/blender/modifiers/intern/MOD_remesh.c
+++ b/source/blender/modifiers/intern/MOD_remesh.c
@@ -373,7 +373,10 @@ static void foreachObjectLink(
 
 	for (vcob = rmd->csg_operands.first; vcob; vcob = vcob->next)
 	{
-		walk(userData, ob, &vcob->object, IDWALK_CB_NOP);
+		if (vcob->object)
+		{
+			walk(userData, ob, &vcob->object, IDWALK_CB_NOP);
+		}
 	}
 }
 
@@ -393,6 +396,15 @@ static void updateDepsgraph(ModifierData *md, const ModifierUpdateDepsgraphConte
 	DEG_add_modifier_to_transform_relation(ctx->node, "Remesh Modifier");
 }
 
+static void copyData(const ModifierData *md_src, ModifierData *md_dst, const int flag)
+{
+	RemeshModifierData *rmd_src = (RemeshModifierData*)md_src;
+	RemeshModifierData *rmd_dst = (RemeshModifierData*)md_dst;
+
+	modifier_copyData_generic(md_src, md_dst, flag);
+	BLI_duplicatelist(&rmd_dst->csg_operands, &rmd_src->csg_operands);
+}
+
 ModifierTypeInfo modifierType_Remesh = {
 	/* name */              "Remesh",
 	/* structName */        "RemeshModifierData",
@@ -403,7 +415,7 @@ ModifierTypeInfo modifierType_Remesh = {
 	                        eModifierTypeFlag_SupportsEditmode |
 	                        eModifierTypeFlag_SupportsMapping,
 
-	/* copyData */          modifier_copyData_generic,
+	/* copyData */          copyData,
 
 	/* deformVerts */       NULL,
 	/* deformMatrices */    NULL,



More information about the Bf-blender-cvs mailing list