[Bf-blender-cvs] [13f0ec2] alembic: Extended RNA update for shape keys to trigger re-reading of dupli caches.
Lukas Tönne
noreply at git.blender.org
Thu May 7 15:26:21 CEST 2015
Commit: 13f0ec29cee211b00befa1434a54b63f6dee9a40
Author: Lukas Tönne
Date: Thu May 7 15:25:45 2015 +0200
Branches: alembic
https://developer.blender.org/rB13f0ec29cee211b00befa1434a54b63f6dee9a40
Extended RNA update for shape keys to trigger re-reading of dupli caches.
===================================================================
M source/blender/blenkernel/BKE_cache_library.h
M source/blender/blenkernel/intern/cache_library.c
M source/blender/makesrna/intern/rna_key.c
===================================================================
diff --git a/source/blender/blenkernel/BKE_cache_library.h b/source/blender/blenkernel/BKE_cache_library.h
index a097db1..4258ac7 100644
--- a/source/blender/blenkernel/BKE_cache_library.h
+++ b/source/blender/blenkernel/BKE_cache_library.h
@@ -51,6 +51,7 @@ struct CacheProcessData;
struct BVHTreeFromMesh;
struct Strands;
struct StrandsKeyCacheModifier;
+struct Key;
struct KeyBlock;
struct ClothModifierData;
@@ -182,6 +183,7 @@ bool BKE_cache_modifier_find_strands(struct DupliCache *dupcache, struct Object
struct KeyBlock *BKE_cache_modifier_strands_key_insert_key(struct StrandsKeyCacheModifier *md, struct Strands *strands, const char *name, const bool from_mix);
bool BKE_cache_modifier_strands_key_get(struct Object *ob, struct StrandsKeyCacheModifier **r_skmd, struct DerivedMesh **r_dm, struct Strands **r_strands,
struct DupliObjectData **r_dobdata, const char **r_name, float r_mat[4][4]);
+bool BKE_cache_library_uses_key(struct CacheLibrary *cachelib, struct Key *key);
/* ========================================================================= */
diff --git a/source/blender/blenkernel/intern/cache_library.c b/source/blender/blenkernel/intern/cache_library.c
index ce14ac6..fd90588 100644
--- a/source/blender/blenkernel/intern/cache_library.c
+++ b/source/blender/blenkernel/intern/cache_library.c
@@ -1368,6 +1368,19 @@ bool BKE_cache_modifier_strands_key_get(Object *ob, StrandsKeyCacheModifier **r_
return false;
}
+bool BKE_cache_library_uses_key(CacheLibrary *cachelib, Key *key)
+{
+ CacheModifier *md;
+ for (md = cachelib->modifiers.first; md; md = md->next) {
+ if (md->type == eCacheModifierType_StrandsKey) {
+ StrandsKeyCacheModifier *skmd = (StrandsKeyCacheModifier *)md;
+ if (skmd->key == key)
+ return true;
+ }
+ }
+ return false;
+}
+
void BKE_cache_modifier_init(void)
{
cache_modifier_type_set(eCacheModifierType_HairSimulation, &cacheModifierType_HairSimulation);
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c
index d34af9f..b513ea0 100644
--- a/source/blender/makesrna/intern/rna_key.c
+++ b/source/blender/makesrna/intern/rna_key.c
@@ -47,10 +47,12 @@
#include <stddef.h>
+#include "DNA_cache_library_types.h"
#include "DNA_object_types.h"
#include "DNA_scene_types.h"
#include "BKE_animsys.h"
+#include "BKE_cache_library.h"
#include "BKE_depsgraph.h"
#include "BKE_key.h"
#include "BKE_main.h"
@@ -375,6 +377,7 @@ static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *p
{
Key *key = ptr->id.data;
Object *ob;
+ CacheLibrary *cachelib;
for (ob = bmain->object.first; ob; ob = ob->id.next) {
if (BKE_key_from_object(ob) == key) {
@@ -382,6 +385,13 @@ static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *p
WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob);
}
}
+
+ for (cachelib = bmain->cache_library.first; cachelib; cachelib = cachelib->id.next) {
+ if (BKE_cache_library_uses_key(cachelib, key)) {
+ DAG_id_tag_update(&cachelib->id, OB_RECALC_DATA);
+ WM_main_add_notifier(NC_WINDOW, NULL);
+ }
+ }
}
static KeyBlock *rna_ShapeKeyData_find_keyblock(Key *key, float *point)
More information about the Bf-blender-cvs
mailing list