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:
Diffstat (limited to 'source/blender/editors/physics/rigidbody_object.c')
-rw-r--r--source/blender/editors/physics/rigidbody_object.c38
1 files changed, 1 insertions, 37 deletions
diff --git a/source/blender/editors/physics/rigidbody_object.c b/source/blender/editors/physics/rigidbody_object.c
index ed6d31dfd9b..aa323dc53eb 100644
--- a/source/blender/editors/physics/rigidbody_object.c
+++ b/source/blender/editors/physics/rigidbody_object.c
@@ -86,43 +86,7 @@ static bool ED_operator_rigidbody_add_poll(bContext *C)
bool ED_rigidbody_object_add(Main *bmain, Scene *scene, Object *ob, int type, ReportList *reports)
{
- RigidBodyWorld *rbw = BKE_rigidbody_get_world(scene);
-
- if (ob->type != OB_MESH) {
- BKE_report(reports, RPT_ERROR, "Can't add Rigid Body to non mesh object");
- return false;
- }
-
- /* Add rigid body world and group if they don't exist for convenience */
- if (rbw == NULL) {
- rbw = BKE_rigidbody_create_world(scene);
- if (rbw == NULL) {
- BKE_report(reports, RPT_ERROR, "Can't create Rigid Body world");
- return false;
- }
- BKE_rigidbody_validate_sim_world(scene, rbw, false);
- scene->rigidbody_world = rbw;
- }
- if (rbw->group == NULL) {
- rbw->group = BKE_collection_add(bmain, NULL, "RigidBodyWorld");
- id_fake_user_set(&rbw->group->id);
- }
-
- /* make rigidbody object settings */
- 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 */
- BKE_collection_object_add(bmain, rbw->group, ob);
-
- DEG_relations_tag_update(bmain);
- DEG_id_tag_update(&ob->id, ID_RECALC_TRANSFORM);
- DEG_id_tag_update(&rbw->group->id, ID_RECALC_COPY_ON_WRITE);
-
- return true;
+ return BKE_rigidbody_add_object(bmain, scene, ob, type, reports);
}
void ED_rigidbody_object_remove(Main *bmain, Scene *scene, Object *ob)