diff options
author | Joshua Leung <aligorith@gmail.com> | 2013-11-18 06:53:46 +0400 |
---|---|---|
committer | Joshua Leung <aligorith@gmail.com> | 2013-11-18 06:53:46 +0400 |
commit | 0ff70d942fa6a27ef416e59199a5c5590307dba2 (patch) | |
tree | d18b021d315b285dc2a31f4bd0ac42b2776d290c /source/blender/editors/interface/interface_layout.c | |
parent | cee7fbdfaa647dd05a49b8450227b8c9a12e80a0 (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.c | 18 |
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); |