[Bf-blender-cvs] [749fbe2] temp_pie_max_items_fix: Don't add new pie level for single item
Julian Eisel
noreply at git.blender.org
Tue Feb 16 00:17:06 CET 2016
Commit: 749fbe2bfe5e1a9537c0fd3016dc9e77e81373ff
Author: Julian Eisel
Date: Tue Feb 16 00:15:54 2016 +0100
Branches: temp_pie_max_items_fix
https://developer.blender.org/rB749fbe2bfe5e1a9537c0fd3016dc9e77e81373ff
Don't add new pie level for single item
===================================================================
M source/blender/editors/interface/interface_layout.c
===================================================================
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c
index 501be46..e76fcfd 100644
--- a/source/blender/editors/interface/interface_layout.c
+++ b/source/blender/editors/interface/interface_layout.c
@@ -909,7 +909,6 @@ void uiItemsFullEnumO_items(
const EnumPropertyItem *item;
uiBlock *block = layout->root->block;
const bool radial = ui_layout_is_radial(layout);
- int i;
if (radial) {
target = uiLayoutRadial(layout);
@@ -919,16 +918,34 @@ void uiItemsFullEnumO_items(
target = uiLayoutColumn(split, layout->align);
}
- for (i = 1, item = item_array; item->identifier; i++, item++) {
+
+ int i;
+ bool last_iter = false;
+
+ for (i = 1, item = item_array; item->identifier && !last_iter; i++, item++) {
/* handle oversized pies */
if (radial && (totitem > PIE_MAX_ITEMS) && (i >= PIE_MAX_ITEMS)) {
- /* only create a new pie level if there's a visible item for it */
- if (item->name) {
- ui_pie_menu_level_create(block, ot, propname, properties, item_array, totitem, context, flag);
- /* break since rest of items is handled in new pie level */
- break;
+ if (item->name) { /* only visible items */
+ const EnumPropertyItem *tmp;
+
+ /* Check if there are more visible items for the next level. If not, we don't
+ * add a new level and add the remaining item instead of the 'more' button. */
+ for (tmp = item + 1; tmp->identifier; tmp++)
+ if (tmp->name)
+ break;
+
+ if (tmp->identifier) { /* only true if loop above found item and did early-exit */
+ ui_pie_menu_level_create(block, ot, propname, properties, item_array, totitem, context, flag);
+ /* break since rest of items is handled in new pie level */
+ break;
+ }
+ else {
+ last_iter = true;
+ }
+ }
+ else {
+ continue;
}
- continue;
}
if (item->identifier[0]) {
More information about the Bf-blender-cvs
mailing list