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>2018-08-18 11:20:38 +0300
committerBastien Montagne <montagne29@wanadoo.fr>2018-08-18 11:21:33 +0300
commit27ccba0270a5af51d4c8e4f4fed5bbdf1a922802 (patch)
treef63d61a9193f22e5a69d3c653dc65aaa5de0eaba /source/blender/editors/physics
parentf86a60bc62ea281b0443df203a28a4083bd64341 (diff)
Fix T56439: Crash removing Rigid Body World.
Need to rebuild the graph when we add or remove rigidbody world!
Diffstat (limited to 'source/blender/editors/physics')
-rw-r--r--source/blender/editors/physics/rigidbody_world.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/physics/rigidbody_world.c b/source/blender/editors/physics/rigidbody_world.c
index da0099ba469..6cbdafc7ee6 100644
--- a/source/blender/editors/physics/rigidbody_world.c
+++ b/source/blender/editors/physics/rigidbody_world.c
@@ -42,9 +42,13 @@
#endif
#include "BKE_context.h"
+#include "BKE_main.h"
#include "BKE_report.h"
#include "BKE_rigidbody.h"
+#include "DEG_depsgraph.h"
+#include "DEG_depsgraph_build.h"
+
#include "RNA_access.h"
#include "WM_api.h"
@@ -83,6 +87,10 @@ static int rigidbody_world_add_exec(bContext *C, wmOperator *UNUSED(op))
// BKE_rigidbody_validate_sim_world(scene, rbw, false);
scene->rigidbody_world = rbw;
+ /* Full rebuild of DEG! */
+ DEG_relations_tag_update(bmain);
+ DEG_id_tag_update_ex(bmain, &scene->id, DEG_TAG_TIME);
+
return OPERATOR_FINISHED;
}
@@ -105,6 +113,7 @@ void RIGIDBODY_OT_world_add(wmOperatorType *ot)
static int rigidbody_world_remove_exec(bContext *C, wmOperator *op)
{
+ Main *bmain = CTX_data_main(C);
Scene *scene = CTX_data_scene(C);
RigidBodyWorld *rbw = scene->rigidbody_world;
@@ -116,6 +125,10 @@ static int rigidbody_world_remove_exec(bContext *C, wmOperator *op)
BKE_rigidbody_free_world(scene);
+ /* Full rebuild of DEG! */
+ DEG_relations_tag_update(bmain);
+ DEG_id_tag_update_ex(bmain, &scene->id, DEG_TAG_TIME);
+
/* done */
return OPERATOR_FINISHED;
}