Hide selected/hide unselected/show all bones in posemode using the

usual HKEY, shift-HKEY, alt-HKEY, and also through the menu.

Thanks to malefico for the feature request, and thanks to broken
for doing the menu code.
This commit is contained in:
Chris Want
2004-01-03 05:07:31 +00:00
parent d311e96174
commit e090595ec9
4 changed files with 123 additions and 1 deletions

View File

@@ -110,6 +110,11 @@ void unique_editbone_name (char* name);
struct Bone *get_first_selected_bone (void);
void auto_align_armature(void);
void create_vgroups_from_armature(Object *ob, Object *par);
void hide_selected_pose_bones(void);
void hide_unselected_pose_bones(void);
void show_all_pose_bones(void);
int is_delay_deform(void);
#define BONESEL_TIP 0x08000000

View File

@@ -2707,6 +2707,72 @@ void create_vgroups_from_armature(Object *ob, Object *par)
}
}
int hide_selected_pose_bone(Object *ob, Bone *bone, void *ptr) {
if (bone->flag & BONE_SELECTED) {
bone->flag |= BONE_HIDDEN;
bone->flag &= ~BONE_SELECTED;
}
return 0;
}
void hide_selected_pose_bones(void) {
bArmature *arm;
arm=get_armature (G.obpose);
if (!arm)
return;
bone_looper(G.obpose, arm->bonebase.first, NULL,
hide_selected_pose_bone);
force_draw();
}
int hide_unselected_pose_bone(Object *ob, Bone *bone, void *ptr) {
if (~bone->flag & BONE_SELECTED) {
bone->flag |= BONE_HIDDEN;
}
return 0;
}
void hide_unselected_pose_bones(void) {
bArmature *arm;
arm=get_armature (G.obpose);
if (!arm)
return;
bone_looper(G.obpose, arm->bonebase.first, NULL,
hide_unselected_pose_bone);
force_draw();
}
int show_pose_bone(Object *ob, Bone *bone, void *ptr) {
if (bone->flag & BONE_HIDDEN) {
bone->flag &= ~BONE_HIDDEN;
bone->flag |= BONE_SELECTED;
}
return 0;
}
void show_all_pose_bones(void) {
bArmature *arm;
arm=get_armature (G.obpose);
if (!arm)
return;
bone_looper(G.obpose, arm->bonebase.first, NULL,
show_pose_bone);
force_draw();
}
int is_delay_deform(void)
{
bArmature *arm;

View File

@@ -1394,6 +1394,8 @@ static uiBlock *view3d_edit_mesh_normalsmenu(void *arg_unused)
return block;
}
static void do_view3d_edit_mesh_showhidemenu(void *arg, int event)
{
@@ -2165,6 +2167,41 @@ static void do_view3d_pose_armaturemenu(void *arg, int event)
allqueue(REDRAWVIEW3D, 0);
}
static void do_view3d_pose_armature_showhidemenu(void *arg, int event)
{
switch(event) {
case 0: /* show hidden bones */
show_all_pose_bones();
break;
case 1: /* hide selected bones */
hide_selected_pose_bones();
break;
case 2: /* hide deselected bones */
hide_unselected_pose_bones();
break;
}
allqueue(REDRAWVIEW3D, 0);
}
static uiBlock *view3d_pose_armature_showhidemenu(void *arg_unused)
{
uiBlock *block;
short yco = 20, menuwidth = 120;
block= uiNewBlock(&curarea->uiblocks, "view3d_pose_armature_showhidemenu", UI_EMBOSSP, UI_HELV, G.curscreen->mainwin);
uiBlockSetButmFunc(block, do_view3d_pose_armature_showhidemenu, NULL);
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Show Hidden|Alt H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Selected|H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Hide Deselected|Shift H", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 2, "");
uiBlockSetDirection(block, UI_RIGHT);
uiTextBoundsBlock(block, 60);
return block;
}
static uiBlock *view3d_pose_armaturemenu(void *arg_unused)
{
uiBlock *block;
@@ -2186,6 +2223,13 @@ static uiBlock *view3d_pose_armaturemenu(void *arg_unused)
uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Insert Keyframe|I", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 4, "");
uiDefBut(block, SEPR, 0, "", 0, yco-=6,
menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
uiDefIconTextBlockBut(block, view3d_pose_armature_showhidemenu,
NULL, ICON_RIGHTARROW_THIN,
"Show/Hide Bones", 0, yco-=20, 120, 19, "");
if(curarea->headertype==HEADERTOP) {
uiBlockSetDirection(block, UI_DOWN);
}

View File

@@ -1047,7 +1047,14 @@ void winqreadview3dspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
}
else if(G.f & G_FACESELECT)
hide_tface();
else if(G.obpose) {
if (G.qual==0)
hide_selected_pose_bones();
else if (G.qual==LR_SHIFTKEY)
hide_unselected_pose_bones();
else if (G.qual==LR_ALTKEY)
show_all_pose_bones();
}
break;
case IKEY:
break;