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:
authorBrecht Van Lommel <brechtvanlommel@gmail.com>2019-06-24 15:57:52 +0300
committerBrecht Van Lommel <brechtvanlommel@gmail.com>2019-06-24 19:46:36 +0300
commita5ff780065bf6768811bf459953a1a1eabe989c1 (patch)
tree484c17b31a114495164e2a2979b91c2a266b05fc /source/blender/editors/physics
parent7d3a28d2d9a568f020ab57ca9504d3dccba18e5b (diff)
Fix T63828, T62005: copy/paste or append loses rigid body object
Previously settings were removed, now add to the rigid body world automatically even if it's a bit ill defined, since this is confusing for users. Fundamentally the concept of a rigid body world collection could be revised, and left only as an optional thing.
Diffstat (limited to 'source/blender/editors/physics')
-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)