From 570cdc128f79e6acc4cfb37fa7d1606db9fac198 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 30 Sep 2021 16:30:55 +0200 Subject: [PATCH] Rename Node's `filename` property to `scene_file_path` for clarity --- doc/classes/Node.xml | 6 +- editor/debugger/script_editor_debugger.cpp | 2 +- editor/editor_data.cpp | 32 ++++---- editor/editor_node.cpp | 76 +++++++++---------- editor/editor_plugin.cpp | 6 +- editor/filesystem_dock.cpp | 6 +- editor/plugins/canvas_item_editor_plugin.cpp | 12 +-- ..._particles_collision_sdf_editor_plugin.cpp | 2 +- editor/plugins/lightmap_gi_editor_plugin.cpp | 4 +- editor/plugins/node_3d_editor_plugin.cpp | 8 +- .../occluder_instance_3d_editor_plugin.cpp | 4 +- editor/plugins/voxel_gi_editor_plugin.cpp | 2 +- editor/scene_tree_dock.cpp | 50 ++++++------ editor/scene_tree_editor.cpp | 8 +- .../editor_scene_exporter_gltf_plugin.cpp | 2 +- scene/main/node.cpp | 38 +++++----- scene/main/node.h | 6 +- scene/main/scene_tree.cpp | 2 +- scene/resources/packed_scene.cpp | 16 ++-- 19 files changed, 141 insertions(+), 141 deletions(-) diff --git a/doc/classes/Node.xml b/doc/classes/Node.xml index f5766c87c03..b4edcf49f4e 100644 --- a/doc/classes/Node.xml +++ b/doc/classes/Node.xml @@ -700,9 +700,6 @@ The override to the default [MultiplayerAPI]. Set to [code]null[/code] to use the default [SceneTree] one. - - If a scene is instantiated from a file, its topmost node contains the absolute file path from which it was loaded in [member filename] (e.g. [code]res://levels/1.tscn[/code]). Otherwise, [member filename] is set to an empty string. - The [MultiplayerAPI] instance associated with this node. Either the [member custom_multiplayer], or the default SceneTree one (if inside tree). @@ -719,6 +716,9 @@ The node's priority in the execution order of the enabled processing callbacks (i.e. [constant NOTIFICATION_PROCESS], [constant NOTIFICATION_PHYSICS_PROCESS] and their internal counterparts). Nodes whose process priority value is [i]lower[/i] will have their processing callbacks executed first. + + If a scene is instantiated from a file, its topmost node contains the absolute file path from which it was loaded in [member scene_file_path] (e.g. [code]res://levels/1.tscn[/code]). Otherwise, [member scene_file_path] is set to an empty string. + diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index d6650c33197..a312c161a8c 100644 --- a/editor/debugger/script_editor_debugger.cpp +++ b/editor/debugger/script_editor_debugger.cpp @@ -1238,7 +1238,7 @@ void ScriptEditorDebugger::update_live_edit_root() { Array msg; msg.push_back(np); if (editor->get_edited_scene()) { - msg.push_back(editor->get_edited_scene()->get_filename()); + msg.push_back(editor->get_edited_scene()->get_scene_file_path()); } else { msg.push_back(""); } diff --git a/editor/editor_data.cpp b/editor/editor_data.cpp index 5e50835ef29..225526da5b4 100644 --- a/editor/editor_data.cpp +++ b/editor/editor_data.cpp @@ -554,7 +554,7 @@ void EditorData::remove_scene(int p_idx) { ERR_FAIL_INDEX(p_idx, edited_scene.size()); if (edited_scene[p_idx].root) { for (int i = 0; i < editor_plugins.size(); i++) { - editor_plugins[i]->notify_scene_closed(edited_scene[p_idx].root->get_filename()); + editor_plugins[i]->notify_scene_closed(edited_scene[p_idx].root->get_scene_file_path()); } memdelete(edited_scene[p_idx].root); @@ -583,7 +583,7 @@ bool EditorData::_find_updated_instances(Node *p_root, Node *p_node, Set if (p_node == p_root) { ss = p_node->get_scene_inherited_state(); - } else if (p_node->get_filename() != String()) { + } else if (p_node->get_scene_file_path() != String()) { ss = p_node->get_scene_instance_state(); } @@ -643,12 +643,12 @@ bool EditorData::check_and_update_scene(int p_idx) { } } - new_scene->set_filename(edited_scene[p_idx].root->get_filename()); + new_scene->set_scene_file_path(edited_scene[p_idx].root->get_scene_file_path()); memdelete(edited_scene[p_idx].root); edited_scene.write[p_idx].root = new_scene; - if (new_scene->get_filename() != "") { - edited_scene.write[p_idx].path = new_scene->get_filename(); + if (new_scene->get_scene_file_path() != "") { + edited_scene.write[p_idx].path = new_scene->get_scene_file_path(); } edited_scene.write[p_idx].selection = new_selection; @@ -682,10 +682,10 @@ void EditorData::set_edited_scene_root(Node *p_root) { ERR_FAIL_INDEX(current_edited_scene, edited_scene.size()); edited_scene.write[current_edited_scene].root = p_root; if (p_root) { - if (p_root->get_filename() != "") { - edited_scene.write[current_edited_scene].path = p_root->get_filename(); + if (p_root->get_scene_file_path() != "") { + edited_scene.write[current_edited_scene].path = p_root->get_scene_file_path(); } else { - p_root->set_filename(edited_scene[current_edited_scene].path); + p_root->set_scene_file_path(edited_scene[current_edited_scene].path); } } @@ -764,7 +764,7 @@ Ref