[Bf-blender-cvs] [0859c99bf27] fracture_modifier: fix for loading crash with dynamic fracture
Martin Felke
noreply at git.blender.org
Thu Jan 25 16:08:41 CET 2018
Commit: 0859c99bf27918d3b28df059ea242209a52fe628
Author: Martin Felke
Date: Thu Jan 25 16:08:25 2018 +0100
Branches: fracture_modifier
https://developer.blender.org/rB0859c99bf27918d3b28df059ea242209a52fe628
fix for loading crash with dynamic fracture
forgot to copy the fracmesh, but this now might increase mem usage
===================================================================
M source/blender/blenloader/intern/writefile.c
M source/blender/modifiers/intern/MOD_fracture.c
===================================================================
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 399936c172b..dbd2d341dda 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1993,6 +1993,8 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
write_meshIsland(wd, mi, true);
}
}
+
+ writestruct(wd, DATA, AnimBind, fmd->anim_bind_len, fmd->anim_bind);
}
}
else if (md->type == eModifierType_SurfaceDeform) {
diff --git a/source/blender/modifiers/intern/MOD_fracture.c b/source/blender/modifiers/intern/MOD_fracture.c
index 00f6e32c020..a00d688652a 100644
--- a/source/blender/modifiers/intern/MOD_fracture.c
+++ b/source/blender/modifiers/intern/MOD_fracture.c
@@ -343,8 +343,8 @@ static void free_simulation(FractureModifierData *fmd, bool do_free_seq, bool do
{
ssq = fmd->shard_sequence.first;
BLI_remlink(&fmd->shard_sequence, ssq);
- //BKE_fracmesh_free(ssq->frac_mesh, true);
- //MEM_freeN(ssq->frac_mesh);
+ BKE_fracmesh_free(ssq->frac_mesh, true);
+ MEM_freeN(ssq->frac_mesh);
MEM_freeN(ssq);
}
@@ -509,7 +509,7 @@ static void freeData(ModifierData *md)
{
FractureModifierData *fmd = (FractureModifierData *) md;
- freeData_internal(fmd, fmd->fracture_mode == MOD_FRACTURE_DYNAMIC, false);
+ freeData_internal(fmd, fmd->fracture_mode == MOD_FRACTURE_DYNAMIC, true);
/*force deletion of meshshards here, it slips through improper state detection*/
/*here we know the modifier is about to be deleted completely*/
@@ -4709,8 +4709,16 @@ static ShardSequence* shard_sequence_add(FractureModifierData* fmd, float frame,
}
else {
/* create first shard covering the entire mesh */
- s = BKE_create_fracture_shard(dm->getVertArray(dm), dm->getPolyArray(dm), dm->getLoopArray(dm), dm->getEdgeArray(dm),
- dm->numVertData, dm->numPolyData, dm->numLoopData, dm->numEdgeData, true);
+ s = BKE_create_fracture_shard(dm->getVertArray(dm),
+ dm->getPolyArray(dm),
+ dm->getLoopArray(dm),
+ dm->getEdgeArray(dm),
+ dm->numVertData,
+ dm->numPolyData,
+ dm->numLoopData,
+ dm->numEdgeData,
+ true);
+
s = BKE_custom_data_to_shard(s, dm);
s->flag = SHARD_INTACT;
s->shard_id = 0;
@@ -4726,7 +4734,7 @@ static ShardSequence* shard_sequence_add(FractureModifierData* fmd, float frame,
ssq->frac_mesh = fmd->frac_mesh;
}
else {
- ssq->frac_mesh = fmd->frac_mesh; //copy_fracmesh(fmd->frac_mesh);
+ ssq->frac_mesh = copy_fracmesh(fmd->frac_mesh);
}
ssq->is_new = true;
More information about the Bf-blender-cvs
mailing list