diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2014-10-29 15:06:08 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2014-10-29 15:11:10 +0300 |
commit | 279cfdeef5f17767d7c662a493be1f236484bebe (patch) | |
tree | 6fa8e85cba5016f6fff31823b19b77c2f78d2332 /release | |
parent | a6c2d02366682d9375b8b69185f657b99ac8f038 (diff) |
Fix T42394: Copy Rigid Body Tools would not work as expected if dest ob had no rigidbody yet.
Adding new object to RigidBodyWorld obgroup is not a good way to do that, since it only
takes effect (create rigid_body for new objects) when you change current frame.
Better to use rigidbody.object_add() operator here!
Diffstat (limited to 'release')
-rw-r--r-- | release/scripts/startup/bl_operators/rigidbody.py | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/release/scripts/startup/bl_operators/rigidbody.py b/release/scripts/startup/bl_operators/rigidbody.py index 9a3aae53ceb..237c2d55672 100644 --- a/release/scripts/startup/bl_operators/rigidbody.py +++ b/release/scripts/startup/bl_operators/rigidbody.py @@ -64,17 +64,19 @@ class CopyRigidbodySettings(Operator): for o in context.selected_objects: if o.type != 'MESH': o.select = False + elif o.rigid_body is None: + # Add rigidbody to object! + scene.objects.active = o + bpy.ops.rigidbody.object_add() + scene.objects.active = obj_act objects = context.selected_objects if objects: - # add selected objects to active one groups and recalculate - bpy.ops.group.objects_add_active() - scene.frame_set(scene.frame_current) rb_from = obj_act.rigid_body # copy settings for o in objects: rb_to = o.rigid_body - if (o == obj_act) or (rb_to is None): + if o == obj_act: continue for attr in self._attrs: setattr(rb_to, attr, getattr(rb_from, attr)) |