diff options
author | Sergej Reich <sergej.reich@googlemail.com> | 2013-02-12 18:45:57 +0400 |
---|---|---|
committer | Sergej Reich <sergej.reich@googlemail.com> | 2013-02-12 18:45:57 +0400 |
commit | 92b6a54e5036db83146a3e28de78b65d5c4cffc5 (patch) | |
tree | 3399f1b3c7637c3688f5d1e08594a72f4243b1f5 /source/blender/editors/physics | |
parent | ca0e18f88b7628a44251761bc5b012ebd7bd19f7 (diff) |
rigidbody: Don't cancel add operator if rigid body already exists
In some cases objects might have rigid bodies but aren't in the rigid
body group, just add objects to the group then.
Also allow changing the rigid body type by using the add acive/passive
buttons. This avoids having to remove objects just to change type.
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r-- | source/blender/editors/physics/rigidbody_object.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c index 092c3370dbf..2bf962f4f4a 100644 --- a/source/blender/editors/physics/rigidbody_object.c +++ b/source/blender/editors/physics/rigidbody_object.c @@ -93,11 +93,6 @@ void ED_rigidbody_ob_add(wmOperator *op, Scene *scene, Object *ob, int type) { RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene); - /* check that object doesn't already belong to the current simulation */ - if (ob->rigidbody_object) { - BKE_reportf(op->reports, RPT_INFO, "Object '%s' already has a Rigid Body", ob->id.name + 2); - return; - } if (ob->type != OB_MESH) { BKE_report(op->reports, RPT_ERROR, "Can't add Rigid Body to non mesh object"); return; @@ -118,11 +113,16 @@ void ED_rigidbody_ob_add(wmOperator *op, Scene *scene, Object *ob, int type) } /* make rigidbody object settings */ - ob->rigidbody_object = BKE_rigidbody_create_object(scene, ob, type); + if (ob->rigidbody_object == NULL) { + ob->rigidbody_object = BKE_rigidbody_create_object(scene, ob, type); + } + ob->rigidbody_object->type = type; ob->rigidbody_object->flag |= RBO_FLAG_NEEDS_VALIDATE; /* add object to rigid body group */ add_to_group(rbw->group, ob, scene, NULL); + + DAG_id_tag_update(&ob->id, OB_RECALC_OB); } void ED_rigidbody_ob_remove(Scene *scene, Object *ob) |