2.5 - Restoring 'set bone setting' operators for Armatures/PoseMode
authorJoshua Leung <aligorith@gmail.com>
Sun, 26 Jul 2009 03:22:24 +0000 (03:22 +0000)
committerJoshua Leung <aligorith@gmail.com>
Sun, 26 Jul 2009 03:22:24 +0000 (03:22 +0000)
In the future, it might be a good idea to look for more efficient alternatives...

source/blender/editors/armature/armature_intern.h
source/blender/editors/armature/armature_ops.c
source/blender/editors/armature/editarmature.c
source/blender/editors/space_view3d/view3d_header.c

index 471ea6a6ccda29c82f796c0c2232d9bb117175b3..bf329270b8c1e6f67a691e3a64f145828ae74287 100644 (file)
@@ -56,12 +56,13 @@ void ARMATURE_OT_extrude(struct wmOperatorType *ot);
 void ARMATURE_OT_click_extrude(struct wmOperatorType *ot);
 void ARMATURE_OT_fill(struct wmOperatorType *ot);
 void ARMATURE_OT_merge(struct wmOperatorType *ot);
-
 void ARMATURE_OT_separate(struct wmOperatorType *ot);
 
 void ARMATURE_OT_autoside_names(struct wmOperatorType *ot);
 void ARMATURE_OT_flip_names(struct wmOperatorType *ot);
 
+void ARMATURE_OT_flags_set(struct wmOperatorType *ot);
+
 /* ******************************************************* */
 /* Pose-Mode Operators */
 void POSE_OT_hide(struct wmOperatorType *ot);
@@ -96,6 +97,8 @@ void POSE_OT_paths_clear(struct wmOperatorType *ot);
 void POSE_OT_autoside_names(struct wmOperatorType *ot);
 void POSE_OT_flip_names(struct wmOperatorType *ot);
 
+void POSE_OT_flags_set(struct wmOperatorType *ot);
+
 /* ******************************************************* */
 /* Etch-A-Ton */
 
index 757430a281a96ab8348cd21d8de133637abc5199..bfe3befe1b34bd93c63ac8766ef0bfc5512f3f3a 100644 (file)
@@ -131,11 +131,12 @@ void ED_operatortypes_armature(void)
        WM_operatortype_append(ARMATURE_OT_click_extrude);
        WM_operatortype_append(ARMATURE_OT_fill);
        WM_operatortype_append(ARMATURE_OT_merge);
-       
        WM_operatortype_append(ARMATURE_OT_separate);
        
        WM_operatortype_append(ARMATURE_OT_autoside_names);
        WM_operatortype_append(ARMATURE_OT_flip_names);
+       
+       WM_operatortype_append(ARMATURE_OT_flags_set);
 
        /* SKETCH */    
        WM_operatortype_append(SKETCH_OT_gesture);
@@ -179,6 +180,8 @@ void ED_operatortypes_armature(void)
        WM_operatortype_append(POSE_OT_autoside_names);
        WM_operatortype_append(POSE_OT_flip_names);
        
+       WM_operatortype_append(POSE_OT_flags_set);
+       
        /* POSELIB */
        WM_operatortype_append(POSELIB_OT_browse_interactive);
        
@@ -242,6 +245,14 @@ void ED_keymap_armature(wmWindowManager *wm)
        
        WM_keymap_add_item(keymap, "ARMATURE_OT_separate", PKEY, KM_PRESS, /*KM_CTRL|KM_ALT*/0, 0);
        
+               /* set flags */
+       kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_flags_set", WKEY, KM_PRESS, KM_SHIFT, 0);
+               RNA_enum_set(kmi->ptr, "mode", 2); // toggle
+       kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_flags_set", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+               RNA_enum_set(kmi->ptr, "mode", 1); // enable
+       kmi= WM_keymap_add_item(keymap, "ARMATURE_OT_flags_set", WKEY, KM_PRESS, KM_ALT, 0);
+               RNA_enum_set(kmi->ptr, "mode", 0); // clear
+       
        /* Armature -> Etch-A-Ton ------------------------ */
        WM_keymap_add_item(keymap, "SKETCH_OT_delete", XKEY, KM_PRESS, 0, 0);
        WM_keymap_add_item(keymap, "SKETCH_OT_finish_stroke", SELECTMOUSE, KM_PRESS, 0, 0);
