[Bf-blender-cvs] [1edcfc3] particles_refactor: Very basic sync method for particles, which copies the state and updates the particle positions from rigid bodies.
Lukas Tönne
noreply at git.blender.org
Tue Apr 22 12:06:49 CEST 2014
Commit: 1edcfc363ee0c5374daa8d8906c1e2cd523ae92d
Author: Lukas Tönne
Date: Wed Jan 1 16:54:46 2014 +0100
https://developer.blender.org/rB1edcfc363ee0c5374daa8d8906c1e2cd523ae92d
Very basic sync method for particles, which copies the state and
updates the particle positions from rigid bodies.
===================================================================
M source/blender/blenkernel/intern/rigidbody.c
===================================================================
diff --git a/source/blender/blenkernel/intern/rigidbody.c b/source/blender/blenkernel/intern/rigidbody.c
index 0effde2..62b4f48 100644
--- a/source/blender/blenkernel/intern/rigidbody.c
+++ b/source/blender/blenkernel/intern/rigidbody.c
@@ -1390,8 +1390,22 @@ static void rigidbody_world_apply_object(Scene *UNUSED(scene), RigidBodyWorld *U
}
}
-static void rigidbody_world_apply_particles(Scene *UNUSED(scene), RigidBodyWorld *UNUSED(rbw), Object *ob, NParticleSystem *psys)
+static void rigidbody_world_apply_particles(Scene *UNUSED(scene), RigidBodyWorld *UNUSED(rbw), Object *UNUSED(ob), NParticleSystem *psys)
{
+ NParticleState *state;
+ NParticleIterator iter;
+
+ state = BKE_nparticle_state_copy(psys->state);
+ for (BKE_nparticle_iter_init(state, &iter); BKE_nparticle_iter_valid(&iter); BKE_nparticle_iter_next(&iter)) {
+ rbRigidBody *body = BKE_nparticle_iter_get_pointer(&iter, "rigid_body");
+ if (body) {
+ float pos[3];
+ RB_body_get_position(body, pos);
+ BKE_nparticle_iter_set_vector(&iter, "position", pos);
+ }
+ }
+
+ BKE_nparticle_system_set_state(psys, state);
}
static void rigidbody_world_apply(Scene *scene, RigidBodyWorld *rbw)
More information about the Bf-blender-cvs
mailing list