Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoshua Leung <aligorith@gmail.com>2013-11-18 06:53:46 +0400
committerJoshua Leung <aligorith@gmail.com>2013-11-18 06:53:46 +0400
commit0ff70d942fa6a27ef416e59199a5c5590307dba2 (patch)
treed18b021d315b285dc2a31f4bd0ac42b2776d290c /source/blender/editors/interface/interface_layout.c
parentcee7fbdfaa647dd05a49b8450227b8c9a12e80a0 (diff)
Code cleanup - Reduce duplication of layer number calculations here
Diffstat (limited to 'source/blender/editors/interface/interface_layout.c')
-rw-r--r--source/blender/editors/interface/interface_layout.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index e5bcc3d6863..b23d7018a55 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -391,20 +391,26 @@ static void ui_item_array(uiLayout *layout, uiBlock *block, const char *name, in
uiBlockBeginAlign(block);
for (a = 0; a < colbuts; a++) {
- if (layer_used & (1 << (a + b * colbuts))) icon = ICON_LAYER_USED;
+ 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;
- but = uiDefAutoButR(block, ptr, prop, a + b * colbuts, "", 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)
- uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a + b * colbuts));
+ uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(layer_num));
}
for (a = 0; a < colbuts; a++) {
- if (layer_used & (1 << (a + len / 2 + b * colbuts))) icon = ICON_LAYER_USED;
+ 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;
- but = uiDefAutoButR(block, ptr, prop, a + len / 2 + b * colbuts, "", 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)
- uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(a + len / 2 + b * colbuts));
+ uiButSetFunc(but, ui_layer_but_cb, but, SET_INT_IN_POINTER(layer_num));
}
uiBlockEndAlign(block);