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
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2009-04-16 04:33:40 +0400
committerJoshua Leung <aligorith@gmail.com>2009-04-16 04:33:40 +0400
commitf2e40f7234b4f076114d03c7f9c61aced135c742 (patch)
treecede008802834ac05e3c510d6d4374ec02b48184 /source
parentec11cf9524f8ee0ba1087ee42f17278653f1300a (diff)
2.5 PoseLib/KeyingSets bugfixes:
* Replaced a quicky hack needed to get PoseLib working with a proper new group-naming option for KeyingSets. Now, all builtin KeyingSets will use the name of the data (i.e. Object or PoseChannel) as the name of the group new channels are added to * Fixed a bug with LocRotScale builtin KeyingSet, which meant that scale keyframes were not getting added. * TAB key (toggle original pose) now works again. Previously, events were flying past too quickly.
Diffstat (limited to 'source')
-rw-r--r--source/blender/editors/animation/keyingsets.c44
-rw-r--r--source/blender/editors/armature/poselib.c53
-rw-r--r--source/blender/makesdna/DNA_anim_types.h13
-rw-r--r--source/blender/makesrna/intern/rna_animation.c1
4 files changed, 64 insertions, 47 deletions
diff --git a/source/blender/editors/animation/keyingsets.c b/source/blender/editors/animation/keyingsets.c
index 973d953cd4b..02b7980f0c4 100644
--- a/source/blender/editors/animation/keyingsets.c
+++ b/source/blender/editors/animation/keyingsets.c
@@ -703,21 +703,21 @@ static bBuiltinKeyingSet def_builtin_keyingsets_v3d[] =
/* Keying Set - "Location" ---------- */
BI_KS_DEFINE_BEGIN("Location", 0)
BI_KS_PATHS_BEGIN(1)
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME)
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END
BI_KS_DEFINE_END,
/* Keying Set - "Rotation" ---------- */
BI_KS_DEFINE_BEGIN("Rotation", 0)
BI_KS_PATHS_BEGIN(1)
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME)
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END
BI_KS_DEFINE_END,
/* Keying Set - "Scaling" ---------- */
BI_KS_DEFINE_BEGIN("Scaling", 0)
BI_KS_PATHS_BEGIN(1)
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "scale", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME)
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "scale", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END
BI_KS_DEFINE_END,
@@ -725,17 +725,17 @@ static bBuiltinKeyingSet def_builtin_keyingsets_v3d[] =
/* Keying Set - "LocRot" ---------- */
BI_KS_DEFINE_BEGIN("LocRot", 0)
BI_KS_PATHS_BEGIN(2)
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME),
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME)
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM),
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END
BI_KS_DEFINE_END,
/* Keying Set - "LocRotScale" ---------- */
BI_KS_DEFINE_BEGIN("LocRotScale", 0)
- BI_KS_PATHS_BEGIN(2)
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME),
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME),
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "scale", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME)
+ BI_KS_PATHS_BEGIN(3)
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM),
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM),
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "scale", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END
BI_KS_DEFINE_END,
@@ -743,22 +743,22 @@ static bBuiltinKeyingSet def_builtin_keyingsets_v3d[] =
/* Keying Set - "VisualLoc" ---------- */
BI_KS_DEFINE_BEGIN("VisualLoc", 0)
BI_KS_PATHS_BEGIN(1)
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", INSERTKEY_MATRIX, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME)
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", INSERTKEY_MATRIX, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END
BI_KS_DEFINE_END,
/* Keying Set - "Rotation" ---------- */
BI_KS_DEFINE_BEGIN("VisualRot", 0)
BI_KS_PATHS_BEGIN(1)
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "rotation", INSERTKEY_MATRIX, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME)
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "rotation", INSERTKEY_MATRIX, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END
BI_KS_DEFINE_END,
/* Keying Set - "VisualLocRot" ---------- */
BI_KS_DEFINE_BEGIN("VisualLocRot", 0)
BI_KS_PATHS_BEGIN(2)
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", INSERTKEY_MATRIX, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME),
- BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "rotation", INSERTKEY_MATRIX, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_KSNAME)
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "location", INSERTKEY_MATRIX, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM),
+ BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN, "rotation", INSERTKEY_MATRIX, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END
BI_KS_DEFINE_END
};
@@ -1110,17 +1110,15 @@ int modify_keyframes (bContext *C, ListBase *dsources, bAction *act, KeyingSet *
BLI_dynstr_free(pathds);
}
- /* if the group name settings have not been overriden for the entire KeyingSet,
- * get pointer to name of group to add channels to
+ /* get pointer to name of group to add channels to
+ * - KSP_GROUP_TEMPLATE_ITEM is handled above while constructing the paths
*/
- if ((ks->flag & KEYINGSET_GROUPNAMES_OVERRIDE)==0) {
- if (ksp->groupmode == KSP_GROUP_NONE)
- groupname= NULL;
- else if (ksp->groupmode == KSP_GROUP_KSNAME)
- groupname= ks->name;
- else
- groupname= ksp->group;
- }
+ if (ksp->groupmode == KSP_GROUP_NONE)
+ groupname= NULL;
+ else if (ksp->groupmode == KSP_GROUP_KSNAME)
+ groupname= ks->name;
+ else if (ksp->groupmode == KSP_GROUP_NAMED)
+ groupname= ksp->group;
/* init arraylen and i - arraylen should be greater than i so that
* normal non-array entries get keyframed correctly
diff --git a/source/blender/editors/armature/poselib.c b/source/blender/editors/armature/poselib.c
index 50588a2a258..0b5a89e823f 100644
--- a/source/blender/editors/armature/poselib.c
+++ b/source/blender/editors/armature/poselib.c
@@ -393,10 +393,6 @@ static int poselib_add_exec (bContext *C, wmOperator *op)
/* make sure we've got KeyingSets to use */
poselib_get_builtin_keyingsets();
- /* turn on group-name overrides temporarily (only here) */
- poselib_ks_locrotscale->flag |= KEYINGSET_GROUPNAMES_OVERRIDE;
- poselib_ks_locrotscale2->flag |= KEYINGSET_GROUPNAMES_OVERRIDE;
-
/* init common-key-source for use by KeyingSets */
memset(&cks, 0, sizeof(bCommonKeySrc));
cks.id= &ob->id;
@@ -418,10 +414,6 @@ static int poselib_add_exec (bContext *C, wmOperator *op)
}
}
- /* turn off group-name overrides so they don't affect the KeyingSets when used elsewhere */
- poselib_ks_locrotscale->flag &= ~KEYINGSET_GROUPNAMES_OVERRIDE;
- poselib_ks_locrotscale2->flag &= ~KEYINGSET_GROUPNAMES_OVERRIDE;
-
/* store new 'active' pose number */
act->active_marker= BLI_countlist(&act->markers);
@@ -662,13 +654,13 @@ typedef struct tPoseLib_Backup {
/* Makes a copy of the current pose for restoration purposes - doesn't do constraints currently */
static void poselib_backup_posecopy (tPoseLib_PreviewData *pld)
{
- bActionChannel *achan;
+ bActionGroup *agrp;
bPoseChannel *pchan;
/* for each posechannel that has an actionchannel in */
- for (achan= pld->act->chanbase.first; achan; achan= achan->next) {
+ for (agrp= pld->act->groups.first; agrp; agrp= agrp->next) {
/* try to find posechannel */
- pchan= get_pose_channel(pld->pose, achan->name);
+ pchan= get_pose_channel(pld->pose, agrp->name);
/* backup data if available */
if (pchan) {
@@ -1085,8 +1077,11 @@ static int poselib_preview_handle_event (bContext *C, wmOperator *op, wmEvent *e
/* quicky compare to original */
case TABKEY:
- pld->flag &= ~PL_PREVIEW_SHOWORIGINAL;
- pld->redraw= PL_PREVIEW_REDRAWALL;
+ /* only respond to one event */
+ if (event->val == 0) {
+ pld->flag &= ~PL_PREVIEW_SHOWORIGINAL;
+ pld->redraw= PL_PREVIEW_REDRAWALL;
+ }
break;
}
@@ -1113,8 +1108,11 @@ static int poselib_preview_handle_event (bContext *C, wmOperator *op, wmEvent *e
/* toggle between original pose and poselib pose*/
case TABKEY:
- pld->flag |= PL_PREVIEW_SHOWORIGINAL;
- pld->redraw= PL_PREVIEW_REDRAWALL;
+ /* only respond to one event */
+ if (event->val == 0) {
+ pld->flag |= PL_PREVIEW_SHOWORIGINAL;
+ pld->redraw= PL_PREVIEW_REDRAWALL;
+ }
break;
/* change to previous pose (cyclic) */
@@ -1349,7 +1347,6 @@ static void poselib_preview_cleanup (bContext *C, wmOperator *op)
/* updates */
if (IS_AUTOKEY_MODE(scene, NORMAL)) {
//remake_action_ipos(ob->action);
-
}
else {
/* need to trick depgraph, action is not allowed to execute on pose */
@@ -1440,6 +1437,28 @@ static int poselib_preview_invoke(bContext *C, wmOperator *op, wmEvent *event)
return OPERATOR_RUNNING_MODAL;
}
+/* Repeat operator */
+static int poselib_preview_exec (bContext *C, wmOperator *op)
+{
+ tPoseLib_PreviewData *pld;
+
+ /* check if everything is ok, and init settings for modal operator */
+ poselib_preview_init_data(C, op);
+ pld= (tPoseLib_PreviewData *)op->customdata;
+
+ if (pld->state == PL_PREVIEW_ERROR) {
+ /* an error occurred, so free temp mem used */
+ poselib_preview_cleanup(C, op);
+ return OPERATOR_CANCELLED;
+ }
+
+ /* apply the active pose */
+ poselib_preview_apply(C, op);
+
+ /* cleanup */
+ return poselib_preview_exit(C, op);
+}
+
void POSELIB_OT_browse_interactive (wmOperatorType *ot)
{
/* identifiers */
@@ -1451,7 +1470,7 @@ void POSELIB_OT_browse_interactive (wmOperatorType *ot)
ot->invoke= poselib_preview_invoke;
ot->modal= poselib_preview_modal;
ot->cancel= poselib_preview_cancel;
- //ot->exec= poselib_preview_exec;
+ ot->exec= poselib_preview_exec;
ot->poll= ED_operator_posemode;
/* flags */
diff --git a/source/blender/makesdna/DNA_anim_types.h b/source/blender/makesdna/DNA_anim_types.h
index af67b31554c..0c04d046fda 100644
--- a/source/blender/makesdna/DNA_anim_types.h
+++ b/source/blender/makesdna/DNA_anim_types.h
@@ -510,12 +510,16 @@ enum {
/* KS_Path->groupmode */
enum {
- /* path should be grouped using its own group-name */
+ /* path should be grouped using group name stored in path */
KSP_GROUP_NAMED = 0,
/* path should not be grouped at all */
KSP_GROUP_NONE,
- /* path should be grouped under an ActionGroup KeyingSet's name */
+ /* path should be grouped using KeyingSet's name */
KSP_GROUP_KSNAME,
+ /* path should be grouped using name of inner-most context item from templates
+ * - this is most useful for relative KeyingSets only
+ */
+ KSP_GROUP_TEMPLATE_ITEM,
} eKSP_Grouping;
/* KS_Path->templates (Template Flags)
@@ -561,11 +565,6 @@ enum {
KEYINGSET_BUILTIN = (1<<0),
/* keyingset does not depend on context info (i.e. paths are absolute) */
KEYINGSET_ABSOLUTE = (1<<1),
-
- /* override group name settings of paths in this Keying Set with context
- * info (internally used for relative paths only)
- */
- KEYINGSET_GROUPNAMES_OVERRIDE = (1<<2),
} eKS_Settings;
/* Flags for use by keyframe creation/deletion calls */
diff --git a/source/blender/makesrna/intern/rna_animation.c b/source/blender/makesrna/intern/rna_animation.c
index 1559144e9e5..702dc9fa65d 100644
--- a/source/blender/makesrna/intern/rna_animation.c
+++ b/source/blender/makesrna/intern/rna_animation.c
@@ -82,6 +82,7 @@ void rna_def_keyingset_path(BlenderRNA *brna)
{KSP_GROUP_NAMED, "NAMED", "Named Group", ""},
{KSP_GROUP_NONE, "NONE", "None", ""},
{KSP_GROUP_KSNAME, "KEYINGSET", "Keying Set Name", ""},
+ {KSP_GROUP_TEMPLATE_ITEM, "TEMPLATE", "Innermost Context-Item Name", ""},
{0, NULL, NULL, NULL}};
srna= RNA_def_struct(brna, "KeyingSetPath", NULL);