[Bf-blender-cvs] [54845fbfa3d] rigid_deform: make writefile and readfile work
Jacques Lucke
noreply at git.blender.org
Thu Jan 31 19:55:46 CET 2019
Commit: 54845fbfa3dd814f5b8c6ef0feb8af517dbfcf2a
Author: Jacques Lucke
Date: Sun Dec 9 17:41:34 2018 +0100
Branches: rigid_deform
https://developer.blender.org/rB54845fbfa3dd814f5b8c6ef0feb8af517dbfcf2a
make writefile and readfile work
===================================================================
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 42f3c35034e..598f9cdc360 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -5334,6 +5334,21 @@ static void direct_link_modifiers(FileData *fd, ListBase *lb)
}
lmd->cache_system = NULL;
}
+ else if (md->type == eModifierType_RigidDeform) {
+ RigidDeformModifierData *rdmd = (RigidDeformModifierData *)md;
+ RigidDeformModifierBindData *bind = newdataadr(fd, rdmd->bind_data);
+ rdmd->bind_data = bind;
+ rdmd->cache = NULL;
+
+ if (bind) {
+ bind->initial_positions = newdataadr(fd, bind->initial_positions);
+ bind->anchor_indices = newdataadr(fd, bind->anchor_indices);
+ if (fd->flags & FD_FLAGS_SWITCH_ENDIAN) {
+ BLI_endian_switch_float_array((float *)bind->initial_positions, bind->vertex_amount * sizeof(float) * 3);
+ BLI_endian_switch_int32_array(bind->anchor_indices, bind->anchor_amount * sizeof(int));
+ }
+ }
+ }
else if (md->type == eModifierType_CorrectiveSmooth) {
CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md;
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index fb5d41d0071..b83f95c024c 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -1773,12 +1773,19 @@ static void write_modifiers(WriteData *wd, ListBase *modbase)
writedata(wd, DATA, sizeof(float) * lmd->total_verts * 3, lmd->vertexco);
}
+ else if (md->type == eModifierType_RigidDeform) {
+ RigidDeformModifierData *rdmd = (RigidDeformModifierData *)md;
+ RigidDeformModifierBindData *bind = rdmd->bind_data;
+ writestruct(wd, DATA, RigidDeformModifierBindData, 1, bind);
+
+ if (bind) {
+ writedata(wd, DATA, sizeof(float) * 3 * bind->vertex_amount, bind->initial_positions);
+ writedata(wd, DATA, sizeof(int) * bind->anchor_amount, bind->anchor_indices);
+ }
+ }
else if (md->type == eModifierType_CorrectiveSmooth) {
CorrectiveSmoothModifierData *csmd = (CorrectiveSmoothModifierData *)md;
- if (csmd->bind_coords) {
- writedata(wd, DATA, sizeof(float[3]) * csmd->bind_coords_num, csmd->bind_coords);
- }
}
else if (md->type == eModifierType_SurfaceDeform) {
SurfaceDeformModifierData *smd = (SurfaceDeformModifierData *)md;
More information about the Bf-blender-cvs
mailing list