summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_file_dialog.cpp3
-rw-r--r--editor/plugins/script_text_editor.cpp46
-rw-r--r--editor/plugins/spatial_editor_plugin.cpp6
3 files changed, 36 insertions, 19 deletions
diff --git a/editor/editor_file_dialog.cpp b/editor/editor_file_dialog.cpp
index 02a9cc905b..288874d36b 100644
--- a/editor/editor_file_dialog.cpp
+++ b/editor/editor_file_dialog.cpp
@@ -703,6 +703,9 @@ void EditorFileDialog::update_file_list() {
item_list->clear();
+ // Scroll back to the top after opening a directory
+ item_list->get_v_scroll()->set_value(0);
+
if (display_mode == DISPLAY_THUMBNAILS) {
item_list->set_max_columns(0);
diff --git a/editor/plugins/script_text_editor.cpp b/editor/plugins/script_text_editor.cpp
index 5bccb36252..603a2365c1 100644
--- a/editor/plugins/script_text_editor.cpp
+++ b/editor/plugins/script_text_editor.cpp
@@ -967,12 +967,17 @@ void ScriptTextEditor::_update_connected_methods() {
text_edit->clear_info_icons();
missing_connections.clear();
+ if (!script->is_valid()) {
+ return;
+ }
+
Node *base = get_tree()->get_edited_scene_root();
if (!base) {
return;
}
Vector<Node *> nodes = _find_all_node_for_script(base, base, script);
+ Set<StringName> methods_found;
for (int i = 0; i < nodes.size(); i++) {
List<Connection> connections;
nodes[i]->get_signals_connected_to_this(&connections);
@@ -989,28 +994,33 @@ void ScriptTextEditor::_update_connected_methods() {
continue;
}
+ if (methods_found.has(connection.method)) {
+ continue;
+ }
+
if (!ClassDB::has_method(script->get_instance_base_type(), connection.method)) {
+ int line = -1;
+ if (script->has_method(connection.method)) {
+ line = script->get_member_line(connection.method);
+ text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method);
+ methods_found.insert(connection.method);
+ continue;
+ }
- int line = script->get_language()->find_function(connection.method, text_edit->get_text());
- if (line < 0) {
- // There is a chance that the method is inherited from another script.
- bool found_inherited_function = false;
- Ref<Script> inherited_script = script->get_base_script();
- while (!inherited_script.is_null()) {
- line = inherited_script->get_language()->find_function(connection.method, inherited_script->get_source_code());
- if (line != -1) {
- found_inherited_function = true;
- break;
- }
-
- inherited_script = inherited_script->get_base_script();
+ // There is a chance that the method is inherited from another script.
+ bool found_inherited_function = false;
+ Ref<Script> inherited_script = script->get_base_script();
+ while (!inherited_script.is_null()) {
+ if (inherited_script->has_method(connection.method)) {
+ found_inherited_function = true;
+ break;
}
- if (!found_inherited_function) {
- missing_connections.push_back(connection);
- }
- } else {
- text_edit->set_line_info_icon(line - 1, get_parent_control()->get_icon("Slot", "EditorIcons"), connection.method);
+ inherited_script = inherited_script->get_base_script();
+ }
+
+ if (!found_inherited_function) {
+ missing_connections.push_back(connection);
}
}
}
diff --git a/editor/plugins/spatial_editor_plugin.cpp b/editor/plugins/spatial_editor_plugin.cpp
index 1d8fd38858..eb39496106 100644
--- a/editor/plugins/spatial_editor_plugin.cpp
+++ b/editor/plugins/spatial_editor_plugin.cpp
@@ -2760,6 +2760,7 @@ void SpatialEditorViewport::_menu_option(int p_option) {
void SpatialEditorViewport::_preview_exited_scene() {
+ preview_camera->disconnect("toggled", this, "_toggle_camera_preview");
preview_camera->set_pressed(false);
_toggle_camera_preview(false);
view_menu->show();
@@ -3031,6 +3032,9 @@ void SpatialEditorViewport::set_state(const Dictionary &p_state) {
view_menu->get_popup()->set_item_checked(idx, previewing_cinema);
}
+ if (preview_camera->is_connected("toggled", this, "_toggle_camera_preview")) {
+ preview_camera->disconnect("toggled", this, "_toggle_camera_preview");
+ }
if (p_state.has("previewing")) {
Node *pv = EditorNode::get_singleton()->get_edited_scene()->get_node(p_state["previewing"]);
if (Object::cast_to<Camera>(pv)) {
@@ -3043,6 +3047,7 @@ void SpatialEditorViewport::set_state(const Dictionary &p_state) {
preview_camera->show();
}
}
+ preview_camera->connect("toggled", this, "_toggle_camera_preview");
}
Dictionary SpatialEditorViewport::get_state() const {
@@ -3594,7 +3599,6 @@ SpatialEditorViewport::SpatialEditorViewport(SpatialEditor *p_spatial_editor, Ed
vbox->add_child(preview_camera);
preview_camera->set_h_size_flags(0);
preview_camera->hide();
- preview_camera->connect("toggled", this, "_toggle_camera_preview");
previewing = NULL;
gizmo_scale = 1.0;