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:
authorMartin Felke <martin.felke@googlemail.com>2017-12-26 23:15:01 +0300
committerMartin Felke <martin.felke@googlemail.com>2017-12-26 23:15:01 +0300
commit24f93213f24c1ff7ccfebf85602359f8c5f1f11b (patch)
treee1217f7b9729187bd79d4e88f9f22eacb222c33e /source/blender/editors/object
parentc77878ababf65159351900a0299c0d9aad71d62a (diff)
invalidate rigidbody cache/bake if rigidbody objects are duplicated or deleted as well
Diffstat (limited to 'source/blender/editors/object')
-rw-r--r--source/blender/editors/object/object_add.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/editors/object/object_add.c b/source/blender/editors/object/object_add.c
index d35ad28fc1f..1706c2fed5f 100644
--- a/source/blender/editors/object/object_add.c
+++ b/source/blender/editors/object/object_add.c
@@ -45,6 +45,7 @@
#include "DNA_object_fluidsim.h"
#include "DNA_object_force.h"
#include "DNA_object_types.h"
+#include "DNA_rigidbody_types.h"
#include "DNA_scene_types.h"
#include "DNA_vfont_types.h"
#include "DNA_actuator_types.h"
@@ -1121,6 +1122,12 @@ void ED_base_object_free_and_unlink(Main *bmain, Scene *scene, Base *base)
return;
}
+ /* here we need to invalidate the bake too*/
+ if (scene->rigidbody_world && scene->rigidbody_world->pointcache && base->object->rigidbody_object)
+ {
+ scene->rigidbody_world->pointcache->flag &= ~PTCACHE_BAKED;
+ }
+
BKE_scene_base_unlink(scene, base);
object_delete_check_glsl_update(base->object);
BKE_libblock_free_us(bmain, base->object);
@@ -2014,6 +2021,12 @@ static Base *object_add_duplicate_internal(Main *bmain, Scene *scene, Base *base
obn = ID_NEW_SET(ob, BKE_object_copy(bmain, ob));
DAG_id_tag_update(&obn->id, OB_RECALC_OB | OB_RECALC_DATA | OB_RECALC_TIME);
+ /*invalidate rigidbody bake and cache if it was a rigidbody object*/
+ if (scene->rigidbody_world && scene->rigidbody_world->pointcache && ob->rigidbody_object)
+ {
+ scene->rigidbody_world->pointcache->flag &= ~PTCACHE_BAKED;
+ }
+
basen = MEM_mallocN(sizeof(Base), "duplibase");
*basen = *base;
BLI_addhead(&scene->base, basen); /* addhead: prevent eternal loop */