From 92299989bd10fd9855b6d77bc2bfabae218d1eea Mon Sep 17 00:00:00 2001 From: Rémi Verschelde Date: Mon, 26 Jul 2021 17:50:35 +0200 Subject: Use Ref references as iterators where relevant And const when possible. --- editor/editor_node.cpp | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) (limited to 'editor/editor_node.cpp') diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 267854d7ec..46d76a946f 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -797,8 +797,8 @@ void EditorNode::_resources_changed(const Vector &p_resources) { } if (changed.size()) { - for (Ref E : changed) { - E->reload_from_file(); + for (Ref &res : changed) { + res->reload_from_file(); } } } @@ -1551,7 +1551,7 @@ int EditorNode::_save_external_resources() { int saved = 0; List> cached; ResourceCache::get_cached_resources(&cached); - for (Ref res : cached) { + for (const Ref &res : cached) { if (!res->get_path().is_resource_file()) { continue; } @@ -1641,7 +1641,7 @@ void EditorNode::_save_scene(String p_file, int idx) { editor_data.save_editor_external_data(); - for (Ref E : anim_backups) { + for (Ref &E : anim_backups) { E->restore(); } @@ -5333,27 +5333,6 @@ void EditorNode::_file_access_close_error_notify(const String &p_str) { } void EditorNode::reload_scene(const String &p_path) { - /* - * No longer necessary since scenes now reset and reload their internal resource if needed. - //first of all, reload internal textures, materials, meshes, etc. as they might have changed on disk - - List> cached; - ResourceCache::get_cached_resources(&cached); - List> to_clear; //clear internal resources from previous scene from being used - for (Ref E : cached) { - if (E->get_path().begins_with(p_path + "::")) { //subresources of existing scene - to_clear.push_back(E); - } - } - - //so reload reloads everything, clear subresources of previous scene - while (to_clear.front()) { - to_clear.front()->get()->set_path(""); - to_clear.pop_front(); - } - - */ - int scene_idx = -1; for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { if (editor_data.get_scene_path(i) == p_path) { -- cgit v1.2.3