diff options
author | Joshua Leung <aligorith@gmail.com> | 2011-03-13 15:22:57 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2011-03-13 15:22:57 +0300 |
commit | 2144b23f514005958e5ec962528599d6623bf15b (patch) | |
tree | edad887fa16628cf41d2ad425fb4db711305a27a /source/blender/blenkernel | |
parent | 4cfa5d55e60b4b51e64da347d51991a8713e26b6 (diff) |
Pose Sliding Tools - Custom Property Support + Other bugfixes
- Custom properties are now affected by the Pose Sliding tools too.
This is now more important to support, given that modern rigs use
these a lot for facial expressions/posing. By and large, this should
work fine, though discrete integer values may experience a bit of
trouble
- Fixed potential bugs with the code which detects which F-Curves are
relevant to a PoseBone's transforms (+ custom props). This was prone
to being tricked by certain setups if the names of the bones contained
some of the keywords these were searching for.
- Shuffled some code around: moved bulk of logic out of vec3 case into
new function for single-value, since it was really doing per axis
already
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_action.h | 8 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 29 |
2 files changed, 30 insertions, 7 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 59da97d8b09..698f0f0fecf 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -82,9 +82,15 @@ typedef enum eAction_TransformFlags { ACT_TRANS_ROT = (1<<1), /* scaling */ ACT_TRANS_SCALE = (1<<2), + + /* strictly not a transform, but custom properties are also + * quite often used in modern rigs + */ + ACT_TRANS_PROP = (1<<3), /* all flags */ - ACT_TRANS_ALL = (ACT_TRANS_LOC|ACT_TRANS_ROT|ACT_TRANS_SCALE), + ACT_TRANS_ONLY = (ACT_TRANS_LOC|ACT_TRANS_ROT|ACT_TRANS_SCALE), + ACT_TRANS_ALL = (ACT_TRANS_ONLY|ACT_TRANS_PROP) } eAction_TransformFlags; /* Return flags indicating which transforms the given object/posechannel has diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 1c0091cff74..4c5b7f5fcaf 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -973,6 +973,11 @@ short action_get_item_transforms (bAction *act, Object *ob, bPoseChannel *pchan, bPtr= strstr(fcu->rna_path, basePath); if (bPtr) { + /* we must add len(basePath) bytes to the match so that we are at the end of the + * base path so that we don't get false positives with these strings in the names + */ + bPtr += strlen(basePath); + /* step 2: check for some property with transforms * - to speed things up, only check for the ones not yet found * unless we're getting the curves too @@ -981,8 +986,8 @@ short action_get_item_transforms (bAction *act, Object *ob, bPoseChannel *pchan, * - once a match has been found, the curve cannot possibly be any other one */ if ((curves) || (flags & ACT_TRANS_LOC) == 0) { - pPtr= strstr(fcu->rna_path, "location"); - if ((pPtr) && (pPtr >= bPtr)) { + pPtr= strstr(bPtr, "location"); + if (pPtr) { flags |= ACT_TRANS_LOC; if (curves) @@ -992,8 +997,8 @@ short action_get_item_transforms (bAction *act, Object *ob, bPoseChannel *pchan, } if ((curves) || (flags & ACT_TRANS_SCALE) == 0) { - pPtr= strstr(fcu->rna_path, "scale"); - if ((pPtr) && (pPtr >= bPtr)) { + pPtr= strstr(bPtr, "scale"); + if (pPtr) { flags |= ACT_TRANS_SCALE; if (curves) @@ -1003,8 +1008,8 @@ short action_get_item_transforms (bAction *act, Object *ob, bPoseChannel *pchan, } if ((curves) || (flags & ACT_TRANS_ROT) == 0) { - pPtr= strstr(fcu->rna_path, "rotation"); - if ((pPtr) && (pPtr >= bPtr)) { + pPtr= strstr(bPtr, "rotation"); + if (pPtr) { flags |= ACT_TRANS_ROT; if (curves) @@ -1012,6 +1017,18 @@ short action_get_item_transforms (bAction *act, Object *ob, bPoseChannel *pchan, continue; } } + + if ((curves) || (flags & ACT_TRANS_PROP) == 0) { + /* custom properties only */ + pPtr= strstr(bPtr, "[\""); /* extra '"' comment here to keep my texteditor functionlist working :) */ + if (pPtr) { + flags |= ACT_TRANS_PROP; + + if (curves) + BLI_addtail(curves, BLI_genericNodeN(fcu)); + continue; + } + } } } |