Patch T37363: Highlight bone layers with active bones (as for Object Layers)
Patch by Jose Molina Garcia (sentinel), with style fixes by myself.
This commit is contained in:
@@ -54,6 +54,8 @@
|
|||||||
|
|
||||||
#include "UI_interface.h"
|
#include "UI_interface.h"
|
||||||
|
|
||||||
|
#include "ED_armature.h"
|
||||||
|
|
||||||
|
|
||||||
#include "WM_api.h"
|
#include "WM_api.h"
|
||||||
#include "WM_types.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;
|
int cols = (len >= 20) ? 2 : 1;
|
||||||
const unsigned int colbuts = len / (2 * cols);
|
const unsigned int colbuts = len / (2 * cols);
|
||||||
unsigned int layer_used = 0;
|
unsigned int layer_used = 0;
|
||||||
|
unsigned int layer_active = 0;
|
||||||
|
|
||||||
uiBlockSetCurLayout(block, uiLayoutAbsolute(layout, FALSE));
|
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) {
|
if (ptr->type == &RNA_Armature) {
|
||||||
bArmature *arm = (bArmature *)ptr->data;
|
bArmature *arm = (bArmature *)ptr->data;
|
||||||
|
|
||||||
layer_used = arm->layer_used;
|
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++) {
|
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_num = a + b * colbuts;
|
||||||
int layer_flag = 1 << layer_num;
|
int layer_flag = 1 << layer_num;
|
||||||
|
|
||||||
if (layer_used & layer_flag) icon = ICON_LAYER_USED;
|
if (layer_used & layer_flag) {
|
||||||
else icon = ICON_BLANK1;
|
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);
|
but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y + buth, butw, buth);
|
||||||
if (subtype == PROP_LAYER_MEMBER)
|
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_num = a + len / 2 + b * colbuts;
|
||||||
int layer_flag = 1 << layer_num;
|
int layer_flag = 1 << layer_num;
|
||||||
|
|
||||||
if (layer_used & layer_flag) icon = ICON_LAYER_USED;
|
if (layer_used & layer_flag) {
|
||||||
else icon = ICON_BLANK1;
|
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);
|
but = uiDefAutoButR(block, ptr, prop, layer_num, "", icon, x + butw * a, y, butw, buth);
|
||||||
if (subtype == PROP_LAYER_MEMBER)
|
if (subtype == PROP_LAYER_MEMBER)
|
||||||
|
Reference in New Issue
Block a user