@@ -296,6 +307,14 @@ void ED_keymap_armature(wmWindowManager *wm)
        
        WM_keymap_add_item(keymap, "POSE_OT_groups_menu", GKEY, KM_PRESS, KM_CTRL, 0);
        
+       /* set flags */
+       kmi= WM_keymap_add_item(keymap, "POSE_OT_flags_set", WKEY, KM_PRESS, KM_SHIFT, 0);
+               RNA_enum_set(kmi->ptr, "mode", 2); // toggle
+       kmi= WM_keymap_add_item(keymap, "POSE_OT_flags_set", WKEY, KM_PRESS, KM_CTRL|KM_SHIFT, 0);
+               RNA_enum_set(kmi->ptr, "mode", 1); // enable
+       kmi= WM_keymap_add_item(keymap, "POSE_OT_flags_set", WKEY, KM_PRESS, KM_ALT, 0);
+               RNA_enum_set(kmi->ptr, "mode", 0); // clear
+       
        // XXX this should probably be in screen instead... here for testing purposes in the meantime... - Aligorith
        WM_keymap_verify_item(keymap, "ANIM_OT_insert_keyframe_menu", IKEY, KM_PRESS, 0, 0);
        WM_keymap_verify_item(keymap, "ANIM_OT_delete_keyframe_v3d", IKEY, KM_PRESS, KM_ALT, 0);
index cda7f1754bb1a34a514b05ff8a08ed9fdb40d53a..f20c38a02468acf76b35db0f36a359b2041b4b41 100644 (file)
@@ -371,6 +371,7 @@ void apply_rot_armature (Scene *scene, Object *ob, float mat[3][3])
        ED_armature_edit_free(ob);
 }
 
