[Bf-blender-cvs] [24f93213f24] fracture_modifier: invalidate rigidbody cache/bake if rigidbody objects are duplicated or deleted as well
Martin Felke
noreply at git.blender.org
Tue Dec 26 21:15:19 CET 2017
Commit: 24f93213f24c1ff7ccfebf85602359f8c5f1f11b
Author: Martin Felke
Date: Tue Dec 26 21:15:01 2017 +0100
Branches: fracture_modifier
https://developer.blender.org/rB24f93213f24c1ff7ccfebf85602359f8c5f1f11b
invalidate rigidbody cache/bake if rigidbody objects are duplicated or deleted as well
===================================================================
M source/blender/editors/object/object_add.c
===================================================================
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 */
More information about the Bf-blender-cvs
mailing list