diff options
Diffstat (limited to 'source/blender/makesrna/intern/rna_key.c')
-rw-r--r-- | source/blender/makesrna/intern/rna_key.c | 50 |
1 files changed, 42 insertions, 8 deletions
diff --git a/source/blender/makesrna/intern/rna_key.c b/source/blender/makesrna/intern/rna_key.c index 04cba835ae2..641c9a596a8 100644 --- a/source/blender/makesrna/intern/rna_key.c +++ b/source/blender/makesrna/intern/rna_key.c @@ -32,6 +32,7 @@ #include "DNA_key_types.h" #include "DNA_lattice_types.h" #include "DNA_mesh_types.h" +#include "DNA_particle_types.h" #include "BLI_utildefines.h" @@ -47,9 +48,11 @@ #include <stddef.h> +#include "DNA_cache_library_types.h" #include "DNA_object_types.h" #include "BKE_animsys.h" +#include "BKE_cache_library.h" #include "BKE_depsgraph.h" #include "BKE_key.h" #include "BKE_main.h" @@ -302,7 +305,7 @@ static void rna_ShapeKey_data_begin(CollectionPropertyIterator *iter, PointerRNA Nurb *nu; int tot = kb->totelem, size = key->elemsize; - if (GS(key->from->name) == ID_CU) { + if (key->from && key->fromtype == KEY_OWNER_CURVE) { cu = (Curve *)key->from; nu = cu->nurb.first; @@ -323,7 +326,7 @@ static int rna_ShapeKey_data_length(PointerRNA *ptr) Nurb *nu; int tot = kb->totelem; - if (GS(key->from->name) == ID_CU) { + if (key->from && key->fromtype == KEY_OWNER_CURVE) { cu = (Curve *)key->from; nu = cu->nurb.first; @@ -341,7 +344,7 @@ static PointerRNA rna_ShapeKey_data_get(CollectionPropertyIterator *iter) Curve *cu; Nurb *nu; - if (GS(key->from->name) == ID_CU) { + if (key->from && key->fromtype == KEY_OWNER_CURVE) { cu = (Curve *)key->from; nu = cu->nurb.first; @@ -374,11 +377,37 @@ static void rna_Key_update_data(Main *bmain, Scene *UNUSED(scene), PointerRNA *p { Key *key = ptr->id.data; Object *ob; - - for (ob = bmain->object.first; ob; ob = ob->id.next) { - if (BKE_key_from_object(ob) == key) { - DAG_id_tag_update(&ob->id, OB_RECALC_DATA); - WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob); + CacheLibrary *cachelib; + + switch (key->fromtype) { + case KEY_OWNER_MESH: + case KEY_OWNER_CURVE: + case KEY_OWNER_LATTICE: + for (ob = bmain->object.first; ob; ob = ob->id.next) { + if (BKE_key_from_object(ob) == key) { + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_main_add_notifier(NC_OBJECT | ND_MODIFIER, ob); + } + } + break; + case KEY_OWNER_PARTICLES: + for (ob = bmain->object.first; ob; ob = ob->id.next) { + ParticleSystem *psys; + for (psys = ob->particlesystem.first; psys; psys = psys->next) { + if (psys->key == key) { + psys->recalc |= PSYS_RECALC_REDO; + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + WM_main_add_notifier(NC_OBJECT | ND_PARTICLE | NA_EDITED, ob); + } + } + } + break; + } + + 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); } } } @@ -600,6 +629,11 @@ static void rna_def_keyblock(BlenderRNA *brna) RNA_def_property_ui_text(prop, "Vertex Group", "Vertex weight group, to blend with basis shape"); RNA_def_property_update(prop, 0, "rna_Key_update_data"); + prop = RNA_def_property(srna, "face_map", PROP_STRING, PROP_NONE); + RNA_def_property_string_sdna(prop, NULL, "facemap"); + RNA_def_property_ui_text(prop, "Face Map", "Face Map used to initiate interpolation for this shapekey"); + RNA_def_property_update(prop, 0, "rna_Key_update_data"); + prop = RNA_def_property(srna, "relative_key", PROP_POINTER, PROP_NONE); RNA_def_property_struct_type(prop, "ShapeKey"); RNA_def_property_flag(prop, PROP_EDITABLE | PROP_NEVER_NULL); |