From a5b9f9f1ed0ae64d0c18a5ae13040d0e96e81645 Mon Sep 17 00:00:00 2001 From: fire540 Date: Fri, 21 Jan 2022 11:43:03 -0600 Subject: [PATCH] [3.x] Fix Create Root Node dialog expanding in favorites tab --- editor/scene_tree_dock.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 74f714d3d71..2d8758e02d2 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -1265,8 +1265,16 @@ void SceneTreeDock::_notification(int p_what) { create_root_dialog->add_child(top_row); + ScrollContainer *scroll_container = memnew(ScrollContainer); + scroll_container->set_name("NodeShortcutsScrollContainer"); + create_root_dialog->add_child(scroll_container); + scroll_container->set_v_size_flags(SIZE_EXPAND_FILL); + scroll_container->set_enable_h_scroll(false); + VBoxContainer *node_shortcuts = memnew(VBoxContainer); node_shortcuts->set_name("NodeShortcuts"); + scroll_container->add_child(node_shortcuts); + node_shortcuts->set_h_size_flags(SIZE_EXPAND_FILL); VBoxContainer *beginner_node_shortcuts = memnew(VBoxContainer); beginner_node_shortcuts->set_name("BeginnerNodeShortcuts"); @@ -1299,8 +1307,6 @@ void SceneTreeDock::_notification(int p_what) { button_custom->set_icon(get_icon("Add", "EditorIcons")); button_custom->connect("pressed", this, "_tool_selected", make_binds(TOOL_NEW, false)); - node_shortcuts->add_spacer(); - create_root_dialog->add_child(node_shortcuts); _update_create_root_dialog(); } break; @@ -3011,7 +3017,7 @@ void SceneTreeDock::_local_tree_selected() { void SceneTreeDock::_update_create_root_dialog() { BaseButton *toggle = Object::cast_to(create_root_dialog->get_node(String("NodeShortcutsTopRow/NodeShortcutsToggle"))); - Node *node_shortcuts = create_root_dialog->get_node(String("NodeShortcuts")); + Node *node_shortcuts = create_root_dialog->get_node(String("NodeShortcutsScrollContainer/NodeShortcuts")); if (!toggle || !node_shortcuts) { return; @@ -3041,6 +3047,7 @@ void SceneTreeDock::_update_create_root_dialog() { Button *button = memnew(Button); favorite_nodes->add_child(button); button->set_text(TTR(l)); + button->set_clip_text(true); String name = l.get_slicec(' ', 0); if (ScriptServer::is_global_class(name)) { name = ScriptServer::get_global_class_native_base(name); @@ -3310,6 +3317,7 @@ SceneTreeDock::SceneTreeDock(EditorNode *p_editor, Node *p_scene_root, EditorSel create_root_dialog = memnew(VBoxContainer); vbc->add_child(create_root_dialog); + create_root_dialog->set_v_size_flags(SIZE_EXPAND_FILL); create_root_dialog->hide(); scene_tree = memnew(SceneTreeEditor(false, true, true));