diff options
author | Joshua Leung <aligorith@gmail.com> | 2013-10-17 18:19:03 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2013-10-17 18:19:03 +0400 |
commit | 1263a0891cc0d7d2602fa2668cc7ffa271624046 (patch) | |
tree | 63fa81fef1bfe54eca085e6f090adcf1c6a97d2f /source/blender/editors/armature/pose_select.c | |
parent | eb1b4c3b55e212dbcb7fb2390c90adf204f42959 (diff) |
Project Pampa Request: Selecting groups in animation editors selects
corresponding bones
Diffstat (limited to 'source/blender/editors/armature/pose_select.c')
-rw-r--r-- | source/blender/editors/armature/pose_select.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/source/blender/editors/armature/pose_select.c b/source/blender/editors/armature/pose_select.c index 9449b5a49bf..bbdf94e56cf 100644 --- a/source/blender/editors/armature/pose_select.c +++ b/source/blender/editors/armature/pose_select.c @@ -64,6 +64,36 @@ /* ***************** Pose Select Utilities ********************* */ +/* Utility method for changing the selection status of a bone */ +void ED_pose_bone_select(Object *ob, bPoseChannel *pchan, bool select) +{ + bArmature *arm; + + /* sanity checks */ + // XXX: actually, we can probably still get away with no object - at most we have no updates + if (ELEM4(NULL, ob, ob->pose, pchan, pchan->bone)) + return; + + arm = ob->data; + /* can only change selection state if bone can be modified */ + if (PBONE_SELECTABLE(arm, pchan->bone)) { + /* change selection state */ + if (select) + pchan->bone->flag |= BONE_SELECTED; + else + pchan->bone->flag &= ~BONE_SELECTED; + + // TODO: select and activate corresponding vgroup? + + /* tag necessary depsgraph updates + * (see rna_Bone_select_update() in rna_armature.c for details) + */ + if (arm->flag & ARM_HAS_VIZ_DEPS) { + DAG_id_tag_update(&ob->id, OB_RECALC_DATA); + } + } +} + /* called from editview.c, for mode-less pose selection */ /* assumes scene obact and basact is still on old situation */ int ED_do_pose_selectbuffer(Scene *scene, Base *base, unsigned int *buffer, short hits, |