From 667ef9917fa69cb45325badac357c98b505c8af2 Mon Sep 17 00:00:00 2001 From: Pablo Vazquez Date: Thu, 18 Jun 2020 17:00:05 +0200 Subject: UI: Place "New Collection" item above list in Move/Link to Collection menu This way "New Collection" is always assigned the same shortcut (N). Whereas previously it would be automatically assigned the leftover key from the list of available collections. Nice side effect is that since N is next to M in most keyboard layouts, moving to a new collection is super fast by hitting M then N. {F8630575, size=full} Paper-cut pointed out by DerekWatts on [devtalk](https://devtalk.blender.org/t/blender-ui-paper-cuts/2596/4211) (thanks!): {F8630492, size=full} Reviewed By: HooglyBoogly Differential Revision: https://developer.blender.org/D8067 --- source/blender/editors/object/object_edit.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'source/blender/editors/object') diff --git a/source/blender/editors/object/object_edit.c b/source/blender/editors/object/object_edit.c index d522dcabae3..90dd16ea393 100644 --- a/source/blender/editors/object/object_edit.c +++ b/source/blender/editors/object/object_edit.c @@ -1771,15 +1771,8 @@ static void move_to_collection_menu_create(bContext *UNUSED(C), uiLayout *layout const char *name = BKE_collection_ui_name_get(menu->collection); UI_block_flag_enable(uiLayoutGetBlock(layout), UI_BLOCK_IS_FLIP); - uiItemIntO(layout, name, ICON_NONE, menu->ot->idname, "collection_index", menu->index); - uiItemS(layout); - - for (MoveToCollectionData *submenu = menu->submenus.first; submenu != NULL; - submenu = submenu->next) { - move_to_collection_menus_items(layout, submenu); - } - uiItemS(layout); + // uiItemS(layout); WM_operator_properties_create_ptr(&menu->ptr, menu->ot); RNA_int_set(&menu->ptr, "collection_index", menu->index); @@ -1787,6 +1780,15 @@ static void move_to_collection_menu_create(bContext *UNUSED(C), uiLayout *layout uiItemFullO_ptr( layout, menu->ot, "New Collection", ICON_ADD, menu->ptr.data, WM_OP_INVOKE_DEFAULT, 0, NULL); + + uiItemS(layout); + + uiItemIntO(layout, name, ICON_SCENE_DATA, menu->ot->idname, "collection_index", menu->index); + + for (MoveToCollectionData *submenu = menu->submenus.first; submenu != NULL; + submenu = submenu->next) { + move_to_collection_menus_items(layout, submenu); + } } static void move_to_collection_menus_items(uiLayout *layout, MoveToCollectionData *menu) -- cgit v1.2.3