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:
authorTon Roosendaal <ton@blender.org>2005-05-02 17:28:13 +0400
committerTon Roosendaal <ton@blender.org>2005-05-02 17:28:13 +0400
commit42126cb5fcceda5485d02af7efbfe996b4aae160 (patch)
tree12dfc4c41f600ca481a50be691e9fe0058d741fc /source/blender/blenloader
parent2606a5c5d37e6460066dae78e88d47fde6552c65 (diff)
Added baking for softbodies.
Works as follows; - press the 'show bake settings' button (no space left... :) - define start/end frame for bake, and an interval step. The baked result interpolates nicely (Bspline, 4 keys) so in general a step size of 2 or 3 still gives OK results. - Press "BAKE". This will do a full animation + playback. Press ESC if it you don't want it. Once Baked, the BAKE button becomes a FREE BAKE. As reminder the softbody buttons get blocked with error() menu. This saves OK in a file. Renders any frame, including fields and moblur. You can also set a "Timeoffs" for the softbody. And yes, this should be in the NLA once... :) NOTE! With this commit, files saved with the old (first commit) version by Jens Ole won't read the settings back... he stored all sofbody variables in Object, which was moved to a new struct when I did my first commit on SB (over a month ago) Also note that I moved particle deflecting & softbody to a new include.
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r--source/blender/blenloader/intern/readfile.c93
-rw-r--r--source/blender/blenloader/intern/writefile.c61
2 files changed, 83 insertions, 71 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c
index a3d9e0e1202..32bd71c9c9f 100644
--- a/source/blender/blenloader/intern/readfile.c
+++ b/source/blender/blenloader/intern/readfile.c
@@ -59,45 +59,47 @@
#include "nla.h"
+#include "DNA_action_types.h"
+#include "DNA_armature_types.h"
#include "DNA_ID.h"
-#include "DNA_packedFile_types.h"
-#include "DNA_property_types.h"
#include "DNA_actuator_types.h"
+#include "DNA_camera_types.h"
#include "DNA_controller_types.h"
-#include "DNA_sensor_types.h"
-#include "DNA_sdna_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_sequence_types.h"
+#include "DNA_constraint_types.h"
+#include "DNA_curve_types.h"
+#include "DNA_effect_types.h"
+#include "DNA_fileglobal_types.h"
+#include "DNA_group_types.h"
+#include "DNA_ipo_types.h"
#include "DNA_ika_types.h"
-#include "DNA_camera_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_texture_types.h"
+#include "DNA_image_types.h"
#include "DNA_key_types.h"
-#include "DNA_meta_types.h"
+#include "DNA_lattice_types.h"
#include "DNA_lamp_types.h"
-#include "DNA_object_types.h"
-#include "DNA_world_types.h"
-#include "DNA_ipo_types.h"
+#include "DNA_meta_types.h"
+#include "DNA_material_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
-#include "DNA_image_types.h"
-#include "DNA_material_types.h"
-#include "DNA_curve_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_effect_types.h"
+#include "DNA_nla_types.h"
+#include "DNA_object_types.h"
+#include "DNA_object_force.h"
+#include "DNA_oops_types.h"
+#include "DNA_object_force.h"
+#include "DNA_packedFile_types.h"
+#include "DNA_property_types.h"
#include "DNA_text_types.h"
#include "DNA_view3d_types.h"
#include "DNA_screen_types.h"
+#include "DNA_sensor_types.h"
+#include "DNA_sdna_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_sequence_types.h"
#include "DNA_sound_types.h"
#include "DNA_space_types.h"
-#include "DNA_oops_types.h"
-#include "DNA_group_types.h"
+#include "DNA_texture_types.h"
#include "DNA_userdef_types.h"
-#include "DNA_fileglobal_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_action_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_nla_types.h"
+#include "DNA_vfont_types.h"
+#include "DNA_world_types.h"
#include "MEM_guardedalloc.h"
#include "BLI_blenlib.h"
@@ -2289,8 +2291,9 @@ static void direct_link_object(FileData *fd, Object *ob)
bController *cont;
bActuator *act;
ObHook *hook;
+ int a;
- ob->disp.first=ob->disp.last= 0;
+ ob->disp.first=ob->disp.last= NULL;
ob->pose= newdataadr(fd, ob->pose);
direct_link_pose(fd, ob->pose);
@@ -2320,10 +2323,18 @@ static void direct_link_object(FileData *fd, Object *ob)
ob->pd= newdataadr(fd, ob->pd);
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;
+ SoftBody *sb= ob->soft;
+
+ sb->bpoint= NULL; // init pointers so it gets rebuilt nicely
sb->bspring= NULL;
+
+ sb->keys= newdataadr(fd, sb->keys);
+ test_pointer_array(fd, (void **)&sb->keys);
+ if(sb->keys) {
+ for(a=0; a<sb->totkey; a++) {
+ sb->keys[a]= newdataadr(fd, sb->keys[a]);
+ }
+ }
}
link_list(fd, &ob->prop);
@@ -4689,27 +4700,17 @@ static void do_versions(Main *main)
}
}
- /* temporal copy */
+ /* softbody init new vars */
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;
- }
if(ob->soft) {
if(ob->soft->defgoal==0.0) ob->soft->defgoal= 0.7;
if(ob->soft->physics_speed==0.0) ob->soft->physics_speed= 1.0;
+
+ if(ob->soft->interval==0) {
+ ob->soft->interval= 2;
+ ob->soft->sfra= 1;
+ ob->soft->efra= 100;
+ }
}
if(ob->soft && ob->soft->vertgroup==0) {
bDeformGroup *locGroup = get_named_vertexgroup(ob, "SOFTGOAL");
diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c
index 00b29f32127..419897706fd 100644
--- a/source/blender/blenloader/intern/writefile.c
+++ b/source/blender/blenloader/intern/writefile.c
@@ -100,44 +100,45 @@ Important to know is that 'streaming' has been added to files, for Blender Publi
#include "nla.h" // __NLA is defined
-#include "DNA_packedFile_types.h"
-#include "DNA_sdna_types.h"
-#include "DNA_property_types.h"
-#include "DNA_sensor_types.h"
-#include "DNA_controller_types.h"
+#include "DNA_armature_types.h"
+#include "DNA_action_types.h"
#include "DNA_actuator_types.h"
-#include "DNA_effect_types.h"
-#include "DNA_object_types.h"
-#include "DNA_userdef_types.h"
-#include "DNA_vfont_types.h"
-#include "DNA_ipo_types.h"
+#include "DNA_controller_types.h"
#include "DNA_curve_types.h"
+#include "DNA_constraint_types.h"
#include "DNA_camera_types.h"
+#include "DNA_effect_types.h"
+#include "DNA_group_types.h"
+#include "DNA_image_types.h"
+#include "DNA_ika_types.h"
+#include "DNA_ipo_types.h"
+#include "DNA_fileglobal_types.h"
+#include "DNA_key_types.h"
+#include "DNA_lattice_types.h"
+#include "DNA_listBase.h" /* for Listbase, the type of samples, ...*/
+#include "DNA_lamp_types.h"
#include "DNA_meta_types.h"
#include "DNA_mesh_types.h"
#include "DNA_meshdata_types.h"
#include "DNA_material_types.h"
-#include "DNA_lattice_types.h"
-#include "DNA_armature_types.h"
-#include "DNA_sequence_types.h"
-#include "DNA_ika_types.h"
-#include "DNA_group_types.h"
+#include "DNA_nla_types.h"
+#include "DNA_object_types.h"
+#include "DNA_object_force.h"
#include "DNA_oops_types.h"
+#include "DNA_packedFile_types.h"
+#include "DNA_property_types.h"
+#include "DNA_scene_types.h"
+#include "DNA_sdna_types.h"
+#include "DNA_sequence_types.h"
+#include "DNA_sensor_types.h"
#include "DNA_space_types.h"
#include "DNA_screen_types.h"
-#include "DNA_view3d_types.h"
-#include "DNA_lamp_types.h"
-#include "DNA_fileglobal_types.h"
#include "DNA_sound_types.h"
#include "DNA_texture_types.h"
#include "DNA_text_types.h"
-#include "DNA_image_types.h"
-#include "DNA_key_types.h"
-#include "DNA_scene_types.h"
-#include "DNA_constraint_types.h"
-#include "DNA_listBase.h" /* for Listbase, the type of samples, ...*/
-#include "DNA_action_types.h"
-#include "DNA_nla_types.h"
+#include "DNA_view3d_types.h"
+#include "DNA_vfont_types.h"
+#include "DNA_userdef_types.h"
#include "MEM_guardedalloc.h" // MEM_freeN
#include "BLI_blenlib.h"
@@ -661,6 +662,7 @@ static void write_objects(WriteData *wd, ListBase *idbase)
{
Object *ob;
ObHook *hook;
+ int a;
ob= idbase->first;
while(ob) {
@@ -684,6 +686,15 @@ static void write_objects(WriteData *wd, ListBase *idbase)
writestruct(wd, DATA, "PartDeflect", 1, ob->pd);
writestruct(wd, DATA, "SoftBody", 1, ob->soft);
+ if(ob->soft) {
+ SoftBody *sb= ob->soft;
+ if(sb->keys) {
+ writedata(wd, DATA, sizeof(void *)*sb->totkey, sb->keys);
+ for(a=0; a<sb->totkey; a++) {
+ writestruct(wd, DATA, "SBVertex", sb->totpoint, sb->keys[a]);
+ }
+ }
+ }
for(hook= ob->hooks.first; hook; hook= hook->next) {
writestruct(wd, DATA, "ObHook", 1, hook);