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:
authorBastien Montagne <montagne29@wanadoo.fr>2019-10-04 19:51:00 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2019-10-04 19:57:14 +0300
commitbebdb6c8249939623f80cc72433aa7d7418444bf (patch)
treefb8f4be6211629e21738d3b8708f77e69b7e804c /source/blender/blenkernel/intern/scene.c
parent3c146283810fd8257b8405005e74bb37db035107 (diff)
Fix assert when deleting a RBW constraint object.
Side-reported in T70505. Code did not ensure deleted object was removed from the RBW constraints collection, leading to some invalid status (object in constraints collection but without relevant contraints data). Also fixed another issue - code deleting RBW objects would try to remove any constraint one using it as target, in a very bad and broken way, since you cannot iterate over objects of a collection while removing some... Now instead just NULLify relevant pointers... I hope it works, otherwise we'll have to take a different approach. Needless to stress again how weak the whole RBW code is in general, and regarding same object being used by RBW in more than one scene in particular, that is known broken situation anyway.
Diffstat (limited to 'source/blender/blenkernel/intern/scene.c')
-rw-r--r--source/blender/blenkernel/intern/scene.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/source/blender/blenkernel/intern/scene.c b/source/blender/blenkernel/intern/scene.c
index 4f855bd7d98..e8e849cdf6d 100644
--- a/source/blender/blenkernel/intern/scene.c
+++ b/source/blender/blenkernel/intern/scene.c
@@ -1076,15 +1076,18 @@ int BKE_scene_frame_snap_by_seconds(Scene *scene, double interval_in_seconds, in
return (delta_prev < delta_next) ? second_prev : second_next;
}
-void BKE_scene_remove_rigidbody_object(struct Main *bmain, Scene *scene, Object *ob)
+void BKE_scene_remove_rigidbody_object(struct Main *bmain,
+ Scene *scene,
+ Object *ob,
+ const bool free_us)
{
/* remove rigid body constraint from world before removing object */
if (ob->rigidbody_constraint) {
- BKE_rigidbody_remove_constraint(scene, ob);
+ BKE_rigidbody_remove_constraint(bmain, scene, ob, free_us);
}
/* remove rigid body object from world before removing object */
if (ob->rigidbody_object) {
- BKE_rigidbody_remove_object(bmain, scene, ob);
+ BKE_rigidbody_remove_object(bmain, scene, ob, free_us);
}
}