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:
authorJoshua Leung <aligorith@gmail.com>2010-03-23 14:59:34 +0300
committerJoshua Leung <aligorith@gmail.com>2010-03-23 14:59:34 +0300
commit4ae515a4e53096df7b0ee27ca57cd148ccbdccd9 (patch)
treed889e910fddcedfc054b2731e25f996087a52176 /source/blender/editors/animation/keyingsets.c
parentd2225edfce87ecb92d19b56859146a0738027c7e (diff)
Keying Sets: BuiltIn vs Absolute Tweaks
This commit clarifies the somewhat "murky" separation between "builtin" and "absolute" KeyingSets as a result of discussions with Cessen. * "Builtin" Keying Sets are now just the Keying Sets which in the past have been known as PyKeyingSets or Relative KeyingSets. These are registered from Py Scripts at startup, and will use the context info to determine what data they should be keyframing. These are stored per Blender session, independent of files, since usually these will be coded specific to sets of rigs used at a studio. * "Absolute" Keying Sets are the ones that you can create from the Scene buttons and/or KKEY or RMB over any property. They specify the exact set of properties which should always get keyframed together. These are stored in the scene. In relation to this, I've made it possible to now set one of the builtin Keying Set types as the active Keying Set. * For now, this can only be done via the box beside the insert/delete key operator buttons on the TimeLine header (now complete with an recycled icon - HINT TO ICON DESIGNERS, to make this a bit more obvious). Later on I'll commit an operator to set this via a hotkey. * The "IKEY" menu will only show up when there is no active Keying Set. When there is one, keying will happen silently (with info notice at the top of the screen). Later on, I'll hook this menu up to a hotkey, so that that active Keying Set can be changed without inserting keyframes or clearing active Keying Set... * By default, there isn't any default Keying Set enabled. IMO, this is probably a good default, though some might like to have LocRotScale instead. * I'm not terribly impressed with the search menu for the items being SORTED (and of all things, alphabetically!) currently, since this does break muscle-memory with the menu (and jumbles up order of closely related vs not closely related). * The Scene buttons for KeyingSets still need some changes to fully cope with users setting builtin KeyingSets as active sometimes. Controls which are useless or shouldn't be used when a builtin set is shown are being shown. Builtin set registrations have been tweaked a bit: * Renamed "bl_idname" to "bl_label" for consistency with rest of API. Note that this is the identifier used by Blender internally when searching for the KeyingSet, and is also what the user sees.
Diffstat (limited to 'source/blender/editors/animation/keyingsets.c')
-rw-r--r--source/blender/editors/animation/keyingsets.c60
1 files changed, 40 insertions, 20 deletions
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index a93220aeb67..db9f5b4b97d 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -521,20 +521,12 @@ KeyingSet *ANIM_builtin_keyingset_get_named (KeyingSet *prevKS, const char name[
/* Add the given KeyingSetInfo to the list of type infos, and create an appropriate builtin set too */
void ANIM_keyingset_info_register (const bContext *C, KeyingSetInfo *ksi)
{
- Scene *scene = CTX_data_scene(C);
- ListBase *list = NULL;
KeyingSet *ks;
- /* determine the KeyingSet list to include the new KeyingSet in */
- if (ksi->builtin==0 && scene)
- list = &scene->keyingsets;
- else
- list = &builtin_keyingsets;
-
/* create a new KeyingSet
* - inherit name and keyframing settings from the typeinfo
*/
- ks = BKE_keyingset_add(list, ksi->name, ksi->builtin, ksi->keyingflag);
+ ks = BKE_keyingset_add(&builtin_keyingsets, ksi->name, 1, ksi->keyingflag);
/* link this KeyingSet with its typeinfo */
memcpy(&ks->typeinfo, ksi->name, sizeof(ks->typeinfo));
@@ -549,8 +541,10 @@ void ANIM_keyingset_info_unregister (const bContext *C, KeyingSetInfo *ksi)
Scene *scene = CTX_data_scene(C);
KeyingSet *ks, *ksn;
- /* find relevant scene KeyingSets which use this, and remove them */
- for (ks= scene->keyingsets.first; ks; ks= ksn) {
+ /* find relevant builtin KeyingSets which use this, and remove them */
+ // TODO: this isn't done now, since unregister is really only used atm when we
+ // reload the scripts, which kindof defeats the purpose of "builtin"?
+ for (ks= builtin_keyingsets.first; ks; ks= ksn) {
ksn = ks->next;
/* remove if matching typeinfo name */
@@ -560,11 +554,6 @@ void ANIM_keyingset_info_unregister (const bContext *C, KeyingSetInfo *ksi)
}
}
- /* do the same with builtin sets? */
- // TODO: this isn't done now, since unregister is really only used atm when we
- // reload the scripts, which kindof defeats the purpose of "builtin"?
-
-
/* free the type info */
BLI_freelinkN(&keyingset_type_infos, ksi);
}
@@ -595,18 +584,49 @@ void ANIM_keyingset_infos_exit ()
/* Get the active Keying Set for the Scene provided */
KeyingSet *ANIM_scene_get_active_keyingset (Scene *scene)
{
- if (ELEM(NULL, scene, scene->keyingsets.first))
+ /* if no scene, we've got no hope of finding the Keying Set */
+ if (scene == NULL)
return NULL;
/* currently, there are several possibilities here:
* - 0: no active keying set
* - > 0: one of the user-defined Keying Sets, but indices start from 0 (hence the -1)
- * - < 0: a builtin keying set (XXX this isn't enabled yet so that we don't get errors on reading back files)
+ * - < 0: a builtin keying set
*/
if (scene->active_keyingset > 0)
return BLI_findlink(&scene->keyingsets, scene->active_keyingset-1);
- else // for now...
- return NULL;
+ else
+ return BLI_findlink(&builtin_keyingsets, (-scene->active_keyingset)-1);
+}
+
+/* Get the index of the Keying Set provided, for the given Scene */
+int ANIM_scene_get_keyingset_index (Scene *scene, KeyingSet *ks)
+{
+ int index;
+
+ /* if no KeyingSet provided, have none */
+ if (ks == NULL)
+ return 0;
+
+ /* check if the KeyingSet exists in scene list */
+ if (scene) {
+ /* get index and if valid, return
+ * - (absolute) Scene KeyingSets are from (>= 1)
+ */
+ index = BLI_findindex(&scene->keyingsets, ks);
+ if (index != -1)
+ return (index + 1);
+ }
+
+ /* still here, so try builtins list too
+ * - builtins are from (<= -1)
+ * - none/invalid is (= 0)
+ */
+ index = BLI_findindex(&builtin_keyingsets, ks);
+ if (index != -1)
+ return -(index + 1);
+ else
+ return 0;
}
/* Check if KeyingSet can be used in the current context */