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
path: root/source
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2008-07-08 11:06:42 +0400
committerJoshua Leung <aligorith@gmail.com>2008-07-08 11:06:42 +0400
commit22e87792f155b774399f66c512802a62c5751719 (patch)
treef28df3a678f8c29cc912d0e167eaf9b7eb50aa17 /source
parent3185253a066053ba0ece547e4f17adcc152ddb71 (diff)
== Select Swap for Armatures (Ctrl I) ==
It is now possible to swap the selection of bones in EditMode and PoseMode using the CTRL IKEY hotkey. As a result, the hotkey for adding IK Constraints has now changed to SHIFT IKEY (so that select swap can have a consistent hotkey)
Diffstat (limited to 'source')
-rw-r--r--source/blender/src/editarmature.c51
-rw-r--r--source/blender/src/header_view3d.c15
-rw-r--r--source/blender/src/space.c16
3 files changed, 62 insertions, 20 deletions
diff --git a/source/blender/src/editarmature.c b/source/blender/src/editarmature.c
index 39f93510358..6310dd0a262 100644
--- a/source/blender/src/editarmature.c
+++ b/source/blender/src/editarmature.c
@@ -1646,8 +1646,9 @@ void load_editArmature(void)
}
/* toggle==0: deselect
- toggle==1: swap
+ toggle==1: swap (based on test)
toggle==2: only active tag
+ toggle==3: swap (no test)
*/
void deselectall_armature(int toggle, int doundo)
{
@@ -1670,18 +1671,30 @@ void deselectall_armature(int toggle, int doundo)
else sel= toggle;
/* Set the flags */
- for (eBone=G.edbo.first;eBone;eBone=eBone->next){
- if (sel==1) {
+ for (eBone=G.edbo.first;eBone;eBone=eBone->next) {
+ if (sel==3) {
+ /* invert selection of bone */
+ if ((arm->layer & eBone->layer) && (eBone->flag & BONE_HIDDEN_A)==0) {
+ eBone->flag ^= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
+ eBone->flag &= ~BONE_ACTIVE;
+ }
+ }
+ else if (sel==1) {
+ /* select bone */
if(arm->layer & eBone->layer && (eBone->flag & BONE_HIDDEN_A)==0) {
eBone->flag |= (BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL);
if(eBone->parent)
eBone->parent->flag |= (BONE_TIPSEL);
}
}
- else if (sel==2)
+ else if (sel==2) {
+ /* clear active flag */
eBone->flag &= ~(BONE_ACTIVE);
- else
+ }
+ else {
+ /* deselect bone */
eBone->flag &= ~(BONE_SELECTED | BONE_TIPSEL | BONE_ROOTSEL | BONE_ACTIVE);
+ }
}
allqueue(REDRAWVIEW3D, 0);
@@ -3276,8 +3289,9 @@ int do_pose_selectbuffer(Base *base, unsigned int *buffer, short hits)
}
/* test==0: deselect all
- test==1: swap select
- test==2: only clear active tag
+ test==1: swap select (apply to all the opposite of current situation)
+ test==2: only clear active tag
+ test==3: swap select (no test / inverse selection status of all independently)
*/
void deselectall_posearmature (Object *ob, int test, int doundo)
{
@@ -3307,16 +3321,27 @@ void deselectall_posearmature (Object *ob, int test, int doundo)
/* Set the flags accordingly */
for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
if ((pchan->bone->layer & arm->layer) && !(pchan->bone->flag & BONE_HIDDEN_P)) {
- if (selectmode==0) pchan->bone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE);
- else if (selectmode==1) pchan->bone->flag |= BONE_SELECTED;
- else pchan->bone->flag &= ~BONE_ACTIVE;
+ if (test==3) {
+ pchan->bone->flag ^= (BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL);
+ pchan->bone->flag &= ~BONE_ACTIVE;
+ }
+ else {
+ if (selectmode==0) pchan->bone->flag &= ~(BONE_SELECTED|BONE_TIPSEL|BONE_ROOTSEL|BONE_ACTIVE);
+ else if (selectmode==1) pchan->bone->flag |= BONE_SELECTED;
+ else pchan->bone->flag &= ~BONE_ACTIVE;
+ }
}
}
/* action editor */
- deselect_actionchannels(ob->action, 0); /* deselects for sure */
- if (selectmode == 1)
- deselect_actionchannels(ob->action, 1); /* swaps */
+ if (test == 3) {
+ deselect_actionchannels(ob->action, 2); /* inverts selection */
+ }
+ else {
+ deselect_actionchannels(ob->action, 0); /* deselects for sure */
+ if (selectmode == 1)
+ deselect_actionchannels(ob->action, 1); /* swaps */
+ }
allqueue(REDRAWBUTSEDIT, 0);
allqueue(REDRAWBUTSOBJECT, 0);
diff --git a/source/blender/src/header_view3d.c b/source/blender/src/header_view3d.c
index 1ada2729289..0f3a46c8a8c 100644
--- a/source/blender/src/header_view3d.c
+++ b/source/blender/src/header_view3d.c
@@ -1313,6 +1313,9 @@ static void do_view3d_select_armaturemenu(void *arg, int event)
case 3: /* Select Parent(s) */
select_bone_parent();
break;
+ case 4: /* Swap Select All */
+ deselectall_armature(3, 1);
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -1331,6 +1334,8 @@ static uiBlock *view3d_select_armaturemenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Swap Select All|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
+
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
if(curarea->headertype==HEADERTOP) {
@@ -1356,12 +1361,15 @@ static void do_view3d_select_pose_armaturemenu(void *arg, int event)
case 2: /* Select/Deselect all */
deselectall_posearmature(OBACT, 1, 1);
break;
- case 3:
+ case 3: /* Select Target(s) of Constraint(s) */
pose_select_constraint_target();
break;
- case 4:
+ case 4: /* Select Bone's Parent */
select_bone_parent();
break;
+ case 5: /* Swap Select All */
+ deselectall_posearmature(OBACT, 3, 1);
+ break;
}
allqueue(REDRAWVIEW3D, 0);
}
@@ -1379,6 +1387,7 @@ static uiBlock *view3d_select_pose_armaturemenu(void *arg_unused)
uiDefBut(block, SEPR, 0, "", 0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select/Deselect All|A", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Swap Select All|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Constraint Target|W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Select Parent(s)|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
@@ -4106,7 +4115,7 @@ static uiBlock *view3d_pose_armature_ikmenu(void *arg_unused)
block= uiNewBlock(&curarea->uiblocks, "view3d_pose_armature_ikmenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_view3d_pose_armature_ikmenu, NULL);
- uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add IK to Bone...|Ctrl I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+ uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Add IK to Bone...|Shift I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Clear IK...|Alt I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiBlockSetDirection(block, UI_RIGHT);
diff --git a/source/blender/src/space.c b/source/blender/src/space.c
index 4422411b1c5..fe9bb3279cc 100644
--- a/source/blender/src/space.c
+++ b/source/blender/src/space.c
@@ -2189,10 +2189,14 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
break;
case IKEY:
if(G.qual==LR_CTRLKEY) {
- if(ob && (ob->flag & OB_POSEMODE) && ob->type==OB_ARMATURE)
- pose_add_IK();
- else if(ob && G.obedit)
- selectswap_mesh();
+ if((ob) && (ob->flag & OB_POSEMODE) && (ob->type==OB_ARMATURE))
+ deselectall_posearmature(ob, 3, 1);
+ else if(ob && G.obedit) {
+ if(G.obedit->type == OB_ARMATURE)
+ deselectall_armature(3, 1);
+ else
+ selectswap_mesh();
+ }
else
selectswap();
}
@@ -2200,6 +2204,10 @@ static void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
if(ob && (ob->flag & OB_POSEMODE) && ob->type==OB_ARMATURE)
pose_clear_IK();
}
+ else if(G.qual==LR_SHIFTKEY) {
+ if(ob && (ob->flag & OB_POSEMODE) && ob->type==OB_ARMATURE)
+ pose_add_IK();
+ }
break;
case JKEY: