From 70e529cfc86e815041168d943e527e70143d761d Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Thu, 6 Jul 2023 13:35:14 -0700 Subject: [PATCH 1/7] WIP: UI: Consistent Menu/Block/Popup Ordering All Content is shown in natural top-down order regardless of where it is initiated. --- Currently, Blender menus are what is called "directional", where menu items are sorted frop top-bottom or bottom-top based on the direction the menu open. It might be a nice time, with Blender 4.0, to remove this feature and have content that is always in a consistent order. We have a preference for this behavior but haven't exposed it to users. But I don't think that we should enable this preference. If we (re)introduce this preference, make it off by default now then on by default later, we will be stuck with this preference forever. But whether on or off the description of this preference will never make sense because of how inconsistent we are with changing the direction of various items. With "Directional" turned off then all dropdown and popup content will always have the same order. But now consider that "Directional" preference when off. Turning it ON will then mean that SOME content in some circumstances will reverse. So the 3D Viewport, in Object Mode, if you move the header to the bottom, of the four items in the center, just one of them - Transform Pivot Point - will reverse direction. Not sure how to explain that as an option. Another reason is that we can consider changing the order of menu items if we have one direction rather than two. The change to consistent order makes relatively small changes except for the Timeline menus. For those menus everyone is used to a particular order because that editor is generally at the bottom. If we change to consistent ordering then we could also consider changing the Timeline menus item order. RCS Suggestion: https://blender.community/c/rightclickselect/14vo --- source/blender/editors/include/UI_interface.h | 7 +-- source/blender/editors/interface/interface.cc | 57 +------------------ .../editors/interface/interface_handlers.cc | 9 ++- .../editors/interface/interface_layout.cc | 22 ------- .../interface/interface_region_menu_popup.cc | 21 +------ .../interface/interface_region_popover.cc | 5 -- .../interface/interface_region_popup.cc | 10 ---- .../editors/interface/interface_templates.cc | 2 +- source/blender/editors/object/object_edit.cc | 2 - .../editors/space_buttons/buttons_texture.cc | 2 - .../editors/space_node/node_templates.cc | 1 - source/blender/makesdna/DNA_userdef_types.h | 2 +- source/blender/makesrna/intern/rna_userdef.cc | 7 --- 13 files changed, 10 insertions(+), 137 deletions(-) diff --git a/source/blender/editors/include/UI_interface.h b/source/blender/editors/include/UI_interface.h index 5af6d47a677..b8cb459ae36 100644 --- a/source/blender/editors/include/UI_interface.h +++ b/source/blender/editors/include/UI_interface.h @@ -136,10 +136,8 @@ enum { /** #uiBlock.flag (controls) */ enum { UI_BLOCK_LOOP = 1 << 0, - /** Indicate that items in a popup are drawn with inverted order. Used for arrow key navigation - * so that it knows to invert the navigation direction to match the drawing order. */ - UI_BLOCK_IS_FLIP = 1 << 1, - UI_BLOCK_NO_FLIP = 1 << 2, + UI_BLOCK_UNUSED_1 = 1 << 1, + UI_BLOCK_UNUSED_2 = 1 << 2, UI_BLOCK_NUMSELECT = 1 << 3, /** Don't apply window clipping. */ UI_BLOCK_NO_WIN_CLIP = 1 << 4, @@ -874,7 +872,6 @@ void UI_block_direction_set(uiBlock *block, char direction); /** * This call escapes if there's alignment flags. */ -void UI_block_order_flip(uiBlock *block); void UI_block_flag_enable(uiBlock *block, int flag); void UI_block_flag_disable(uiBlock *block, int flag); void UI_block_translate(uiBlock *block, int x, int y); diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc index 334c745d196..790ab3aca7e 100644 --- a/source/blender/editors/interface/interface.cc +++ b/source/blender/editors/interface/interface.cc @@ -4318,7 +4318,6 @@ static void ui_def_but_rna__menu(bContext * /*C*/, uiLayout *layout, void *but_p if (!item->identifier[0]) { /* inconsistent, but menus with categories do not look good flipped */ if (item->name) { - block->flag |= UI_BLOCK_NO_FLIP; categories++; entries_nosepr_count++; } @@ -4350,7 +4349,7 @@ static void ui_def_but_rna__menu(bContext * /*C*/, uiLayout *layout, void *but_p const char *title = RNA_property_ui_name(but->rnaprop); - if (title[0] && (categories == 0) && (block->flag & UI_BLOCK_NO_FLIP)) { + if (title[0] && (categories == 0)) { /* Title at the top for menus with categories. */ uiDefBut(block, UI_BTYPE_LABEL, @@ -4475,32 +4474,11 @@ static void ui_def_but_rna__menu(bContext * /*C*/, uiLayout *layout, void *but_p } } - if (title[0] && (categories == 0) && !(block->flag & UI_BLOCK_NO_FLIP)) { - /* Title at the bottom for menus without categories. */ - uiItemS(layout); - uiDefBut(block, - UI_BTYPE_LABEL, - 0, - title, - 0, - 0, - UI_UNIT_X * 5, - UI_UNIT_Y, - nullptr, - 0.0, - 0.0, - 0, - 0, - ""); - } - UI_block_layout_set_current(block, layout); if (free) { MEM_freeN((void *)item_array); } - BLI_assert((block->flag & UI_BLOCK_IS_FLIP) == 0); - block->flag |= UI_BLOCK_IS_FLIP; } static void ui_def_but_rna__panel_type(bContext *C, uiLayout *layout, void *but_p) @@ -5847,39 +5825,6 @@ void UI_block_direction_set(uiBlock *block, char direction) block->direction = direction; } -void UI_block_order_flip(uiBlock *block) -{ - float centy, miny = 10000, maxy = -10000; - - if (U.uiflag & USER_MENUFIXEDORDER) { - return; - } - if (block->flag & UI_BLOCK_NO_FLIP) { - return; - } - - LISTBASE_FOREACH (uiBut *, but, &block->buttons) { - if (but->drawflag & UI_BUT_ALIGN) { - return; - } - if (but->rect.ymin < miny) { - miny = but->rect.ymin; - } - if (but->rect.ymax > maxy) { - maxy = but->rect.ymax; - } - } - /* mirror trick */ - centy = (miny + maxy) / 2.0f; - LISTBASE_FOREACH (uiBut *, but, &block->buttons) { - but->rect.ymin = centy - (but->rect.ymin - centy); - but->rect.ymax = centy - (but->rect.ymax - centy); - std::swap(but->rect.ymin, but->rect.ymax); - } - - block->flag ^= UI_BLOCK_IS_FLIP; -} - void UI_block_flag_enable(uiBlock *block, int flag) { block->flag |= flag; diff --git a/source/blender/editors/interface/interface_handlers.cc b/source/blender/editors/interface/interface_handlers.cc index 4b2418a327f..23ef85ee442 100644 --- a/source/blender/editors/interface/interface_handlers.cc +++ b/source/blender/editors/interface/interface_handlers.cc @@ -10463,19 +10463,18 @@ static int ui_handle_menu_event(bContext *C, if (val == KM_PRESS) { /* Determine scroll operation. */ uiMenuScrollType scrolltype; - const bool ui_block_flipped = (block->flag & UI_BLOCK_IS_FLIP) != 0; if (ELEM(type, EVT_PAGEUPKEY, EVT_HOMEKEY)) { - scrolltype = ui_block_flipped ? MENU_SCROLL_TOP : MENU_SCROLL_BOTTOM; + scrolltype = MENU_SCROLL_TOP; } else if (ELEM(type, EVT_PAGEDOWNKEY, EVT_ENDKEY)) { - scrolltype = ui_block_flipped ? MENU_SCROLL_BOTTOM : MENU_SCROLL_TOP; + scrolltype = MENU_SCROLL_BOTTOM; } else if (ELEM(type, EVT_UPARROWKEY, WHEELUPMOUSE)) { - scrolltype = ui_block_flipped ? MENU_SCROLL_UP : MENU_SCROLL_DOWN; + scrolltype = MENU_SCROLL_UP; } else { - scrolltype = ui_block_flipped ? MENU_SCROLL_DOWN : MENU_SCROLL_UP; + scrolltype = MENU_SCROLL_DOWN; } if (ui_menu_pass_event_to_parent_if_nonactive(menu, but, level, retval)) { diff --git a/source/blender/editors/interface/interface_layout.cc b/source/blender/editors/interface/interface_layout.cc index ed5bab78268..c3ea19fd797 100644 --- a/source/blender/editors/interface/interface_layout.cc +++ b/source/blender/editors/interface/interface_layout.cc @@ -1302,7 +1302,6 @@ static void ui_item_menu_hold(bContext *C, ARegion *butregion, uiBut *but) UI_popup_menu_but_set(pup, butregion, but); block->flag |= UI_BLOCK_POPUP_HOLD; - block->flag |= UI_BLOCK_IS_FLIP; char direction = UI_DIR_DOWN; if (!but->drawstr[0]) { @@ -1572,9 +1571,6 @@ void uiItemsFullEnumO_items(uiLayout *layout, if (item->name) { if (item != item_array && !radial && split != nullptr) { target = uiLayoutColumn(split, layout->align); - - /* inconsistent, but menus with labels do not look good flipped */ - block->flag |= UI_BLOCK_NO_FLIP; } uiBut *but; @@ -1677,9 +1673,6 @@ void uiItemsFullEnumO(uiLayout *layout, if (free) { MEM_freeN((void *)item_array); } - - /* intentionally don't touch UI_BLOCK_IS_FLIP here, - * we don't know the context this is called in */ } else if (prop && RNA_property_type(prop) != PROP_ENUM) { RNA_warning("%s.%s, not an enum type", RNA_struct_identifier(ptr.type), propname); @@ -2737,8 +2730,6 @@ void uiItemsEnumR(uiLayout *layout, PointerRNA *ptr, const char *propname) if (item[i].name) { if (i != 0) { column = uiLayoutColumn(split, false); - /* inconsistent, but menus with labels do not look good flipped */ - block->flag |= UI_BLOCK_NO_FLIP; } uiItemL(column, item[i].name, ICON_NONE); @@ -2756,9 +2747,6 @@ void uiItemsEnumR(uiLayout *layout, PointerRNA *ptr, const char *propname) if (free) { MEM_freeN((void *)item); } - - /* intentionally don't touch UI_BLOCK_IS_FLIP here, - * we don't know the context this is called in */ } /* Pointer RNA button with search */ @@ -2969,20 +2957,13 @@ void uiItemPointerR(uiLayout *layout, void ui_item_menutype_func(bContext *C, uiLayout *layout, void *arg_mt) { MenuType *mt = (MenuType *)arg_mt; - UI_menutype_draw(C, mt, layout); - - /* Menus are created flipped (from event handling point of view). */ - layout->root->block->flag ^= UI_BLOCK_IS_FLIP; } void ui_item_paneltype_func(bContext *C, uiLayout *layout, void *arg_pt) { PanelType *pt = (PanelType *)arg_pt; UI_paneltype_draw(C, pt, layout); - - /* Panels are created flipped (from event handling POV). */ - layout->root->block->flag ^= UI_BLOCK_IS_FLIP; } static uiBut *ui_item_menu(uiLayout *layout, @@ -3545,8 +3526,6 @@ static void menu_item_enum_opname_menu(bContext * /*C*/, uiLayout *layout, void uiLayoutSetOperatorContext(layout, lvl->opcontext); uiItemsFullEnumO(layout, lvl->opname, lvl->propname, op_props, lvl->opcontext, 0); - layout->root->block->flag |= UI_BLOCK_IS_FLIP; - /* override default, needed since this was assumed pre 2.70 */ UI_block_direction_set(layout->root->block, UI_DIR_DOWN); } @@ -3635,7 +3614,6 @@ static void menu_item_enum_rna_menu(bContext * /*C*/, uiLayout *layout, void *ar uiLayoutSetOperatorContext(layout, lvl->opcontext); uiItemsEnumR(layout, &lvl->rnapoin, lvl->propname); - layout->root->block->flag |= UI_BLOCK_IS_FLIP; } void uiItemMenuEnumR_prop( diff --git a/source/blender/editors/interface/interface_region_menu_popup.cc b/source/blender/editors/interface/interface_region_menu_popup.cc index 951419e216a..f90f20583fa 100644 --- a/source/blender/editors/interface/interface_region_menu_popup.cc +++ b/source/blender/editors/interface/interface_region_menu_popup.cc @@ -189,9 +189,7 @@ static void ui_popup_menu_create_block(bContext *C, const uiStyle *style = UI_style_get_dpi(); pup->block = UI_block_begin(C, nullptr, block_name, UI_EMBOSS_PULLDOWN); - if (!pup->but) { - pup->block->flag |= UI_BLOCK_NO_FLIP; - } + /* A title is only provided when a Menu has a label, this is not always the case, see e.g. * `VIEW3D_MT_edit_mesh_context_menu` -- this specifies its own label inside the draw function * depending on vertex/edge/face mode. We still want to flag the uiBlock (but only insert into @@ -361,7 +359,6 @@ static uiBlock *ui_block_func_POPUP(bContext *C, uiPopupBlockHandle *handle, voi if (RGN_TYPE_IS_HEADER_ANY(region->regiontype)) { if (RGN_ALIGN_ENUM_FROM_MASK(region->alignment) == RGN_ALIGN_BOTTOM) { UI_block_direction_set(block, UI_DIR_UP); - UI_block_order_flip(block); } } } @@ -409,20 +406,6 @@ static uiPopupBlockHandle *ui_popup_menu_create( pup->my = window->eventstate->xy[1]; pup->popup = true; } - /* some enums reversing is strange, currently we have no good way to - * reverse some enum's but not others, so reverse all so the first menu - * items are always close to the mouse cursor */ - else { -#if 0 - /* if this is an rna button then we can assume its an enum - * flipping enums is generally not good since the order can be - * important #28786. */ - if (but->rnaprop && RNA_property_type(but->rnaprop) == PROP_ENUM) { - pup->block->flag |= UI_BLOCK_NO_FLIP; - } -#endif - } - uiPopupBlockHandle *handle = ui_popup_block_create( C, butregion, but, nullptr, ui_block_func_POPUP, pup, ui_block_free_func_POPUP); @@ -493,8 +476,6 @@ uiPopupMenu *UI_popup_menu_begin_ex(bContext *C, pup->title = title; ui_popup_menu_create_block(C, pup, title, block_name); - /* Further buttons will be laid out top to bottom by default. */ - pup->block->flag |= UI_BLOCK_IS_FLIP; /* create in advance so we can let buttons point to retval already */ pup->block->handle = MEM_cnew(__func__); diff --git a/source/blender/editors/interface/interface_region_popover.cc b/source/blender/editors/interface/interface_region_popover.cc index 46d0154fd70..6c26cae930b 100644 --- a/source/blender/editors/interface/interface_region_popover.cc +++ b/source/blender/editors/interface/interface_region_popover.cc @@ -107,8 +107,6 @@ static void ui_popover_create_block(bContext *C, uiLayoutContextCopy(pup->layout, pup->but->context); } } - - pup->block->flag |= UI_BLOCK_NO_FLIP; } static uiBlock *ui_block_func_POPOVER(bContext *C, uiPopupBlockHandle *handle, void *arg_pup) @@ -415,9 +413,6 @@ void UI_popover_end(bContext *C, uiPopover *pup, wmKeyMap *keymap) * The begin/end stype of calling popups doesn't allow 'can_refresh' to be set. * For now close this style of popovers when accessed. */ UI_block_flag_disable(pup->block, UI_BLOCK_KEEP_OPEN); - - /* Panels are created flipped (from event handling POV). */ - pup->block->flag ^= UI_BLOCK_IS_FLIP; } uiLayout *UI_popover_layout(uiPopover *pup) diff --git a/source/blender/editors/interface/interface_region_popup.cc b/source/blender/editors/interface/interface_region_popup.cc index bf5cbfb1192..fb974b88811 100644 --- a/source/blender/editors/interface/interface_region_popup.cc +++ b/source/blender/editors/interface/interface_region_popup.cc @@ -253,11 +253,6 @@ static void ui_popup_block_position(wmWindow *window, else { offset_x = butrct.xmin - block->rect.xmin - center_x; } - /* changed direction? */ - if ((dir1 & block->direction) == 0) { - /* TODO: still do */ - UI_block_order_flip(block); - } } else if (dir1 == UI_DIR_DOWN) { offset_y = (butrct.ymin - block->rect.ymax) + offset_overlap; @@ -276,11 +271,6 @@ static void ui_popup_block_position(wmWindow *window, else { offset_x = butrct.xmin - block->rect.xmin - center_x; } - /* changed direction? */ - if ((dir1 & block->direction) == 0) { - /* TODO: still do */ - UI_block_order_flip(block); - } } /* Center over popovers for eg. */ diff --git a/source/blender/editors/interface/interface_templates.cc b/source/blender/editors/interface/interface_templates.cc index fdd7a3897a9..8389a68b411 100644 --- a/source/blender/editors/interface/interface_templates.cc +++ b/source/blender/editors/interface/interface_templates.cc @@ -3870,7 +3870,7 @@ static uiBlock *ui_icon_view_menu_cb(bContext *C, ARegion *region, void *arg_lit const int h = UI_UNIT_X * (args.icon_scale + args.show_labels); uiBlock *block = UI_block_begin(C, region, "_popup", UI_EMBOSS_PULLDOWN); - UI_block_flag_enable(block, UI_BLOCK_LOOP | UI_BLOCK_NO_FLIP); + UI_block_flag_enable(block, UI_BLOCK_LOOP); UI_block_theme_style_set(block, UI_BLOCK_THEME_STYLE_POPUP); bool free; diff --git a/source/blender/editors/object/object_edit.cc b/source/blender/editors/object/object_edit.cc index 11e752ad96e..369e96d105e 100644 --- a/source/blender/editors/object/object_edit.cc +++ b/source/blender/editors/object/object_edit.cc @@ -2061,8 +2061,6 @@ static void move_to_collection_menu_create(bContext *C, uiLayout *layout, void * MoveToCollectionData *menu = static_cast(menu_v); const char *name = BKE_collection_ui_name_get(menu->collection); - UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); - WM_operator_properties_create_ptr(&menu->ptr, menu->ot); RNA_int_set(&menu->ptr, "collection_index", menu->index); RNA_boolean_set(&menu->ptr, "is_new", true); diff --git a/source/blender/editors/space_buttons/buttons_texture.cc b/source/blender/editors/space_buttons/buttons_texture.cc index c4e93f2674e..c2f3660dcfc 100644 --- a/source/blender/editors/space_buttons/buttons_texture.cc +++ b/source/blender/editors/space_buttons/buttons_texture.cc @@ -537,8 +537,6 @@ static void template_texture_user_menu(bContext *C, uiLayout *layout, void * /*a last_category = user->category; } - - UI_block_flag_enable(block, UI_BLOCK_NO_FLIP); } void uiTemplateTextureUser(uiLayout *layout, bContext *C) diff --git a/source/blender/editors/space_node/node_templates.cc b/source/blender/editors/space_node/node_templates.cc index ffde75c345b..29c054d5a12 100644 --- a/source/blender/editors/space_node/node_templates.cc +++ b/source/blender/editors/space_node/node_templates.cc @@ -657,7 +657,6 @@ static void ui_template_node_link_menu(bContext *C, uiLayout *layout, void *but_ bNodeSocket *sock = arg->sock; bNodeTreeType *ntreetype = arg->ntree->typeinfo; - UI_block_flag_enable(block, UI_BLOCK_NO_FLIP | UI_BLOCK_IS_FLIP); UI_block_layout_set_current(block, layout); split = uiLayoutSplit(layout, 0.0f, false); diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 6841ede11ae..7134fccd198 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -1151,7 +1151,7 @@ typedef enum eUserpref_UI_Flag { USER_ZOOM_TO_MOUSEPOS = (1 << 20), USER_SHOW_FPS = (1 << 21), USER_REGISTER_ALL_USERS = (1 << 22), - USER_MENUFIXEDORDER = (1 << 23), + USER_UIFLAG_UNUSED_23 = (1 << 23), USER_CONTINUOUS_MOUSE = (1 << 24), USER_ZOOM_INVERT = (1 << 25), USER_ZOOM_HORIZ = (1 << 26), /* for CONTINUE and DOLLY zoom */ diff --git a/source/blender/makesrna/intern/rna_userdef.cc b/source/blender/makesrna/intern/rna_userdef.cc index 9673eb1d014..365637141dd 100644 --- a/source/blender/makesrna/intern/rna_userdef.cc +++ b/source/blender/makesrna/intern/rna_userdef.cc @@ -4808,13 +4808,6 @@ static void rna_def_userdef_view(BlenderRNA *brna) RNA_def_property_boolean_sdna(prop, nullptr, "uiflag", USER_PLAINMENUS); RNA_def_property_ui_text(prop, "Toolbox Column Layout", "Use a column layout for toolbox"); - prop = RNA_def_property(srna, "use_directional_menus", PROP_BOOLEAN, PROP_NONE); - RNA_def_property_boolean_negative_sdna(prop, nullptr, "uiflag", USER_MENUFIXEDORDER); - RNA_def_property_ui_text(prop, - "Contents Follow Opening Direction", - "Otherwise menus, etc will always be top to bottom, left to right, " - "no matter opening direction"); - static const EnumPropertyItem header_align_items[] = { {0, "NONE", 0, "Keep Existing", "Keep existing header alignment"}, {USER_HEADER_FROM_PREF, "TOP", 0, "Top", "Top aligned on load"}, -- 2.30.2 From fe2be87c4ebc210dfc8651826cf3088832e4f7df Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Wed, 23 Aug 2023 17:07:24 -0700 Subject: [PATCH 2/7] Updated to the current state of main. --- source/blender/editors/interface/interface_templates.cc | 2 -- source/blender/editors/screen/workspace_edit.cc | 2 -- .../intern/MOD_gpencil_legacy_ui_common.cc | 2 -- source/blender/modifiers/intern/MOD_ui_common.cc | 2 -- source/blender/shader_fx/intern/FX_ui_common.cc | 2 -- 5 files changed, 10 deletions(-) diff --git a/source/blender/editors/interface/interface_templates.cc b/source/blender/editors/interface/interface_templates.cc index d4e3bf24fdc..292202aa2db 100644 --- a/source/blender/editors/interface/interface_templates.cc +++ b/source/blender/editors/interface/interface_templates.cc @@ -2986,8 +2986,6 @@ static void constraint_ops_extra_draw(bContext *C, uiLayout *layout, void *con_v uiLayoutSetUnitsX(layout, 4.0f); - UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); - /* Apply. */ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), diff --git a/source/blender/editors/screen/workspace_edit.cc b/source/blender/editors/screen/workspace_edit.cc index 9a2e9a238f8..792c52f7839 100644 --- a/source/blender/editors/screen/workspace_edit.cc +++ b/source/blender/editors/screen/workspace_edit.cc @@ -473,8 +473,6 @@ static void workspace_add_menu(bContext * /*C*/, uiLayout *layout, void *templat WorkspaceConfigFileData *startup_config = workspace_config_file_read(app_template); WorkspaceConfigFileData *builtin_config = workspace_system_file_read(app_template); - UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); - if (startup_config) { LISTBASE_FOREACH (WorkSpace *, workspace, &startup_config->workspaces) { uiLayout *row = uiLayoutRow(layout, false); diff --git a/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc b/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc index 60a452dbbcd..614f4d1fa42 100644 --- a/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc +++ b/source/blender/gpencil_modifiers_legacy/intern/MOD_gpencil_legacy_ui_common.cc @@ -240,8 +240,6 @@ static void gpencil_modifier_ops_extra_draw(bContext *C, uiLayout *layout, void uiLayoutSetUnitsX(layout, 4.0f); - UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); - /* Apply. */ if (!(mti->flags & eGpencilModifierTypeFlag_NoApply)) { uiItemO(layout, diff --git a/source/blender/modifiers/intern/MOD_ui_common.cc b/source/blender/modifiers/intern/MOD_ui_common.cc index 3d0406cd3a9..69167120613 100644 --- a/source/blender/modifiers/intern/MOD_ui_common.cc +++ b/source/blender/modifiers/intern/MOD_ui_common.cc @@ -206,8 +206,6 @@ static void modifier_ops_extra_draw(bContext *C, uiLayout *layout, void *md_v) uiLayoutSetUnitsX(layout, 4.0f); - UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); - /* Apply. */ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Apply"), diff --git a/source/blender/shader_fx/intern/FX_ui_common.cc b/source/blender/shader_fx/intern/FX_ui_common.cc index 09ad4817043..d949c57a947 100644 --- a/source/blender/shader_fx/intern/FX_ui_common.cc +++ b/source/blender/shader_fx/intern/FX_ui_common.cc @@ -122,8 +122,6 @@ static void gpencil_shaderfx_ops_extra_draw(bContext *C, uiLayout *layout, void uiLayoutSetUnitsX(layout, 4.0f); - UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); - /* Duplicate. */ uiItemO(layout, CTX_IFACE_(BLT_I18NCONTEXT_OPERATOR_DEFAULT, "Duplicate"), -- 2.30.2 From 01dada9447dcefa818a44e9eb51b41a96e0a4fb1 Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Thu, 24 Aug 2023 19:24:02 -0700 Subject: [PATCH 3/7] Only show enum list titles if the button has an icon and blank text. --- source/blender/editors/interface/interface.cc | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc index 625e96aabd9..ad5c29e2c08 100644 --- a/source/blender/editors/interface/interface.cc +++ b/source/blender/editors/interface/interface.cc @@ -4291,6 +4291,9 @@ static void ui_def_but_rna__menu(bContext * /*C*/, uiLayout *layout, void *but_p uiPopupBlockHandle *handle = block->handle; uiBut *but = (uiBut *)but_p; + /* Show title if the calling button has icon and blank text. */ + const bool show_title = but->icon && !but->str[0]; + /* see comment in ui_item_enum_expand, re: `uiname`. */ const EnumPropertyItem *item_array; @@ -4346,7 +4349,7 @@ static void ui_def_but_rna__menu(bContext * /*C*/, uiLayout *layout, void *but_p const char *title = RNA_property_ui_name(but->rnaprop); - if (title[0] && (categories == 0)) { + if (show_title && title[0] && (categories == 0)) { /* Title at the top for menus with categories. */ uiDefBut(block, UI_BTYPE_LABEL, -- 2.30.2 From a1aed321b5375a41bfd2b541a0b9f4f85501b9ab Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Fri, 25 Aug 2023 08:30:20 -0700 Subject: [PATCH 4/7] Show titles when button has blank text, regardless of icon --- source/blender/editors/interface/interface.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/source/blender/editors/interface/interface.cc b/source/blender/editors/interface/interface.cc index ad5c29e2c08..49be90f0c5c 100644 --- a/source/blender/editors/interface/interface.cc +++ b/source/blender/editors/interface/interface.cc @@ -4291,9 +4291,6 @@ static void ui_def_but_rna__menu(bContext * /*C*/, uiLayout *layout, void *but_p uiPopupBlockHandle *handle = block->handle; uiBut *but = (uiBut *)but_p; - /* Show title if the calling button has icon and blank text. */ - const bool show_title = but->icon && !but->str[0]; - /* see comment in ui_item_enum_expand, re: `uiname`. */ const EnumPropertyItem *item_array; @@ -4349,8 +4346,8 @@ static void ui_def_but_rna__menu(bContext * /*C*/, uiLayout *layout, void *but_p const char *title = RNA_property_ui_name(but->rnaprop); - if (show_title && title[0] && (categories == 0)) { - /* Title at the top for menus with categories. */ + if (title[0] && !but->str[0] && (categories == 0)) { + /* Show title when no categories and calling button has no text. */ uiDefBut(block, UI_BTYPE_LABEL, 0, -- 2.30.2 From 026fdd7d7a30e1b7ba91272c33fde341b04fcd25 Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Tue, 29 Aug 2023 15:55:00 -0700 Subject: [PATCH 5/7] Julian said I can just delete these UI_interface_c.hh enums --- source/blender/editors/include/UI_interface_c.hh | 2 -- 1 file changed, 2 deletions(-) diff --git a/source/blender/editors/include/UI_interface_c.hh b/source/blender/editors/include/UI_interface_c.hh index 2bc89d2a102..008e4876f6f 100644 --- a/source/blender/editors/include/UI_interface_c.hh +++ b/source/blender/editors/include/UI_interface_c.hh @@ -145,8 +145,6 @@ enum { /** #uiBlock.flag (controls) */ enum { UI_BLOCK_LOOP = 1 << 0, - UI_BLOCK_UNUSED_1 = 1 << 1, - UI_BLOCK_UNUSED_2 = 1 << 2, UI_BLOCK_NUMSELECT = 1 << 3, /** Don't apply window clipping. */ UI_BLOCK_NO_WIN_CLIP = 1 << 4, -- 2.30.2 From 1b721e272bf0f428199a4c235dbd0ef1c2b53233 Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Wed, 30 Aug 2023 08:49:54 -0700 Subject: [PATCH 6/7] Updated to incorporate changes suggested by review. --- .../blenloader/intern/versioning_userdef.cc | 4 ++++ .../blender/editors/include/UI_interface_c.hh | 22 +++++++++---------- source/blender/makesdna/DNA_userdef_types.h | 2 +- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/source/blender/blenloader/intern/versioning_userdef.cc b/source/blender/blenloader/intern/versioning_userdef.cc index edeacf743a1..6bb4ff62686 100644 --- a/source/blender/blenloader/intern/versioning_userdef.cc +++ b/source/blender/blenloader/intern/versioning_userdef.cc @@ -860,6 +860,10 @@ void blo_do_versions_userdef(UserDef *userdef) userdef->uiflag |= USER_NODE_AUTO_OFFSET; } + if (!USER_VERSION_ATLEAST(400, 20)) { + userdef->uiflag &= ~USER_MENUFIXEDORDER_DEPRECATED; + } + /** * Versioning code until next subversion bump goes here. * diff --git a/source/blender/editors/include/UI_interface_c.hh b/source/blender/editors/include/UI_interface_c.hh index 07f59dd25f4..539382df1ae 100644 --- a/source/blender/editors/include/UI_interface_c.hh +++ b/source/blender/editors/include/UI_interface_c.hh @@ -145,19 +145,19 @@ enum { /** #uiBlock.flag (controls) */ enum { UI_BLOCK_LOOP = 1 << 0, - UI_BLOCK_NUMSELECT = 1 << 3, + UI_BLOCK_NUMSELECT = 1 << 1, /** Don't apply window clipping. */ - UI_BLOCK_NO_WIN_CLIP = 1 << 4, - UI_BLOCK_CLIPBOTTOM = 1 << 5, - UI_BLOCK_CLIPTOP = 1 << 6, - UI_BLOCK_MOVEMOUSE_QUIT = 1 << 7, - UI_BLOCK_KEEP_OPEN = 1 << 8, - UI_BLOCK_POPUP = 1 << 9, - UI_BLOCK_OUT_1 = 1 << 10, - UI_BLOCK_SEARCH_MENU = 1 << 11, - UI_BLOCK_POPUP_MEMORY = 1 << 12, + UI_BLOCK_NO_WIN_CLIP = 1 << 2, + UI_BLOCK_CLIPBOTTOM = 1 << 3, + UI_BLOCK_CLIPTOP = 1 << 4, + UI_BLOCK_MOVEMOUSE_QUIT = 1 << 5, + UI_BLOCK_KEEP_OPEN = 1 << 6, + UI_BLOCK_POPUP = 1 << 7, + UI_BLOCK_OUT_1 = 1 << 8, + UI_BLOCK_SEARCH_MENU = 1 << 9, + UI_BLOCK_POPUP_MEMORY = 1 << 10, /** Stop handling mouse events. */ - UI_BLOCK_CLIP_EVENTS = 1 << 13, + UI_BLOCK_CLIP_EVENTS = 1 << 11, /* #uiBlock::flags bits 14-17 are identical to #uiBut::drawflag bits. */ diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index 919d60e91b4..cc12ba29344 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -1197,7 +1197,7 @@ typedef enum eUserpref_UI_Flag { USER_ZOOM_TO_MOUSEPOS = (1 << 20), USER_SHOW_FPS = (1 << 21), USER_REGISTER_ALL_USERS = (1 << 22), - USER_UIFLAG_UNUSED_23 = (1 << 23), + USER_MENUFIXEDORDER_DEPRECATED = (1 << 23), /* Deprecated in 4.0. */ USER_CONTINUOUS_MOUSE = (1 << 24), USER_ZOOM_INVERT = (1 << 25), USER_ZOOM_HORIZ = (1 << 26), /* for CONTINUE and DOLLY zoom */ -- 2.30.2 From 0de316c37bf97c5e94c6828beec0cc733558e7c1 Mon Sep 17 00:00:00 2001 From: Harley Acheson Date: Wed, 30 Aug 2023 13:28:50 -0700 Subject: [PATCH 7/7] Changes requested by review. --- source/blender/blenloader/intern/versioning_userdef.cc | 7 +++---- source/blender/makesdna/DNA_userdef_types.h | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/source/blender/blenloader/intern/versioning_userdef.cc b/source/blender/blenloader/intern/versioning_userdef.cc index 6bb4ff62686..55b24b936aa 100644 --- a/source/blender/blenloader/intern/versioning_userdef.cc +++ b/source/blender/blenloader/intern/versioning_userdef.cc @@ -860,10 +860,6 @@ void blo_do_versions_userdef(UserDef *userdef) userdef->uiflag |= USER_NODE_AUTO_OFFSET; } - if (!USER_VERSION_ATLEAST(400, 20)) { - userdef->uiflag &= ~USER_MENUFIXEDORDER_DEPRECATED; - } - /** * Versioning code until next subversion bump goes here. * @@ -875,6 +871,9 @@ void blo_do_versions_userdef(UserDef *userdef) */ { /* Keep this block, even when empty. */ + + /* Clear deprecated USER_MENUFIXEDORDER user flag for reuse. */ + userdef->uiflag &= ~USER_UIFLAG_UNUSED_4; } LISTBASE_FOREACH (bTheme *, btheme, &userdef->themes) { diff --git a/source/blender/makesdna/DNA_userdef_types.h b/source/blender/makesdna/DNA_userdef_types.h index cc12ba29344..a07a04112aa 100644 --- a/source/blender/makesdna/DNA_userdef_types.h +++ b/source/blender/makesdna/DNA_userdef_types.h @@ -1197,7 +1197,7 @@ typedef enum eUserpref_UI_Flag { USER_ZOOM_TO_MOUSEPOS = (1 << 20), USER_SHOW_FPS = (1 << 21), USER_REGISTER_ALL_USERS = (1 << 22), - USER_MENUFIXEDORDER_DEPRECATED = (1 << 23), /* Deprecated in 4.0. */ + USER_UIFLAG_UNUSED_4 = (1 << 23), /* Cleared. */ USER_CONTINUOUS_MOUSE = (1 << 24), USER_ZOOM_INVERT = (1 << 25), USER_ZOOM_HORIZ = (1 << 26), /* for CONTINUE and DOLLY zoom */ -- 2.30.2