[Bf-blender-cvs] [fc5ffd9] fracture_modifier: store constraints for prefractured mode now too in blend
Martin Felke
noreply at git.blender.org
Wed Mar 30 15:18:36 CEST 2016
Commit: fc5ffd9694a776883d6aad69c80e93b46fae89cb
Author: Martin Felke
Date: Wed Mar 30 10:24:08 2016 +0200
Branches: fracture_modifier
https://developer.blender.org/rBfc5ffd9694a776883d6aad69c80e93b46fae89cb
store constraints for prefractured mode now too in blend
this automatically creates constraints from scratch as fallback for older files
===================================================================
M source/blender/blenloader/intern/readfile.c
M source/blender/blenloader/intern/writefile.c
===================================================================
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 46053a2..27bd0ec 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5281,7 +5281,7 @@ static void load_fracture_modifier(FileData* fd, FractureModifierData *fmd)
i++;
}
- if (fmd->fracture_mode == MOD_FRACTURE_EXTERNAL)
+ //if (fmd->fracture_mode == MOD_FRACTURE_EXTERNAL)
{
RigidBodyShardCon *con;
link_list(fd, &fmd->meshConstraints);
@@ -5293,6 +5293,16 @@ static void load_fracture_modifier(FileData* fd, FractureModifierData *fmd)
con->physics_constraint = NULL;
con->flag |= RBC_FLAG_NEEDS_VALIDATE;
}
+
+ if (fmd->meshConstraints.first == NULL)
+ { //fallback... rebuild constraints from scratch if none are found
+ if (fmd->fracture_mode == MOD_FRACTURE_PREFRACTURED)
+ {
+ fmd->refresh_constraints = true;
+ fmd->meshConstraints.first = NULL;
+ fmd->meshConstraints.last = NULL;
+ }
+ }
}
MEM_freeN(shards);
@@ -5372,12 +5382,14 @@ static void load_fracture_modifier(FileData* fd, FractureModifierData *fmd)
}
}
+#if 0
if (fmd->fracture_mode != MOD_FRACTURE_EXTERNAL)
{
fmd->refresh_constraints = true;
fmd->meshConstraints.first = NULL;
fmd->meshConstraints.last = NULL;
}
+#endif
fmd->refresh_images = true;
fmd->auto_execute = autoexec;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index a40a754..8fec906 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1565,23 +1565,8 @@ static void write_shard(WriteData* wd, Shard* s)
static void write_meshIsland(WriteData* wd, MeshIsland* mi)
{
-#if 0
- DerivedMesh *dm = mi->physics_mesh;
- mi->temp = BKE_create_fracture_shard(dm->getVertArray(dm), dm->getPolyArray(dm), dm->getLoopArray(dm),
- dm->getNumVerts(dm), dm->getNumPolys(dm), dm->getNumLoops(dm), true);
- mi->temp = BKE_custom_data_to_shard(mi->temp, dm);
-#endif
writestruct(wd, DATA, "MeshIsland", 1, mi);
writedata(wd, DATA, sizeof(float) * 3 * mi->vertex_count, mi->vertco);
-#if 0
- /* write derivedmesh as shard... */
- mi->temp->next = NULL;
- mi->temp->prev = NULL;
- write_shard(wd, mi->temp);
- BKE_shard_free(mi->temp, true);
- mi->temp = NULL;
-#endif
-
writedata(wd, DATA, sizeof(short) * 3 * mi->vertex_count, mi->vertno);
writestruct(wd, DATA, "RigidBodyOb", 1, mi->rigidbody);
@@ -1748,7 +1733,7 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
write_meshIsland(wd, mi);
}
- if (fmd->fracture_mode == MOD_FRACTURE_EXTERNAL)
+ //if (fmd->fracture_mode == MOD_FRACTURE_EXTERNAL)
{
RigidBodyShardCon *con;
for (con = fmd->meshConstraints.first; con; con = con->next)
More information about the Bf-blender-cvs
mailing list