diff options
author | Joshua Leung <aligorith@gmail.com> | 2008-12-21 13:33:24 +0300 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2008-12-21 13:33:24 +0300 |
commit | 3eaca525f21fb59b8b7ff60681563154e4ca3eb8 (patch) | |
tree | e80a79b919390b2164ad2f5d5a620768df80a99a /source/blender/blenkernel | |
parent | c288eab363067e58406ab9c95b9450d93910501b (diff) |
2.5 - Object name display in 3d-view now highlights on frames with keyframes again.
* Re-exposed relevant parts of anim_keyframing.c code that doesn't have external dependencies.
* Added get_active_posechannel() to blenkernel api for poses/posechannels to solve the only missing link I found. This should have been moved there ages ago!
Diffstat (limited to 'source/blender/blenkernel')
-rw-r--r-- | source/blender/blenkernel/BKE_action.h | 6 | ||||
-rw-r--r-- | source/blender/blenkernel/intern/action.c | 18 |
2 files changed, 24 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_action.h b/source/blender/blenkernel/BKE_action.h index 37ced4cb00b..37b1332170a 100644 --- a/source/blender/blenkernel/BKE_action.h +++ b/source/blender/blenkernel/BKE_action.h @@ -92,6 +92,12 @@ void do_all_shape_actions(struct Object *); */ struct bPoseChannel *get_pose_channel(const struct bPose *pose, const char *name); + +/** + * Return a pointer to the active pose channel from this Object. + * (Note: Object, not bPose is used here, as we need layer info from Armature) + */ +struct bPoseChannel *get_active_posechannel(struct Object *ob); /** * Looks to see if the channel with the given name diff --git a/source/blender/blenkernel/intern/action.c b/source/blender/blenkernel/intern/action.c index 98f8a83f809..13ceced789b 100644 --- a/source/blender/blenkernel/intern/action.c +++ b/source/blender/blenkernel/intern/action.c @@ -278,6 +278,24 @@ bPoseChannel *verify_pose_channel(bPose* pose, const char* name) return chan; } +/* Find the active posechannel for an object (we can't just use pose, as layer info is in armature) */ +bPoseChannel *get_active_posechannel (Object *ob) +{ + bArmature *arm= (ob) ? ob->data : NULL; + bPoseChannel *pchan; + + if ELEM3(NULL, ob, ob->pose, arm) + return NULL; + + /* find active */ + for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) { + if ((pchan->bone) && (pchan->bone->flag & BONE_ACTIVE) && (pchan->bone->layer & arm->layer)) + return pchan; + } + + return NULL; +} + /* dst should be freed already, makes entire duplicate */ void copy_pose(bPose **dst, bPose *src, int copycon) |