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>2011-08-15 14:37:26 +0400
committerJoshua Leung <aligorith@gmail.com>2011-08-15 14:37:26 +0400
commit674d1b8d68330113967fd0bb6b34edaf9c619cae (patch)
treedc32f16eb7244ec12fe22de21ccdf09db32a3dc1 /source/blender/editors/animation/keyingsets.c
parentc8ae881b619ec2d2d05b3c55283ca1f4c69828ca (diff)
Select by Keying Set...
* Split off code to refresh relative/builtin KeyingSets for the current context before they get used to a separate function. * Hooked this up to a new PyAPI/RNA function: KeyingSet.refresh(). Call this before checking the paths that a Keying Set has, especially if it is not "absolute" * Added option for "Select Grouped" operator (for Objects), which will select all objects affected by the active Keying Set. This is probably more useful for absolute KeyingSets, where changing the selection is less likely to affect the result. - The equivalent for bones is currently still in development, but is likely to be more useful for animators, where rigs are the primary animation entities they deal with
Diffstat (limited to 'source/blender/editors/animation/keyingsets.c')
-rw-r--r--source/blender/editors/animation/keyingsets.c69
1 files changed, 47 insertions, 22 deletions
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 69abd1cb5a4..dcd1c3abbde 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -875,33 +875,19 @@ void ANIM_relative_keyingset_add_source (ListBase *dsources, ID *id, StructRNA *
/* KeyingSet Operations (Insert/Delete Keyframes) ------------ */
-/* Given a KeyingSet and context info (if required), modify keyframes for the channels specified
- * by the KeyingSet. This takes into account many of the different combinations of using KeyingSets.
- * Returns the number of channels that keyframes were added to
+/* Given a KeyingSet and context info, validate Keying Set's paths.
+ * This is only really necessary with relative/built-in KeyingSets
+ * where their list of paths is dynamically generated based on the
+ * current context info.
+ *
+ * Returns 0 if succeeded, otherwise an error code: eModifyKey_Returns
*/
-int ANIM_apply_keyingset (bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
+short ANIM_validate_keyingset (bContext *C, ListBase *dsources, KeyingSet *ks)
{
- Scene *scene= CTX_data_scene(C);
- ReportList *reports = CTX_wm_reports(C);
- KS_Path *ksp;
- int kflag=0, success= 0;
- char *groupname= NULL;
-
- /* sanity checks */
+ /* sanity check */
if (ks == NULL)
return 0;
- /* get flags to use */
- if (mode == MODIFYKEY_MODE_INSERT) {
- /* use KeyingSet's flags as base */
- kflag= ks->keyingflag;
-
- /* suppliment with info from the context */
- kflag |= ANIM_get_keyframing_flags(scene, 1);
- }
- else if (mode == MODIFYKEY_MODE_DELETE)
- kflag= 0;
-
/* if relative Keying Sets, poll and build up the paths */
if ((ks->flag & KEYINGSET_ABSOLUTE) == 0) {
KeyingSetInfo *ksi = ANIM_keyingset_info_find_named(ks->typeinfo);
@@ -936,6 +922,45 @@ int ANIM_apply_keyingset (bContext *C, ListBase *dsources, bAction *act, KeyingS
}
}
+ /* succeeded; return 0 to tag error free */
+ return 0;
+}
+
+/* Given a KeyingSet and context info (if required), modify keyframes for the channels specified
+ * by the KeyingSet. This takes into account many of the different combinations of using KeyingSets.
+ * Returns the number of channels that keyframes were added to
+ */
+int ANIM_apply_keyingset (bContext *C, ListBase *dsources, bAction *act, KeyingSet *ks, short mode, float cfra)
+{
+ Scene *scene= CTX_data_scene(C);
+ ReportList *reports = CTX_wm_reports(C);
+ KS_Path *ksp;
+ int kflag=0, success= 0;
+ char *groupname= NULL;
+
+ /* sanity checks */
+ if (ks == NULL)
+ return 0;
+
+ /* get flags to use */
+ if (mode == MODIFYKEY_MODE_INSERT) {
+ /* use KeyingSet's flags as base */
+ kflag= ks->keyingflag;
+
+ /* suppliment with info from the context */
+ kflag |= ANIM_get_keyframing_flags(scene, 1);
+ }
+ else if (mode == MODIFYKEY_MODE_DELETE)
+ kflag= 0;
+
+ /* if relative Keying Sets, poll and build up the paths */
+ success = ANIM_validate_keyingset(C, dsources, ks);
+
+ if (success != 0) {
+ /* return error code if failed */
+ return success;
+ }
+
/* apply the paths as specified in the KeyingSet now */
for (ksp= ks->paths.first; ksp; ksp= ksp->next) {
int arraylen, i;