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:
Diffstat (limited to 'source/blender/blenloader/intern')
-rw-r--r--source/blender/blenloader/intern/readfile.c30
-rw-r--r--source/blender/blenloader/intern/writefile.c1
2 files changed, 30 insertions, 1 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index 6561318cd8b..000a9261d37 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -119,6 +119,7 @@
#include "BKE_object.h"
#include "BKE_sca.h" // for init_actuator
#include "BKE_scene.h"
+#include "BKE_softbody.h" // sbNew()
#include "BKE_texture.h" // for open_plugin_tex
#include "BKE_utildefines.h" // SWITCH_INT DATA ENDB DNA1 O_BINARY GLOB USER TEST REND
@@ -2316,7 +2317,13 @@ static void direct_link_object(FileData *fd, Object *ob)
}
ob->pd= newdataadr(fd, ob->pd);
- ob->soft= NULL;
+ ob->soft= newdataadr(fd, ob->soft);
+ if(ob->soft) {
+ SoftBody *sb= ob->soft; // init all stuff so it gets rebuilt nicely
+ sb->totpoint= sb->totspring= 0;
+ sb->bpoint= NULL;
+ sb->bspring= NULL;
+ }
link_list(fd, &ob->prop);
prop= ob->prop.first;
@@ -4625,6 +4632,7 @@ static void do_versions(Main *main)
}
}
if(main->versionfile <= 236) {
+ Object *ob;
Scene *sce= main->scene.first;
Camera *cam= main->camera.first;
bScreen *sc;
@@ -4653,6 +4661,26 @@ static void do_versions(Main *main)
}
}
}
+ /* temporal copy */
+ for(ob= main->object.first; ob; ob= ob->id.next) {
+ if(ob->softflag && ob->soft==NULL) {
+ SoftBody *sb;
+ ob->soft=sb= sbNew();
+
+ sb->goalspring= ob->sb_goalspring;
+ sb->goalfrict= ob->sb_goalfrict;
+ sb->inspring= ob->sb_inspring;
+ sb->infrict= ob->sb_infrict;
+ sb->nodemass= ob->sb_nodemass;
+ sb->grav= ob->sb_grav;
+ sb->mingoal= ob->sb_mingoal;
+ sb->maxgoal= ob->sb_maxgoal;
+ sb->mediafrict= ob->sb_mediafrict;
+ sb->rklimit= ob->softtime;
+
+ ob->softflag |= OB_SB_GOAL|OB_SB_EDGES;
+ }
+ }
}
/* don't forget to set version number in blender.c! */
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 054024b4d75..00b29f32127 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -683,6 +683,7 @@ static void write_objects(WriteData *wd, ListBase *idbase)
write_nlastrips(wd, &ob->nlastrips);
writestruct(wd, DATA, "PartDeflect", 1, ob->pd);
+ writestruct(wd, DATA, "SoftBody", 1, ob->soft);
for(hook= ob->hooks.first; hook; hook= hook->next) {
writestruct(wd, DATA, "ObHook", 1, hook);