diff options
author | Joshua Leung <aligorith@gmail.com> | 2013-11-18 07:06:31 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2013-11-18 07:06:31 +0400 |
commit | 4ea79fcdda6523faf875128ef3d6e8a8ecff67c9 (patch) | |
tree | 6aaa1892d4acc80a7fb71c86bf86e0da239f26cd /source/blender | |
parent | 0ff70d942fa6a27ef416e59199a5c5590307dba2 (diff) |
Patch T37363: Highlight bone layers with active bones (as for Object Layers)
Patch by Jose Molina Garcia (sentinel), with style fixes by myself.
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index b23d7018a55..0f6034ba1cd 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -54,6 +54,8 @@ #include "UI_interface.h" +#include "ED_armature.h" + #include "WM_api.h" #include "WM_types.h" @@ -375,6 +377,7 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in int cols = (len >= 20) ? 2 : 1; const unsigned int colbuts = len / (2 * cols); unsigned int layer_used = 0; + unsigned int layer_active = 0; uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, FALSE)); @@ -384,7 +387,15 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in if (ptr->type == &RNA_Armature) { bArmature *arm = (bArmature *)ptr->data; + layer_used = arm->layer_used; + + if (arm->edbo && arm->act_edbone) { + layer_active |= arm->act_edbone->layer; + } + else if (arm->act_bone) { + layer_active |= arm->act_bone->layer; + } } for (b = 0; b < cols; b++) { @@ -394,8 +405,15 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in int layer_num = a + b * colbuts; int layer_flag = 1 << layer_num; - if (layer_used & layer_flag) icon = ICON_LAYER_USED; - else icon = ICON_BLANK1; + if (layer_used & layer_flag) { + if (layer_active & layer_flag) + icon = ICON_LAYER_ACTIVE; + else + icon = ICON_LAYER_USED; + } + else { + icon = ICON_BLANK1; + } but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y + buth, butw, buth); if (subtype == PROP_LAYER_MEMBER) @@ -405,8 +423,15 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in int layer_num = a + len / 2 + b * colbuts; int layer_flag = 1 << layer_num; - if (layer_used & layer_flag) icon = ICON_LAYER_USED; - else icon = ICON_BLANK1; + if (layer_used & layer_flag) { + if (layer_active & layer_flag) + icon = ICON_LAYER_ACTIVE; + else + icon = ICON_LAYER_USED; + } + else { + icon = ICON_BLANK1; + } but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y, butw, buth); if (subtype == PROP_LAYER_MEMBER) |