diff --git a/editor/animation_track_editor.cpp b/editor/animation_track_editor.cpp index bec95d40c6aa..99ba35a6d0f9 100644 --- a/editor/animation_track_editor.cpp +++ b/editor/animation_track_editor.cpp @@ -5006,17 +5006,12 @@ void AnimationTrackEditor::_new_track_node_selected(NodePath p_path) { } void AnimationTrackEditor::_add_track(int p_type) { - AnimationPlayer *ap = AnimationPlayerEditor::get_singleton()->get_player(); - if (!ap) { - ERR_FAIL_EDMSG("No AnimationPlayer is currently being edited."); - } - Node *root_node = ap->get_node_or_null(ap->get_root_node()); - if (!root_node) { + if (!root) { EditorNode::get_singleton()->show_warning(TTR("Not possible to add a new track without a root")); return; } adding_track_type = p_type; - pick_track->popup_scenetree_dialog(nullptr, root_node); + pick_track->popup_scenetree_dialog(); pick_track->get_filter_line_edit()->clear(); pick_track->get_filter_line_edit()->grab_focus(); } diff --git a/editor/connections_dialog.cpp b/editor/connections_dialog.cpp index 2db5b02d63be..22a3326fc515 100644 --- a/editor/connections_dialog.cpp +++ b/editor/connections_dialog.cpp @@ -616,7 +616,7 @@ void ConnectDialog::init(const ConnectionData &p_cd, const PackedStringArray &p_ signal_args = p_signal_args; tree->set_selected(nullptr); - tree->set_marked(source); + tree->set_marked(source, true); if (p_cd.target) { set_dst_node(static_cast(p_cd.target)); diff --git a/editor/editor_properties.cpp b/editor/editor_properties.cpp index c6a6163a4e04..b7380c9fc2d9 100644 --- a/editor/editor_properties.cpp +++ b/editor/editor_properties.cpp @@ -2751,15 +2751,7 @@ void EditorPropertyNodePath::_node_assign() { add_child(scene_tree); scene_tree->connect("selected", callable_mp(this, &EditorPropertyNodePath::_node_selected)); } - - Variant val = get_edited_property_value(); - Node *n = nullptr; - if (val.get_type() == Variant::Type::NODE_PATH) { - n = get_base_node()->get_node_or_null(val); - } else { - n = Object::cast_to(val); - } - scene_tree->popup_scenetree_dialog(n, get_base_node()); + scene_tree->popup_scenetree_dialog(); } void EditorPropertyNodePath::_update_menu() { @@ -3192,6 +3184,7 @@ void EditorPropertyResource::_resource_changed(const Ref &p_resource) add_child(scene_tree); scene_tree->connect("selected", callable_mp(this, &EditorPropertyResource::_viewport_selected)); } + scene_tree->popup_scenetree_dialog(); } } diff --git a/editor/gui/scene_tree_editor.cpp b/editor/gui/scene_tree_editor.cpp index 0dd75ea03351..835f95360392 100644 --- a/editor/gui/scene_tree_editor.cpp +++ b/editor/gui/scene_tree_editor.cpp @@ -925,27 +925,6 @@ void SceneTreeEditor::_notification(int p_what) { _update_tree(); } break; - - case NOTIFICATION_VISIBILITY_CHANGED: { - if (is_visible()) { - TreeItem *item = nullptr; - if (selected) { - // Scroll to selected node. - item = _find(tree->get_root(), selected->get_path()); - } else if (marked.size() == 1) { - // Scroll to a single marked node. - Node *marked_node = *marked.begin(); - if (marked_node) { - item = _find(tree->get_root(), marked_node->get_path()); - } - } - - if (item) { - // Must wait until tree is properly sized before scrolling. - callable_mp(tree, &Tree::scroll_to_item).call_deferred(item, true); - } - } - } break; } } @@ -1588,9 +1567,7 @@ SceneTreeEditor::~SceneTreeEditor() { /******** DIALOG *********/ -void SceneTreeDialog::popup_scenetree_dialog(Node *p_selected_node, Node *p_marked_node, bool p_marked_node_selectable, bool p_marked_node_children_selectable) { - get_scene_tree()->set_marked(p_marked_node, p_marked_node_selectable, p_marked_node_children_selectable); - get_scene_tree()->set_selected(p_selected_node); +void SceneTreeDialog::popup_scenetree_dialog() { popup_centered_clamped(Size2(350, 700) * EDSCALE); } diff --git a/editor/gui/scene_tree_editor.h b/editor/gui/scene_tree_editor.h index c1abdcef8b0c..a869e867b82d 100644 --- a/editor/gui/scene_tree_editor.h +++ b/editor/gui/scene_tree_editor.h @@ -157,8 +157,8 @@ class SceneTreeEditor : public Control { void set_as_scene_tree_dock(); void set_display_foreign_nodes(bool p_display); - void set_marked(const HashSet &p_marked, bool p_selectable = true, bool p_children_selectable = true); - void set_marked(Node *p_marked, bool p_selectable = true, bool p_children_selectable = true); + void set_marked(const HashSet &p_marked, bool p_selectable = false, bool p_children_selectable = true); + void set_marked(Node *p_marked, bool p_selectable = false, bool p_children_selectable = true); void set_selected(Node *p_node, bool p_emit_selected = true); Node *get_selected(); void set_can_rename(bool p_can_rename) { can_rename = p_can_rename; } @@ -201,7 +201,7 @@ class SceneTreeDialog : public ConfirmationDialog { static void _bind_methods(); public: - void popup_scenetree_dialog(Node *p_selected_node = nullptr, Node *p_marked_node = nullptr, bool p_marked_node_selectable = true, bool p_marked_node_children_selectable = true); + void popup_scenetree_dialog(); void set_valid_types(const Vector &p_valid); SceneTreeEditor *get_scene_tree() { return tree; } diff --git a/editor/plugins/cpu_particles_3d_editor_plugin.cpp b/editor/plugins/cpu_particles_3d_editor_plugin.cpp index b5e3f102cf92..bf427f733b1f 100644 --- a/editor/plugins/cpu_particles_3d_editor_plugin.cpp +++ b/editor/plugins/cpu_particles_3d_editor_plugin.cpp @@ -56,6 +56,7 @@ void CPUParticles3DEditor::_menu_option(int p_option) { switch (p_option) { case MENU_OPTION_CREATE_EMISSION_VOLUME_FROM_NODE: { emission_tree_dialog->popup_scenetree_dialog(); + } break; case MENU_OPTION_RESTART: { diff --git a/editor/plugins/multimesh_editor_plugin.cpp b/editor/plugins/multimesh_editor_plugin.cpp index 9fec263af3e8..086abc0859ad 100644 --- a/editor/plugins/multimesh_editor_plugin.cpp +++ b/editor/plugins/multimesh_editor_plugin.cpp @@ -255,15 +255,13 @@ void MultiMeshEditor::edit(MultiMeshInstance3D *p_multimesh) { void MultiMeshEditor::_browse(bool p_source) { browsing_source = p_source; - Node *browsed_node = nullptr; + std->get_scene_tree()->set_marked(node, false); + std->popup_scenetree_dialog(); if (p_source) { - browsed_node = node->get_node_or_null(mesh_source->get_text()); std->set_title(TTR("Select a Source Mesh:")); } else { - browsed_node = node->get_node_or_null(surface_source->get_text()); std->set_title(TTR("Select a Target Surface:")); } - std->popup_scenetree_dialog(browsed_node); } void MultiMeshEditor::_bind_methods() { diff --git a/editor/reparent_dialog.cpp b/editor/reparent_dialog.cpp index a139d180f041..ec5208b54922 100644 --- a/editor/reparent_dialog.cpp +++ b/editor/reparent_dialog.cpp @@ -60,7 +60,7 @@ void ReparentDialog::_reparent() { void ReparentDialog::set_current(const HashSet &p_selection) { tree->set_marked(p_selection, false, false); - tree->set_selected(nullptr); + //tree->set_selected(p_node->get_parent()); } void ReparentDialog::_bind_methods() { @@ -74,6 +74,7 @@ ReparentDialog::ReparentDialog() { VBoxContainer *vbc = memnew(VBoxContainer); add_child(vbc); + //set_child_rect(vbc); tree = memnew(SceneTreeEditor(false)); tree->set_show_enabled_subscene(true); @@ -85,6 +86,10 @@ ReparentDialog::ReparentDialog() { keep_transform->set_pressed(true); vbc->add_child(keep_transform); + //vbc->add_margin_child("Options:",node_only); + + //cancel->connect("pressed", this,"_cancel"); + set_ok_button_text(TTR("Reparent")); } diff --git a/modules/multiplayer/editor/replication_editor.cpp b/modules/multiplayer/editor/replication_editor.cpp index 6000e2b1d35a..58803124cfc6 100644 --- a/modules/multiplayer/editor/replication_editor.cpp +++ b/modules/multiplayer/editor/replication_editor.cpp @@ -131,7 +131,7 @@ void ReplicationEditor::_pick_new_property() { EditorNode::get_singleton()->show_warning(TTR("Not possible to add a new property to synchronize without a root.")); return; } - pick_node->popup_scenetree_dialog(nullptr, current); + pick_node->popup_scenetree_dialog(); pick_node->get_filter_line_edit()->clear(); pick_node->get_filter_line_edit()->grab_focus(); }