fix for active bone not saving in editmode.
authorCampbell Barton <ideasman42@gmail.com>
Thu, 21 Nov 2013 23:36:35 +0000 (10:36 +1100)
committerCampbell Barton <ideasman42@gmail.com>
Thu, 21 Nov 2013 23:37:50 +0000 (10:37 +1100)
source/blender/editors/armature/armature_utils.c
source/blender/editors/interface/interface_layout.c
source/blender/makesdna/DNA_armature_types.h

index be26ad537fc5231e02d2f01ea4c70ca60ff2bd31..7d6b3710a3856b87f5b40c0a25d65bd2756c024f 100644 (file)
@@ -501,6 +501,7 @@ void ED_armature_from_edit(Object *obedit)
        
        /* armature bones */
        BKE_armature_bonelist_free(&arm->bonebase);
+       arm->act_bone = NULL;
        
        /* remove zero sized bones, this gives unstable restposes */
        for (eBone = arm->edbo->first; eBone; eBone = neBone) {
@@ -634,7 +635,6 @@ void ED_armature_to_edit(Object *ob)
        ED_armature_edit_free(ob);
        arm->edbo = MEM_callocN(sizeof(ListBase), "edbo armature");
        arm->act_edbone = make_boneList(arm->edbo, &arm->bonebase, NULL, arm->act_bone);
-       arm->act_bone = NULL;
 
 //     BIF_freeTemplates(); /* force template update when entering editmode */
 }
index e3686b7560c13cce9d9e2e22ac4a85a068afa1a4..b85c30b8710ad3059f7fb7076bb6745790445880 100644 (file)
@@ -390,11 +390,15 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
                        
                        layer_used = arm->layer_used;
                        
-                       if (arm->edbo && arm->act_edbone) {
-                               layer_active |= arm->act_edbone->layer;
+                       if (arm->edbo) {
+                               if (arm->act_edbone) {
+                                       layer_active |= arm->act_edbone->layer;
+                               }
                        }
-                       else if (arm->act_bone) {
-                               layer_active |= arm->act_bone->layer;
+                       else {
+                               if (arm->act_bone) {
+                                       layer_active |= arm->act_bone->layer;
+                               }
                        }
                }
 
index 4780b2e85de5eb34b8a7e766f9ebb19bf5d070ce..e751966c34ddd7018cb41d73c1ebd71e6865f95b 100644 (file)
@@ -88,7 +88,7 @@ typedef struct bArmature {
         * - from the user perspective active == last selected
         * - active should be ignored when not visible (hidden layer) */
 
-       Bone       *act_bone;               /* active bone (when not in editmode) */
+       Bone       *act_bone;               /* active bone */
        struct EditBone *act_edbone;        /* active editbone (in editmode) */
 
        void       *sketch;                 /* sketch struct for etch-a-ton */