2.5 - Bones with "Euler" rotations can now have their rotation keyframed properly using built-in keyingsets (i.e. the IKEY menu in 3D-View)

This commit is contained in:
Joshua Leung 2009-08-02 23:31:18 +00:00
parent 262a76812e
commit 9a8b01218f
2 changed files with 22 additions and 6 deletions

@ -735,7 +735,7 @@ static bBuiltinKeyingSet def_builtin_keyingsets_v3d[] =
/* Keying Set - "Rotation" ---------- */ /* Keying Set - "Rotation" ---------- */
BI_KS_DEFINE_BEGIN("Rotation", 0) BI_KS_DEFINE_BEGIN("Rotation", 0)
BI_KS_PATHS_BEGIN(1) BI_KS_PATHS_BEGIN(1)
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|KSP_TEMPLATE_PCHAN_ROT, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END BI_KS_PATHS_END
BI_KS_DEFINE_END, BI_KS_DEFINE_END,
@ -751,7 +751,7 @@ static bBuiltinKeyingSet def_builtin_keyingsets_v3d[] =
BI_KS_DEFINE_BEGIN("LocRot", 0) BI_KS_DEFINE_BEGIN("LocRot", 0)
BI_KS_PATHS_BEGIN(2) BI_KS_PATHS_BEGIN(2)
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, "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|KSP_TEMPLATE_PCHAN_ROT, "rotation", 0, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END BI_KS_PATHS_END
BI_KS_DEFINE_END, BI_KS_DEFINE_END,
@ -759,7 +759,7 @@ static bBuiltinKeyingSet def_builtin_keyingsets_v3d[] =
BI_KS_DEFINE_BEGIN("LocRotScale", 0) BI_KS_DEFINE_BEGIN("LocRotScale", 0)
BI_KS_PATHS_BEGIN(3) 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, "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|KSP_TEMPLATE_PCHAN_ROT, "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_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_PATHS_END
BI_KS_DEFINE_END, BI_KS_DEFINE_END,
@ -775,7 +775,7 @@ static bBuiltinKeyingSet def_builtin_keyingsets_v3d[] =
/* Keying Set - "Rotation" ---------- */ /* Keying Set - "Rotation" ---------- */
BI_KS_DEFINE_BEGIN("VisualRot", 0) BI_KS_DEFINE_BEGIN("VisualRot", 0)
BI_KS_PATHS_BEGIN(1) 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_TEMPLATE_ITEM) BI_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN|KSP_TEMPLATE_PCHAN_ROT, "rotation", INSERTKEY_MATRIX, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END BI_KS_PATHS_END
BI_KS_DEFINE_END, BI_KS_DEFINE_END,
@ -783,7 +783,7 @@ static bBuiltinKeyingSet def_builtin_keyingsets_v3d[] =
BI_KS_DEFINE_BEGIN("VisualLocRot", 0) BI_KS_DEFINE_BEGIN("VisualLocRot", 0)
BI_KS_PATHS_BEGIN(2) 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_TEMPLATE_ITEM), 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_KSP_DEFINE(ID_OB, KSP_TEMPLATE_OBJECT|KSP_TEMPLATE_PCHAN|KSP_TEMPLATE_PCHAN_ROT, "rotation", INSERTKEY_MATRIX, KSP_FLAG_WHOLE_ARRAY, KSP_GROUP_TEMPLATE_ITEM)
BI_KS_PATHS_END BI_KS_PATHS_END
BI_KS_DEFINE_END BI_KS_DEFINE_END
}; };
@ -1131,7 +1131,21 @@ int modify_keyframes (bContext *C, ListBase *dsources, bAction *act, KeyingSet *
/* add property stored in KeyingSet Path */ /* add property stored in KeyingSet Path */
if (BLI_dynstr_get_len(pathds)) if (BLI_dynstr_get_len(pathds))
BLI_dynstr_append(pathds, "."); BLI_dynstr_append(pathds, ".");
BLI_dynstr_append(pathds, ksp->rna_path);
/* apply some further templates? */
if ((ksp->templates & KSP_TEMPLATE_PCHAN_ROT) && (cks->pchan)) {
/* if this path is exactly "rotation", and the rotation mode is set to eulers,
* use "euler_rotation" instead so that rotations will be keyed correctly
*/
if (strcmp(ksp->rna_path, "rotation")==0 && (cks->pchan->rotmode))
BLI_dynstr_append(pathds, "euler_rotation");
else
BLI_dynstr_append(pathds, ksp->rna_path);
}
else {
/* just directly use the path */
BLI_dynstr_append(pathds, ksp->rna_path);
}
/* convert to C-string */ /* convert to C-string */
path= BLI_dynstr_get_cstring(pathds); path= BLI_dynstr_get_cstring(pathds);

@ -631,6 +631,8 @@ typedef enum eKSP_TemplateTypes {
KSP_TEMPLATE_PCHAN = (1<<1), /* #pch - selected posechannel */ KSP_TEMPLATE_PCHAN = (1<<1), /* #pch - selected posechannel */
KSP_TEMPLATE_CONSTRAINT = (1<<2), /* #con - active only */ KSP_TEMPLATE_CONSTRAINT = (1<<2), /* #con - active only */
KSP_TEMPLATE_NODE = (1<<3), /* #nod - selected node */ KSP_TEMPLATE_NODE = (1<<3), /* #nod - selected node */
KSP_TEMPLATE_PCHAN_ROT = (1<<16), /* modify rotation paths based on rotation mode of Pose Channel */
} eKSP_TemplateTypes; } eKSP_TemplateTypes;
/* ---------------- */ /* ---------------- */