diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_inspector.cpp | 5 | ||||
-rw-r--r-- | editor/editor_quick_open.h | 2 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 17 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.cpp | 29 | ||||
-rw-r--r-- | editor/plugins/script_editor_plugin.h | 2 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 58 | ||||
-rw-r--r-- | editor/scene_tree_dock.h | 4 |
7 files changed, 16 insertions, 101 deletions
diff --git a/editor/editor_inspector.cpp b/editor/editor_inspector.cpp index e786461722..5de205153d 100644 --- a/editor/editor_inspector.cpp +++ b/editor/editor_inspector.cpp @@ -1143,11 +1143,10 @@ Control *EditorInspectorCategory::make_custom_tooltip(const String &p_text) cons } Size2 EditorInspectorCategory::get_minimum_size() const { - Ref<Font> font = get_theme_font(SNAME("font"), SNAME("Tree")); - int font_size = get_theme_font_size(SNAME("font_size"), SNAME("Tree")); + Ref<Font> font = get_theme_font(SNAME("bold"), SNAME("EditorFonts")); + int font_size = get_theme_font_size(SNAME("bold_size"), SNAME("EditorFonts")); Size2 ms; - ms.width = 1; ms.height = font->get_height(font_size); if (icon.is_valid()) { ms.height = MAX(icon->get_height(), ms.height); diff --git a/editor/editor_quick_open.h b/editor/editor_quick_open.h index 86a419b538..83cbbd7cac 100644 --- a/editor/editor_quick_open.h +++ b/editor/editor_quick_open.h @@ -43,7 +43,7 @@ class EditorQuickOpen : public ConfirmationDialog { Tree *search_options = nullptr; StringName base_type; bool allow_multi_select = false; - bool _load_resources = true; + bool _load_resources = false; // Prohibitively slow for now. Vector<String> files; OAHashMap<String, Ref<Texture2D>> icons; diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 19b4932d3d..424eab2f02 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1751,22 +1751,7 @@ void FileSystemDock::_tree_rmb_option(int p_option) { case FOLDER_COLLAPSE_ALL: { // Expand or collapse the folder if (selected_strings.size() == 1) { - bool is_collapsed = (p_option == FOLDER_COLLAPSE_ALL); - - Vector<TreeItem *> needs_check; - needs_check.push_back(tree->get_selected()); - - while (needs_check.size()) { - needs_check[0]->set_collapsed(is_collapsed); - - TreeItem *child = needs_check[0]->get_first_child(); - while (child) { - needs_check.push_back(child); - child = child->get_next(); - } - - needs_check.remove_at(0); - } + tree->get_selected()->set_collapsed_recursive(p_option == FOLDER_COLLAPSE_ALL); } } break; default: { diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 0a111aeb49..8791da8245 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -3059,26 +3059,15 @@ void ScriptEditor::shortcut_input(const Ref<InputEvent> &p_event) { } } -void ScriptEditor::_script_list_gui_input(const Ref<InputEvent> &ev) { - Ref<InputEventMouseButton> mb = ev; - if (mb.is_valid() && mb->is_pressed()) { - switch (mb->get_button_index()) { - case MouseButton::MIDDLE: { - // Right-click selects automatically; middle-click does not. - int idx = script_list->get_item_at_position(mb->get_position(), true); - if (idx >= 0) { - script_list->select(idx); - _script_selected(idx); - _menu_option(FILE_CLOSE); - } - } break; +void ScriptEditor::_script_list_clicked(int p_item, Vector2 p_local_mouse_pos, MouseButton p_mouse_button_index) { + if (p_mouse_button_index == MouseButton::MIDDLE) { + script_list->select(p_item); + _script_selected(p_item); + _menu_option(FILE_CLOSE); + } - case MouseButton::RIGHT: { - _make_script_list_context_menu(); - } break; - default: - break; - } + if (p_mouse_button_index == MouseButton::RIGHT) { + _make_script_list_context_menu(); } } @@ -3688,7 +3677,7 @@ ScriptEditor::ScriptEditor() { script_list->set_v_size_flags(SIZE_EXPAND_FILL); script_split->set_split_offset(70 * EDSCALE); _sort_list_on_update = true; - script_list->connect("gui_input", callable_mp(this, &ScriptEditor::_script_list_gui_input), CONNECT_DEFERRED); + script_list->connect("item_clicked", callable_mp(this, &ScriptEditor::_script_list_clicked), CONNECT_DEFERRED); script_list->set_allow_rmb_select(true); script_list->set_drag_forwarding(this); diff --git a/editor/plugins/script_editor_plugin.h b/editor/plugins/script_editor_plugin.h index a8e6cc6868..59191b8891 100644 --- a/editor/plugins/script_editor_plugin.h +++ b/editor/plugins/script_editor_plugin.h @@ -426,7 +426,7 @@ class ScriptEditor : public PanelContainer { virtual void input(const Ref<InputEvent> &p_event) override; virtual void shortcut_input(const Ref<InputEvent> &p_event) override; - void _script_list_gui_input(const Ref<InputEvent> &ev); + void _script_list_clicked(int p_item, Vector2 p_local_mouse_pos, MouseButton p_mouse_button_index); void _make_script_list_context_menu(); void _help_search(String p_text); diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index aefb2c78c1..d1dc188be9 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -441,8 +441,8 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } } - bool collapsed = _is_collapsed_recursive(selected_item); - _set_collapsed_recursive(selected_item, !collapsed); + bool collapsed = selected_item->is_any_collapsed(); + selected_item->set_collapsed_recursive(!collapsed); tree->ensure_cursor_is_visible(); @@ -1223,17 +1223,6 @@ void SceneTreeDock::add_root_node(Node *p_node) { editor_data->get_undo_redo()->commit_action(); } -void SceneTreeDock::_node_collapsed(Object *p_obj) { - TreeItem *ti = Object::cast_to<TreeItem>(p_obj); - if (!ti) { - return; - } - - if (Input::get_singleton()->is_key_pressed(Key::SHIFT)) { - _set_collapsed_recursive(ti, ti->is_collapsed()); - } -} - void SceneTreeDock::_notification(int p_what) { switch (p_what) { case NOTIFICATION_READY: { @@ -1945,48 +1934,6 @@ void SceneTreeDock::_do_reparent(Node *p_new_parent, int p_position_in_parent, V editor_data->get_undo_redo()->commit_action(); } -bool SceneTreeDock::_is_collapsed_recursive(TreeItem *p_item) const { - bool is_branch_collapsed = false; - - List<TreeItem *> needs_check; - needs_check.push_back(p_item); - - while (!needs_check.is_empty()) { - TreeItem *item = needs_check.back()->get(); - needs_check.pop_back(); - - TreeItem *child = item->get_first_child(); - is_branch_collapsed = item->is_collapsed() && child; - - if (is_branch_collapsed) { - break; - } - while (child) { - needs_check.push_back(child); - child = child->get_next(); - } - } - return is_branch_collapsed; -} - -void SceneTreeDock::_set_collapsed_recursive(TreeItem *p_item, bool p_collapsed) { - List<TreeItem *> to_collapse; - to_collapse.push_back(p_item); - - while (!to_collapse.is_empty()) { - TreeItem *item = to_collapse.back()->get(); - to_collapse.pop_back(); - - item->set_collapsed(p_collapsed); - - TreeItem *child = item->get_first_child(); - while (child) { - to_collapse.push_back(child); - child = child->get_next(); - } - } -} - void SceneTreeDock::_script_created(Ref<Script> p_script) { List<Node *> selected = editor_selection->get_selected_node_list(); @@ -3532,7 +3479,6 @@ SceneTreeDock::SceneTreeDock(Node *p_scene_root, EditorSelection *p_editor_selec scene_tree->connect("nodes_dragged", callable_mp(this, &SceneTreeDock::_nodes_drag_begin)); scene_tree->get_scene_tree()->connect("item_double_clicked", callable_mp(this, &SceneTreeDock::_focus_node)); - scene_tree->get_scene_tree()->connect("item_collapsed", callable_mp(this, &SceneTreeDock::_node_collapsed)); editor_selection->connect("selection_changed", callable_mp(this, &SceneTreeDock::_selection_changed)); diff --git a/editor/scene_tree_dock.h b/editor/scene_tree_dock.h index dc228e1c93..6b3ff884d3 100644 --- a/editor/scene_tree_dock.h +++ b/editor/scene_tree_dock.h @@ -137,7 +137,6 @@ class SceneTreeDock : public VBoxContainer { HBoxContainer *tool_hbc = nullptr; void _tool_selected(int p_tool, bool p_confirm_override = false); void _property_selected(int p_idx); - void _node_collapsed(Object *p_obj); Node *property_drop_node = nullptr; String resource_drop_path; @@ -188,9 +187,6 @@ class SceneTreeDock : public VBoxContainer { void _node_reparent(NodePath p_path, bool p_keep_global_xform); void _do_reparent(Node *p_new_parent, int p_position_in_parent, Vector<Node *> p_nodes, bool p_keep_global_xform); - bool _is_collapsed_recursive(TreeItem *p_item) const; - void _set_collapsed_recursive(TreeItem *p_item, bool p_collapsed); - void _set_owners(Node *p_owner, const Array &p_nodes); enum ReplaceOwnerMode { |