+/* exported for use in editors/object/ */
 /* 0 == do center, 1 == center new, 2 == center cursor */
 void docenter_armature (Scene *scene, View3D *v3d, Object *ob, int centermode)
 {
@@ -1251,72 +1252,106 @@ static EditBone *editbone_get_child(bArmature *arm, EditBone *pabone, short use_
        return chbone;
 }
 
-
-/* used by posemode and editmode */
-void setflag_armature (Scene *scene, short mode)
+/* callback for posemode setflag */
+static int pose_setflag_exec (bContext *C, wmOperator *op)
 {
-       Object *obedit= scene->obedit; // XXX get from context
-       Object *ob;
-       bArmature *arm; 
-       int flag;
-       
-       /* get data */
-       if (obedit)
-               ob= obedit;
-       else if (OBACT)
-               ob= OBACT;
-       else
-               return;
-       arm= (bArmature *)ob->data;
+       int flag= RNA_enum_get(op->ptr, "type");
+       int mode= RNA_enum_get(op->ptr, "mode");
        
-       /* get flag to set (sync these with the ones used in eBone_Flag */
-       if (mode == 2)
-               flag= pupmenu("Disable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5|Locked%x6");
-       else if (mode == 1)
-               flag= pupmenu("Enable Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5|Locked%x6");
-       else
-               flag= pupmenu("Toggle Setting%t|Draw Wire%x1|Deform%x2|Mult VG%x3|Hinge%x4|No Scale%x5|Locked%x6");
-       switch (flag) {
-               case 1:         flag = BONE_DRAWWIRE;   break;
-               case 2:         flag = BONE_NO_DEFORM; break;
-               case 3:         flag = BONE_MULT_VG_ENV; break;
-               case 4:         flag = BONE_HINGE; break;
-               case 5:         flag = BONE_NO_SCALE; break;
-               case 6:         flag = BONE_EDITMODE_LOCKED; break;
-               default:        return;
-       }
-       
-       /* determine which mode armature is in */
-       if ((!obedit) && (ob->flag & OB_POSEMODE)) {
-               /* deal with pose channels */
-               bPoseChannel *pchan;
-               
-               /* set setting */
-               for (pchan= ob->pose->chanbase.first; pchan; pchan= pchan->next) {
-                       if ((pchan->bone) && (arm->layer & pchan->bone->layer)) {
-                               if (pchan->bone->flag & BONE_SELECTED) {
-                                       bone_setflag(&pchan->bone->flag, flag, mode);
-                               }
-                       }
-               }
+       /* loop over all selected pchans */
+       CTX_DATA_BEGIN(C, bPoseChannel *, pchan, selected_pchans) 
+       {
+               bone_setflag(&pchan->bone->flag, flag, mode);
        }
-       else if (obedit) {
-               /* deal with editbones */
-               EditBone *curbone;
-               
-               /* set setting */
-               for (curbone= arm->edbo->first; curbone; curbone= curbone->next) {
-                       if (arm->layer & curbone->layer) {
-                               if (curbone->flag & BONE_SELECTED) {
-                                       bone_setflag(&curbone->flag, flag, mode);
-                               }
-                       }
-               }
+       CTX_DATA_END;
+       
+       /* note, notifier might evolve */
+       WM_event_add_notifier(C, NC_OBJECT|ND_POSE, CTX_data_active_object(C));
+       
+       return OPERATOR_FINISHED;
+}
+
+/* callback for editbones setflag */
+static int armature_bones_setflag_exec (bContext *C, wmOperator *op)
+{
+       Object *ob= CTX_data_active_object(C);
+       int flag= RNA_enum_get(op->ptr, "type");
+       int mode= RNA_enum_get(op->ptr, "mode");
+       
+       /* loop over all selected pchans */
+       CTX_DATA_BEGIN(C, EditBone *, ebone, selected_bones) 
+       {
+               bone_setflag(&ebone->flag, flag, mode);
        }
+       CTX_DATA_END;
+       
+       /* note, notifier might evolve */
+       WM_event_add_notifier(C, NC_OBJECT|ND_POSE, CTX_data_edit_object(C));
+       
+       return OPERATOR_FINISHED;
+}
+
+/* settings that can be changed */
+static EnumPropertyItem prop_bone_setting_types[] = {
+       {BONE_DRAWWIRE, "DRAWWIRE", 0, "Draw Wire", ""},
+       {BONE_NO_DEFORM, "DEFORM", 0, "Deform", ""},
+       {BONE_MULT_VG_ENV, "MULT_VG", 0, "Multiply Vertex Groups", ""},
+       {BONE_HINGE, "HINGE", 0, "Hinge", ""},
+       {BONE_NO_SCALE, "NO_SCALE", 0, "No Scale", ""},
+       {BONE_EDITMODE_LOCKED, "LOCKED", 0, "Locked", "(For EditMode only)"},
+       {0, NULL, 0, NULL, NULL}
+};
+
+/* ways that settings can be changed */
+static EnumPropertyItem prop_bone_setting_modes[] = {
+       {0, "CLEAR", 0, "Clear", ""},
+       {1, "ENABLE", 0, "Enable", ""},
+       {2, "TOGGLE", 0, "Toggle", ""},
+       {0, NULL, 0, NULL, NULL}
+};
+
+
+void ARMATURE_OT_flags_set (wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Set Bone Flags";
+       ot->idname= "ARMATURE_OT_flags_set";
+       ot->description= "Set flags for armature bones.";
+       
+       /* callbacks */
+       ot->invoke= WM_menu_invoke;
+       ot->exec= armature_bones_setflag_exec;
+       ot->poll= ED_operator_editarmature;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
        
-       BIF_undo_push("Change Bone Setting");
+       /* properties */
+       RNA_def_enum(ot->srna, "type", prop_bone_setting_types, 0, "Type", "");
+       RNA_def_enum(ot->srna, "mode", prop_bone_setting_modes, 0, "Mode", "");
 }
 
+void POSE_OT_flags_set (wmOperatorType *ot)
+{
+       /* identifiers */
+       ot->name= "Set Bone Flags";
+       ot->idname= "POSE_OT_flags_set";
+       ot->description= "Set flags for armature bones.";
+       
+       /* callbacks */
+       ot->invoke= WM_menu_invoke;
+       ot->exec= pose_setflag_exec;
+       ot->poll= ED_operator_posemode;
+       
+       /* flags */
+       ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
+       
+       /* properties */
+       RNA_def_enum(ot->srna, "type", prop_bone_setting_types, 0, "Type", "");
+       RNA_def_enum(ot->srna, "mode", prop_bone_setting_modes, 0, "Mode", "");
+}
+
+
 /* **************** END PoseMode & EditMode *************************** */
 /* **************** Posemode stuff ********************** */
 
@@ -1501,8 +1536,6 @@ void ARMATURE_OT_select_linked(wmOperatorType *ot)
        
        /* flags */
        ot->flag= OPTYPE_REGISTER|OPTYPE_UNDO;
-       
-       /* props */     
 }
 
 /* does bones and points */
index abf170c9549fb4f315f577094ab51f0cdfa55d35..529db1cbb06aa8b7d0ff10e0684868141c9183b7 100644 (file)
@@ -2765,10 +2765,18 @@ static void view3d_edit_armature_rollmenu(bContext *C, uiLayout *layout, void *a
        //uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Set Roll|Ctrl R", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 3, "");
 }
 
+static void view3d_edit_armature_settingsmenu(bContext *C, uiLayout *layout, void *arg_unused)
+{
+       PointerRNA ptr;
+       
+       uiItemEnumO(layout, "Toggle a Setting", 0, "ARMATURE_OT_flags_set", "mode", 2);
+       uiItemEnumO(layout, "Enable a Setting", 0, "ARMATURE_OT_flags_set", "mode", 1);
+       uiItemEnumO(layout, "Disable a Setting", 0, "ARMATURE_OT_flags_set", "mode", 0);
+}
+
 #if 0
 static void do_view3d_edit_armaturemenu(bContext *C, void *arg, int event)
 {
-#if 0
        static short numcuts= 2;
 
        switch(event) {
@@ -2783,14 +2791,7 @@ static void do_view3d_edit_armaturemenu(bContext *C, void *arg, int event)
        case 7: /* Warp */
                initTransform(TFM_WARP, CTX_NONE);
                Transform();
-       case 10: /* forked! */
-               extrude_armature(1);
-               break;
        
-       case 16: /* Alt-S transform (BoneSize) */
-               initTransform(TFM_BONESIZE, CTX_NONE);
-               Transform();
-               break;
        case 17: /* move to layer */
                pose_movetolayer();
                break;
@@ -2799,66 +2800,6 @@ static void do_view3d_edit_armaturemenu(bContext *C, void *arg, int event)
                add_blockhandler(curarea, VIEW3D_HANDLER_BONESKETCH, UI_PNL_UNSTOW);
                break;
        }
-       
-#endif
-}
-
-
-#ifndef DISABLE_PYTHON
-static void do_view3d_scripts_armaturemenu(bContext *C, void *arg, int event)
-{
-#if 0
-       BPY_menu_do_python(PYMENU_ARMATURE, event);
-       
-#endif
-}
-
-static uiBlock *view3d_scripts_armaturemenu(bContext *C, ARegion *ar, void *arg_unused)
-{
-       uiBlock *block;
-// XXX BPyMenu *pym;
-//     int i= 0;
-//     short yco = 20, menuwidth = 120;
-       
-       block= uiBeginBlock(C, ar, "view3d_scripts_armaturemenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_scripts_armaturemenu, NULL);
-       
-       /* note that we acount for the N previous entries with i+20: */
-//     for (pym = BPyMenuTable[PYMENU_ARMATURE]; pym; pym = pym->next, i++) {
-//             
-//             uiDefIconTextBut(block, BUTM, 1, ICON_PYTHON, pym->name, 0, yco-=20, menuwidth, 19, 
-//                                              NULL, 0.0, 0.0, 1, i, 
-//                                              pym->tooltip?pym->tooltip:pym->filename);
-//     }
-       
-       uiBlockSetDirection(block, UI_RIGHT);
-       uiTextBoundsBlock(block, 60);
-       
-       return block;
-}
-#endif /* DISABLE_PYTHON */
-
-static void do_view3d_armature_settingsmenu(bContext *C, void *arg, int event)
-{
-// XXX setflag_armature(event);
-}
-
-static uiBlock *view3d_armature_settingsmenu(bContext *C, ARegion *ar, void *arg_unused)
-{
-       uiBlock *block;
-       short yco= 0, menuwidth=120;
-
-       block= uiBeginBlock(C, ar, "view3d_armature_settingsmenu", UI_EMBOSSP);
-       uiBlockSetButmFunc(block, do_view3d_armature_settingsmenu, NULL);
-
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Toggle a Setting|Shift W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 0, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Enable a Setting|Ctrl Shift W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 1, "");
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Disable a Setting|Alt W", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 0, 2, "");
-
-       uiBlockSetDirection(block, UI_RIGHT);
-       uiTextBoundsBlock(block, 60);
-
-       return block;
 }
 #endif
 
@@ -2867,23 +2808,19 @@ static void view3d_edit_armaturemenu(bContext *C, uiLayout *layout, void *arg_un
        Object *obedit = CTX_data_edit_object(C);
        bArmature *arm= obedit->data;
        
-       //uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U",               0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
-
 #if 0
-       uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Transform Properties|N", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 1, "");
+       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Undo Editing|U",         0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 0, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_MENU_PANEL, "Bone Sketching|P", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 23, "");
        uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
        uiDefIconTextBlockBut(block, view3d_edit_mirrormenu, NULL, ICON_RIGHTARROW_THIN, "Mirror", 0, yco-=20, menuwidth, 19, "");
-       // XXX uiDefIconTextBlockBut(block, view3d_edit_snapmenu, NULL, ICON_RIGHTARROW_THIN, "Snap", 0, yco-=20, 120, 19, "");
 #endif
+       uiItemMenuF(layout, "Snap", 0, view3d_edit_snapmenu);
        uiItemMenuF(layout, "Bone Roll", 0, view3d_edit_armature_rollmenu);
        
-#if 0
-       if (arm->drawtype==ARM_ENVELOPE)
-               uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale Envelope Distance|Alt S",  0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
-       else if (arm->drawtype==ARM_B_BONE)
-               uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale B-Bone Width|Alt S",       0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 16, "");
-#endif 
+       if (arm->drawtype == ARM_ENVELOPE)
+               uiItemEnumO(layout, "Scale Envelope Distance", 0, "TFM_OT_transform", "mode", TFM_BONESIZE);
+       else
+               uiItemEnumO(layout, "Scale B-Bone Width", 0, "TFM_OT_transform", "mode", TFM_BONESIZE);
        
        uiItemS(layout);
        
@@ -2918,15 +2855,10 @@ static void view3d_edit_armaturemenu(bContext *C, uiLayout *layout, void *arg_un
 #endif
        
        uiItemMenuF(layout, "Parent", 0, view3d_edit_armature_parentmenu);
-       //uiDefIconTextBlockBut(block, view3d_armature_settingsmenu, NULL, ICON_RIGHTARROW_THIN, "Bone Settings", 0, yco-=20, 120, 19, "");
        
-#if 0
-#ifndef DISABLE_PYTHON
-       uiDefBut(block, SEPR, 0, "",                            0, yco-=6, menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
+       uiItemS(layout);
        
-       uiDefIconTextBlockBut(block, view3d_scripts_armaturemenu, NULL, ICON_RIGHTARROW_THIN, "Scripts", 0, yco-=20, 120, 19, "");
-#endif
-#endif
+       uiItemMenuF(layout, "Bone Settings ", 0, view3d_edit_armature_settingsmenu);
 }
 
 
@@ -2993,6 +2925,15 @@ static void view3d_pose_armature_poselibmenu(bContext *C, uiLayout *layout, void
        uiItemO(layout, NULL, 0, "POSELIB_OT_pose_remove");
 }
 
+static void view3d_pose_armature_settingsmenu(bContext *C, uiLayout *layout, void *arg_unused)
+{
+       PointerRNA ptr;
+       
+       uiItemEnumO(layout, "Toggle a Setting", 0, "POSE_OT_flags_set", "mode", 2);
+       uiItemEnumO(layout, "Enable a Setting", 0, "POSE_OT_flags_set", "mode", 1);
+       uiItemEnumO(layout, "Disable a Setting", 0, "POSE_OT_flags_set", "mode", 0);
+}
+
 #if 0
 static void do_view3d_pose_armaturemenu(bContext *C, void *arg, int event)
 {
@@ -3000,65 +2941,29 @@ static void do_view3d_pose_armaturemenu(bContext *C, void *arg, int event)
        ob=OBACT;
        
        switch(event) {
-       case 0: /* transform properties */
-// XXX         mainqenter(NKEY, 1);
-               break;
-       case 1: /* copy current pose */
-               copy_posebuf();
-               break;
-       case 2: /* paste pose */
-               paste_posebuf(0);
-               break;
-       case 3: /* paste flipped pose */
-               paste_posebuf(1);
-               break;
-       case 4: /* insert keyframe */
-               common_insertkey();
-               break;
        case 5:
                pose_copy_menu();
                break;
-       case 9:
-               pose_flip_names();
-               break;
-       case 13:
-               if(ob && (ob->flag & OB_POSEMODE)) {
-                       bArmature *arm= ob->data;
-                       if( (arm->drawtype == ARM_B_BONE) || (arm->drawtype == ARM_ENVELOPE)) {
-                               initTransform(TFM_BONESIZE, CTX_NONE);
-                               Transform();
-                               break;
-                       }
-               }
-               break;
        case 14: /* move bone to layer / change armature layer */
                pose_movetolayer();
                break;
        case 15:
                pose_relax();
                break;
-       case 16: /* auto-extensions for bones */
-       case 17:
-       case 18:
-               pose_autoside_names(event-16);
-               break;
-       case 19: /* assign pose as restpose */
-               apply_armature_pose2bones();
-               break;
-       case 20: /* delete keyframe */
-               common_deletekey();
-               break;
        }
 }
 #endif
 
 static void view3d_pose_armaturemenu(bContext *C, uiLayout *layout, void *arg_unused)
-{
+{      
+       Object *ob = CTX_data_active_object(C);
+       bArmature *arm= ob->data;
+       
 #if 0 // XXX to be ported, using uiItemMenuF(layout, "<Name>", 0, view3d_pose_armature_<category>menu);
        uiDefIconTextBlockBut(block, view3d_transformmenu, NULL, ICON_RIGHTARROW_THIN, "Transform", 0, yco-=20, 120, 19, "");
-       // ... clear transfrom sub-menu was here....
-       uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Scale Envelope Distance|Alt S",                          0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 13, "");
 #endif 
+       if ( (arm) && ((arm->drawtype == ARM_B_BONE) || (arm->drawtype == ARM_ENVELOPE)) )
+               uiItemEnumO(layout, "Scale Envelope Distance", 0, "TFM_OT_transform", "mode", TFM_BONESIZE);
        uiItemMenuF(layout, "Clear Transform", 0, view3d_pose_armature_transformmenu);
        
        uiItemS(layout);
@@ -3105,6 +3010,10 @@ static void view3d_pose_armaturemenu(bContext *C, uiLayout *layout, void *arg_un
        
        uiItemMenuF(layout, "Show/Hide Bones", 0, view3d_pose_armature_showhidemenu);
        
+       uiItemS(layout);
+       
+       uiItemMenuF(layout, "Bone Settings", 0, view3d_pose_armature_settingsmenu);
+       
 #if 0
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Copy Attributes...|Ctrl C",                      0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 5, "");
 
@@ -3112,12 +3021,6 @@ static void view3d_pose_armaturemenu(bContext *C, uiLayout *layout, void *arg_un
        
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Switch Armature Layers|Shift M", 0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
        uiDefIconTextBut(block, BUTM, 1, ICON_BLANK1, "Move Bone To Layer|M",   0, yco-=20, menuwidth, 19, NULL, 0.0, 0.0, 1, 14, "");
-       
-       uiDefBut(block, SEPR, 0, "", 0, yco-=6,  menuwidth, 6, NULL, 0.0, 0.0, 0, 0, "");
-       
-       // ... show/hide bones was here
-       uiDefIconTextBlockBut(block, view3d_armature_settingsmenu, 
-                                                 NULL, ICON_RIGHTARROW_THIN,   "Bone Settings", 0, yco-=20, 120, 19, "");
 #endif
 }