diff options
Diffstat (limited to 'source/blender/editors/animation/keyingsets.c')
-rw-r--r-- | source/blender/editors/animation/keyingsets.c | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c index 1c06266a148..ab236de9ac5 100644 --- a/source/blender/editors/animation/keyingsets.c +++ b/source/blender/editors/animation/keyingsets.c @@ -40,20 +40,14 @@ #include "BLI_dynstr.h" #include "DNA_anim_types.h" -#include "DNA_constraint_types.h" #include "DNA_scene_types.h" +#include "DNA_object_types.h" +#include "BKE_main.h" #include "BKE_animsys.h" -#include "BKE_action.h" #include "BKE_context.h" -#include "BKE_constraint.h" #include "BKE_depsgraph.h" -#include "BKE_fcurve.h" -#include "BKE_utildefines.h" -#include "BKE_context.h" #include "BKE_report.h" -#include "BKE_key.h" -#include "BKE_material.h" #include "ED_keyframing.h" #include "ED_screen.h" @@ -288,6 +282,7 @@ void ANIM_OT_keying_set_path_remove (wmOperatorType *ot) static int add_keyingset_button_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks = NULL; PropertyRNA *prop= NULL; @@ -358,7 +353,7 @@ static int add_keyingset_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL); @@ -388,6 +383,7 @@ void ANIM_OT_keyingset_button_add (wmOperatorType *ot) static int remove_keyingset_button_exec (bContext *C, wmOperator *op) { + Main *bmain= CTX_data_main(C); Scene *scene= CTX_data_scene(C); KeyingSet *ks = NULL; PropertyRNA *prop= NULL; @@ -440,7 +436,7 @@ static int remove_keyingset_button_exec (bContext *C, wmOperator *op) if (success) { /* send updates */ - DAG_ids_flush_update(0); + DAG_ids_flush_update(bmain, 0); /* for now, only send ND_KEYS for KeyingSets */ WM_event_add_notifier(C, NC_SCENE|ND_KEYINGSET, NULL); @@ -526,20 +522,12 @@ ListBase builtin_keyingsets = {NULL, NULL}; /* Find KeyingSet type info given a name */ KeyingSetInfo *ANIM_keyingset_info_find_named (const char name[]) { - KeyingSetInfo *ksi; - /* sanity checks */ if ((name == NULL) || (name[0] == 0)) return NULL; /* search by comparing names */ - for (ksi = keyingset_type_infos.first; ksi; ksi = ksi->next) { - if (strcmp(ksi->idname, name) == 0) - return ksi; - } - - /* no matches found */ - return NULL; + return BLI_findstring(&keyingset_type_infos, name, offsetof(KeyingSetInfo, idname)); } /* Find builtin KeyingSet by name */ @@ -589,7 +577,7 @@ void ANIM_keyingset_info_register (const bContext *C, KeyingSetInfo *ksi) /* Remove the given KeyingSetInfo from the list of type infos, and also remove the builtin set if appropriate */ void ANIM_keyingset_info_unregister (const bContext *C, KeyingSetInfo *ksi) { - Scene *scene = CTX_data_scene(C); + Main *bmain= CTX_data_main(C); KeyingSet *ks, *ksn; /* find relevant builtin KeyingSets which use this, and remove them */ @@ -600,8 +588,14 @@ void ANIM_keyingset_info_unregister (const bContext *C, KeyingSetInfo *ksi) /* remove if matching typeinfo name */ if (strcmp(ks->typeinfo, ksi->idname) == 0) { + Scene *scene; BKE_keyingset_free(ks); - BLI_freelinkN(&scene->keyingsets, ks); + BLI_remlink(&builtin_keyingsets, ks); + + for(scene= bmain->scene.first; scene; scene= scene->id.next) + BLI_remlink_safe(&scene->keyingsets, ks); + + MEM_freeN(ks); } } |