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
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2010-12-08 06:05:46 +0300
committerCampbell Barton <ideasman42@gmail.com>2010-12-08 06:05:46 +0300
commit2e667e45fc02c5de285df836e59248a82b45dff9 (patch)
treedb50ed1d0d743baf836dbc1cf5a185c4c4342e93 /source/blender/editors/space_outliner/outliner.c
parent47d6166adb7a5100e04c645e7d6284c5c1b95c9d (diff)
Changed armature active bone so it is separate from selection this is consistent with active object, mesh editmode, curves & metaballs.
- active is no longer assumed to be selected. this fixes a simple bug - eg: Adding a new armature, entering pose mode and toggling selection failed. - outliner editbone selection now works like object and pose mode. - mouse selection sets the bone active even when the tip is selected. - active, unselected bones draw as wire color with a 15% tint of the selected color.
Diffstat (limited to 'source/blender/editors/space_outliner/outliner.c')
-rw-r--r--source/blender/editors/space_outliner/outliner.c56
1 files changed, 37 insertions, 19 deletions
diff --git a/source/blender/editors/space_outliner/outliner.c b/source/blender/editors/space_outliner/outliner.c
index 6583d287cf8..7426fca844e 100644
--- a/source/blender/editors/space_outliner/outliner.c
+++ b/source/blender/editors/space_outliner/outliner.c
@@ -2151,8 +2151,6 @@ static int tree_element_active_posechannel(bContext *C, Scene *scene, TreeElemen
if(set==2 && (pchan->bone->flag & BONE_SELECTED)) {
pchan->bone->flag &= ~BONE_SELECTED;
- if(arm->act_bone==pchan->bone)
- arm->act_bone= NULL;
} else {
pchan->bone->flag |= BONE_SELECTED;
arm->act_bone= pchan->bone;
@@ -2182,8 +2180,6 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
if(set==2 && (bone->flag & BONE_SELECTED)) {
bone->flag &= ~BONE_SELECTED;
- if(arm->act_bone==bone)
- arm->act_bone= NULL;
} else {
bone->flag |= BONE_SELECTED;
arm->act_bone= bone;
@@ -2204,27 +2200,49 @@ static int tree_element_active_bone(bContext *C, Scene *scene, TreeElement *te,
/* ebones only draw in editmode armature */
+static void tree_element_active_ebone__sel(bContext *C, Scene *scene, bArmature *arm, EditBone *ebone, short sel)
+{
+ if(sel) {
+ ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL;
+ arm->act_edbone= ebone;
+ // flush to parent?
+ if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
+ }
+ else {
+ ebone->flag &= ~(BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL);
+ // flush to parent?
+ if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag &= ~BONE_TIPSEL;
+ }
+
+ WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, scene->obedit);
+}
static int tree_element_active_ebone(bContext *C, Scene *scene, TreeElement *te, TreeStoreElem *UNUSED(tselem), int set)
{
+ bArmature *arm= scene->obedit->data;
EditBone *ebone= te->directdata;
-
- if(set) {
- if(!(ebone->flag & BONE_HIDDEN_A)) {
- bArmature *arm= scene->obedit->data;
- if(set==2) ED_armature_deselect_all(scene->obedit, 2); // only clear active tag
- else ED_armature_deselect_all(scene->obedit, 0); // deselect
- ebone->flag |= BONE_SELECTED|BONE_ROOTSEL|BONE_TIPSEL;
- arm->act_edbone= ebone;
-
- // flush to parent?
- if(ebone->parent && (ebone->flag & BONE_CONNECTED)) ebone->parent->flag |= BONE_TIPSEL;
-
- WM_event_add_notifier(C, NC_OBJECT|ND_BONE_ACTIVE, scene->obedit);
+ if(set==1) {
+ if(!(ebone->flag & BONE_HIDDEN_A)) {
+ ED_armature_deselect_all(scene->obedit, 0); // deselect
+ tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
+ return 1;
}
}
- else {
- if (ebone->flag & BONE_SELECTED) return 1;
+ else if (set==2) {
+ if(!(ebone->flag & BONE_HIDDEN_A)) {
+ if(!(ebone->flag & BONE_SELECTED)) {
+ tree_element_active_ebone__sel(C, scene, arm, ebone, TRUE);
+ return 1;
+ }
+ else {
+ /* entirely selected, so de-select */
+ tree_element_active_ebone__sel(C, scene, arm, ebone, FALSE);
+ return 0;
+ }
+ }
+ }
+ else if (ebone->flag & BONE_SELECTED) {
+ return 1;
}
return 0;
}