diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2013-01-23 09:56:27 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2013-01-23 09:56:27 +0400 |
commit | fc377c17e3d4803ef4db7a72daae629a322ffde8 (patch) | |
tree | c43f307994e27dbcc6bd84775a7a97112fd27350 /source/blender/blenloader | |
parent | 27601aaf017263bf356dce37a4b90a764a819ee7 (diff) |
rigidbody: Add force field support
Force fields work with rigid bodies just like they do with other simulations.
Increase min and max strength of force fields so they can influence heavy rigid
bodies.
TODO: Adjust force field strength based on the time step taken.
Part of GSoC 2010 and 2012.
Authors: Joshua Leung (aligorith), Sergej Reich (sergof)
Diffstat (limited to 'source/blender/blenloader')
-rw-r--r-- | source/blender/blenloader/intern/readfile.c | 7 | ||||
-rw-r--r-- | source/blender/blenloader/intern/writefile.c | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenloader/intern/readfile.c b/source/blender/blenloader/intern/readfile.c index 95fa4018392..b0f1d3f37ed 100644 --- a/source/blender/blenloader/intern/readfile.c +++ b/source/blender/blenloader/intern/readfile.c @@ -5021,6 +5021,8 @@ static void lib_link_scene(FileData *fd, Main *main) RigidBodyWorld *rbw = sce->rigidbody_world; if (rbw->group) rbw->group = newlibadr(fd, sce->id.lib, rbw->group); + if (rbw->effector_weights) + rbw->effector_weights->group = newlibadr(fd, sce->id.lib, rbw->effector_weights->group); } if (sce->nodetree) { @@ -5296,6 +5298,11 @@ static void direct_link_scene(FileData *fd, Scene *sce) rbw->physics_world = NULL; rbw->objects = NULL; rbw->numbodies = 0; + + /* set effector weights */ + rbw->effector_weights = newdataadr(fd, rbw->effector_weights); + if (!rbw->effector_weights) + rbw->effector_weights = BKE_add_effector_weights(NULL); } } diff --git a/source/blender/blenloader/intern/writefile.c b/source/blender/blenloader/intern/writefile.c index a52e4e28981..da50a05a3d9 100644 --- a/source/blender/blenloader/intern/writefile.c +++ b/source/blender/blenloader/intern/writefile.c @@ -2306,6 +2306,7 @@ static void write_scenes(WriteData *wd, ListBase *scebase) /* writing RigidBodyWorld data to the blend file */ if (sce->rigidbody_world) { writestruct(wd, DATA, "RigidBodyWorld", 1, sce->rigidbody_world); + writestruct(wd, DATA, "EffectorWeights", 1, sce->rigidbody_world->effector_weights); } sce= sce->id.next; |