diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/debugger/script_editor_debugger.cpp | 2 | ||||
-rw-r--r-- | editor/editor_data.cpp | 32 | ||||
-rw-r--r-- | editor/editor_node.cpp | 76 | ||||
-rw-r--r-- | editor/editor_plugin.cpp | 6 | ||||
-rw-r--r-- | editor/filesystem_dock.cpp | 6 | ||||
-rw-r--r-- | editor/plugins/canvas_item_editor_plugin.cpp | 12 | ||||
-rw-r--r-- | editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/plugins/lightmap_gi_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/node_3d_editor_plugin.cpp | 8 | ||||
-rw-r--r-- | editor/plugins/occluder_instance_3d_editor_plugin.cpp | 4 | ||||
-rw-r--r-- | editor/plugins/voxel_gi_editor_plugin.cpp | 2 | ||||
-rw-r--r-- | editor/scene_tree_dock.cpp | 50 | ||||
-rw-r--r-- | editor/scene_tree_editor.cpp | 8 |
13 files changed, 106 insertions, 106 deletions
diff --git a/editor/debugger/script_editor_debugger.cpp b/editor/debugger/script_editor_debugger.cpp index d6650c3319..a312c161a8 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 5e50835ef2..225526da5b 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<String> 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<Script> EditorData::get_scene_root_script(int p_idx) const { Ref<Script> s = edited_scene[p_idx].root->get_script(); if (!s.is_valid() && edited_scene[p_idx].root->get_child_count()) { Node *n = edited_scene[p_idx].root->get_child(0); - while (!s.is_valid() && n && n->get_filename() == String()) { + while (!s.is_valid() && n && n->get_scene_file_path() == String()) { s = n->get_script(); n = n->get_parent(); } @@ -777,11 +777,11 @@ String EditorData::get_scene_title(int p_idx, bool p_always_strip_extension) con if (!edited_scene[p_idx].root) { return TTR("[empty]"); } - if (edited_scene[p_idx].root->get_filename() == "") { + if (edited_scene[p_idx].root->get_scene_file_path() == "") { return TTR("[unsaved]"); } - const String filename = edited_scene[p_idx].root->get_filename().get_file(); + const String filename = edited_scene[p_idx].root->get_scene_file_path().get_file(); const String basename = filename.get_basename(); if (p_always_strip_extension) { @@ -795,7 +795,7 @@ String EditorData::get_scene_title(int p_idx, bool p_always_strip_extension) con continue; } - if (edited_scene[i].root && basename == edited_scene[i].root->get_filename().get_file().get_basename()) { + if (edited_scene[i].root && basename == edited_scene[i].root->get_scene_file_path().get_file().get_basename()) { return filename; } } @@ -811,17 +811,17 @@ void EditorData::set_scene_path(int p_idx, const String &p_path) { if (!edited_scene[p_idx].root) { return; } - edited_scene[p_idx].root->set_filename(p_path); + edited_scene[p_idx].root->set_scene_file_path(p_path); } String EditorData::get_scene_path(int p_idx) const { ERR_FAIL_INDEX_V(p_idx, edited_scene.size(), String()); if (edited_scene[p_idx].root) { - if (edited_scene[p_idx].root->get_filename() == "") { - edited_scene[p_idx].root->set_filename(edited_scene[p_idx].path); + if (edited_scene[p_idx].root->get_scene_file_path() == "") { + edited_scene[p_idx].root->set_scene_file_path(edited_scene[p_idx].path); } else { - return edited_scene[p_idx].root->get_filename(); + return edited_scene[p_idx].root->get_scene_file_path(); } } diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index 9a79e1f942..1aaa5432f4 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -394,7 +394,7 @@ void EditorNode::_version_control_menu_option(int p_idx) { void EditorNode::_update_title() { const String appname = ProjectSettings::get_singleton()->get("application/config/name"); String title = (appname.is_empty() ? "Unnamed Project" : appname) + String(" - ") + VERSION_NAME; - const String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_filename() : String(); + const String edited = editor_data.get_edited_scene_root() ? editor_data.get_edited_scene_root()->get_scene_file_path() : String(); if (!edited.is_empty()) { // Display the edited scene name before the program name so that it can be seen in the OS task bar. title = vformat("%s - %s", edited.get_file(), title); @@ -1175,7 +1175,7 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String int srpos = path.find("::"); if (srpos != -1) { String base = path.substr(0, srpos); - if (!get_edited_scene() || get_edited_scene()->get_filename() != base) { + if (!get_edited_scene() || get_edited_scene()->get_scene_file_path() != base) { show_warning(TTR("This resource can't be saved because it does not belong to the edited scene. Make it unique first.")); return; } @@ -1549,7 +1549,7 @@ void EditorNode::_save_scene_with_preview(String p_file, int p_idx) { bool EditorNode::_validate_scene_recursive(const String &p_filename, Node *p_node) { for (int i = 0; i < p_node->get_child_count(); i++) { Node *child = p_node->get_child(i); - if (child->get_filename() == p_filename) { + if (child->get_scene_file_path() == p_filename) { return true; } @@ -1645,7 +1645,7 @@ void EditorNode::_save_scene(String p_file, int idx) { return; } - if (scene->get_filename() != String() && _validate_scene_recursive(scene->get_filename(), scene)) { + if (scene->get_scene_file_path() != String() && _validate_scene_recursive(scene->get_scene_file_path(), scene)) { show_accept(TTR("This scene can't be saved because there is a cyclic instancing inclusion.\nPlease resolve it and then attempt to save again."), TTR("OK")); return; } @@ -1699,7 +1699,7 @@ void EditorNode::_save_scene(String p_file, int idx) { } if (err == OK) { - scene->set_filename(ProjectSettings::get_singleton()->localize_path(p_file)); + scene->set_scene_file_path(ProjectSettings::get_singleton()->localize_path(p_file)); if (idx < 0 || idx == editor_data.get_edited_scene()) { set_current_version(editor_data.get_undo_redo().get_version()); } else { @@ -1727,8 +1727,8 @@ void EditorNode::save_scene_list(Vector<String> p_scene_filenames) { for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { Node *scene = editor_data.get_edited_scene_root(i); - if (scene && (p_scene_filenames.find(scene->get_filename()) >= 0)) { - _save_scene(scene->get_filename(), i); + if (scene && (p_scene_filenames.find(scene->get_scene_file_path()) >= 0)) { + _save_scene(scene->get_scene_file_path(), i); } } } @@ -1738,7 +1738,7 @@ void EditorNode::restart_editor() { String to_reopen; if (get_tree()->get_edited_scene_root()) { - to_reopen = get_tree()->get_edited_scene_root()->get_filename(); + to_reopen = get_tree()->get_edited_scene_root()->get_scene_file_path(); } _exit_editor(); @@ -1757,11 +1757,11 @@ void EditorNode::restart_editor() { void EditorNode::_save_all_scenes() { for (int i = 0; i < editor_data.get_edited_scene_count(); i++) { Node *scene = editor_data.get_edited_scene_root(i); - if (scene && scene->get_filename() != "" && DirAccess::exists(scene->get_filename().get_base_dir())) { + if (scene && scene->get_scene_file_path() != "" && DirAccess::exists(scene->get_scene_file_path().get_base_dir())) { if (i != editor_data.get_edited_scene()) { - _save_scene(scene->get_filename(), i); + _save_scene(scene->get_scene_file_path(), i); } else { - _save_scene_with_preview(scene->get_filename()); + _save_scene_with_preview(scene->get_scene_file_path()); } } else { show_warning(TTR("Could not save one or more scenes!"), TTR("Save All Scenes")); @@ -1778,7 +1778,7 @@ void EditorNode::_mark_unsaved_scenes() { continue; } - String path = node->get_filename(); + String path = node->get_scene_file_path(); if (!(path == String() || FileAccess::exists(path))) { if (i == editor_data.get_edited_scene()) { set_current_version(-1); @@ -2130,7 +2130,7 @@ void EditorNode::_edit_current() { if (FileAccess::exists(base_path + ".import")) { editable_warning = TTR("This resource belongs to a scene that was imported, so it's not editable.\nPlease read the documentation relevant to importing scenes to better understand this workflow."); } else { - if ((!get_edited_scene() || get_edited_scene()->get_filename() != base_path) && ResourceLoader::get_resource_type(base_path) == "PackedScene") { + if ((!get_edited_scene() || get_edited_scene()->get_scene_file_path() != base_path) && ResourceLoader::get_resource_type(base_path) == "PackedScene") { editable_warning = TTR("This resource belongs to a scene that was instantiated or inherited.\nChanges to it won't be kept when saving the current scene."); } } @@ -2154,8 +2154,8 @@ void EditorNode::_edit_current() { inspector_dock->update(nullptr); } - if (get_edited_scene() && get_edited_scene()->get_filename() != String()) { - String source_scene = get_edited_scene()->get_filename(); + if (get_edited_scene() && get_edited_scene()->get_scene_file_path() != String()) { + String source_scene = get_edited_scene()->get_scene_file_path(); if (FileAccess::exists(source_scene + ".import")) { editable_warning = TTR("This scene was imported, so changes to it won't be kept.\nInstancing it or inheriting will allow making changes to it.\nPlease read the documentation relevant to importing scenes to better understand this workflow."); } @@ -2278,7 +2278,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) { String args; bool skip_breakpoints; - if (p_current || (editor_data.get_edited_scene_root() && p_custom != String() && p_custom == editor_data.get_edited_scene_root()->get_filename())) { + if (p_current || (editor_data.get_edited_scene_root() && p_custom != String() && p_custom == editor_data.get_edited_scene_root()->get_scene_file_path())) { Node *scene = editor_data.get_edited_scene_root(); if (!scene) { @@ -2286,7 +2286,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) { return; } - if (scene->get_filename() == "") { + if (scene->get_scene_file_path() == "") { current_option = -1; _menu_option(FILE_SAVE_AS_SCENE); // Set the option to save and run so when the dialog is accepted, the scene runs. @@ -2295,7 +2295,7 @@ void EditorNode::_run(bool p_current, const String &p_custom) { return; } - run_filename = scene->get_filename(); + run_filename = scene->get_scene_file_path(); } else if (p_custom != "") { run_filename = p_custom; } @@ -2311,8 +2311,8 @@ void EditorNode::_run(bool p_current, const String &p_custom) { if (unsaved_cache) { Node *scene = editor_data.get_edited_scene_root(); - if (scene && scene->get_filename() != "") { // Only autosave if there is a scene and if it has a path. - _save_scene_with_preview(scene->get_filename()); + if (scene && scene->get_scene_file_path() != "") { // Only autosave if there is a scene and if it has a path. + _save_scene_with_preview(scene->get_scene_file_path()); } } _menu_option(FILE_SAVE_ALL_SCENES); @@ -2405,7 +2405,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { Node *scene = editor_data.get_edited_scene_root(); if (scene) { - file->set_current_path(scene->get_filename()); + file->set_current_path(scene->get_scene_file_path()); }; file->set_title(p_option == FILE_OPEN_SCENE ? TTR("Open Scene") : TTR("Open Base Scene")); file->popup_file_dialog(); @@ -2467,7 +2467,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { if (unsaved_cache || p_option == FILE_CLOSE_ALL_AND_QUIT || p_option == FILE_CLOSE_ALL_AND_RUN_PROJECT_MANAGER) { Node *scene_root = editor_data.get_edited_scene_root(tab_closing); if (scene_root) { - String scene_filename = scene_root->get_filename(); + String scene_filename = scene_root->get_scene_file_path(); save_confirmation->get_ok_button()->set_text(TTR("Save & Close")); save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene_filename != "" ? scene_filename : "unsaved scene")); save_confirmation->popup_centered(); @@ -2487,12 +2487,12 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { case FILE_SAVE_SCENE: { int scene_idx = (p_option == FILE_SAVE_SCENE) ? -1 : tab_closing; Node *scene = editor_data.get_edited_scene_root(scene_idx); - if (scene && scene->get_filename() != "") { - if (DirAccess::exists(scene->get_filename().get_base_dir())) { + if (scene && scene->get_scene_file_path() != "") { + if (DirAccess::exists(scene->get_scene_file_path().get_base_dir())) { if (scene_idx != editor_data.get_edited_scene()) { - _save_scene_with_preview(scene->get_filename(), scene_idx); + _save_scene_with_preview(scene->get_scene_file_path(), scene_idx); } else { - _save_scene_with_preview(scene->get_filename()); + _save_scene_with_preview(scene->get_scene_file_path()); } if (scene_idx != -1) { @@ -2500,7 +2500,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { } save_layout(); } else { - show_save_accept(vformat(TTR("%s no longer exists! Please specify a new save location."), scene->get_filename().get_base_dir()), TTR("OK")); + show_save_accept(vformat(TTR("%s no longer exists! Please specify a new save location."), scene->get_scene_file_path().get_base_dir()), TTR("OK")); } break; } @@ -2543,8 +2543,8 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { file->add_filter("*." + extensions[i] + " ; " + extensions[i].to_upper()); } - if (scene->get_filename() != "") { - String path = scene->get_filename(); + if (scene->get_scene_file_path() != "") { + String path = scene->get_scene_file_path(); file->set_current_path(path); if (extensions.size()) { String ext = path.get_extension().to_lower(); @@ -2642,7 +2642,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { break; } - String filename = scene->get_filename(); + String filename = scene->get_scene_file_path(); if (filename == String()) { show_warning(TTR("Can't reload a scene that was never saved.")); @@ -2764,7 +2764,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { String unsaved_scenes; int i = _next_unsaved_scene(true, 0); while (i != -1) { - unsaved_scenes += "\n " + editor_data.get_edited_scene_root(i)->get_filename(); + unsaved_scenes += "\n " + editor_data.get_edited_scene_root(i)->get_scene_file_path(); i = _next_unsaved_scene(true, ++i); } @@ -2839,7 +2839,7 @@ void EditorNode::_menu_option_confirm(int p_option, bool p_confirmed) { Node *scene = editor_data.get_edited_scene_root(); if (scene) { - file->set_current_path(scene->get_filename()); + file->set_current_path(scene->get_scene_file_path()); }; file->set_title(TTR("Pick a Main Scene")); file->popup_file_dialog(); @@ -2941,7 +2941,7 @@ int EditorNode::_next_unsaved_scene(bool p_valid_filename, int p_start) { int current = editor_data.get_edited_scene(); bool unsaved = (i == current) ? saved_version != editor_data.get_undo_redo().get_version() : editor_data.get_scene_version(i) != 0; if (unsaved) { - String scene_filename = editor_data.get_edited_scene_root(i)->get_filename(); + String scene_filename = editor_data.get_edited_scene_root(i)->get_scene_file_path(); if (p_valid_filename && scene_filename.length() == 0) { continue; } @@ -2973,7 +2973,7 @@ void EditorNode::_discard_changes(const String &p_str) { case SCENE_TAB_CLOSE: { Node *scene = editor_data.get_edited_scene_root(tab_closing); if (scene != nullptr) { - String scene_filename = scene->get_filename(); + String scene_filename = scene->get_scene_file_path(); if (scene_filename != "") { previous_scenes.push_back(scene_filename); } @@ -3602,7 +3602,7 @@ Error EditorNode::load_scene(const String &p_scene, bool p_ignore_broken_deps, b Ref<SceneState> state = sdata->get_state(); state->set_path(lpath); new_scene->set_scene_inherited_state(state); - new_scene->set_filename(String()); + new_scene->set_scene_file_path(String()); } new_scene->set_scene_instance_state(Ref<SceneState>()); @@ -3775,7 +3775,7 @@ void EditorNode::_load_error_notify(void *p_ud, const String &p_text) { } bool EditorNode::_find_scene_in_use(Node *p_node, const String &p_path) const { - if (p_node->get_filename() == p_path) { + if (p_node->get_scene_file_path() == p_path) { return true; } @@ -3953,7 +3953,7 @@ void EditorNode::_pick_main_scene_custom_action(const String &p_custom_action_na pick_main_scene->hide(); current_option = SETTINGS_PICK_MAIN_SCENE; - _dialog_action(scene->get_filename()); + _dialog_action(scene->get_scene_file_path()); } } @@ -4943,7 +4943,7 @@ void EditorNode::_scene_tab_closed(int p_tab, int option) { editor_data.get_scene_version(p_tab) != 0; if (unsaved) { save_confirmation->get_ok_button()->set_text(TTR("Save & Close")); - save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene->get_filename() != "" ? scene->get_filename() : "unsaved scene")); + save_confirmation->set_text(vformat(TTR("Save changes to '%s' before closing?"), scene->get_scene_file_path() != "" ? scene->get_scene_file_path() : "unsaved scene")); save_confirmation->popup_centered(); } else { _discard_changes(); diff --git a/editor/editor_plugin.cpp b/editor/editor_plugin.cpp index 99b917107e..7afc8d4c83 100644 --- a/editor/editor_plugin.cpp +++ b/editor/editor_plugin.cpp @@ -219,7 +219,7 @@ Array EditorInterface::get_open_scenes() const { if (scenes[idx_scn].root == nullptr) { continue; } - ret.push_back(scenes[idx_scn].root->get_filename()); + ret.push_back(scenes[idx_scn].root->get_scene_file_path()); } return ret; } @@ -291,11 +291,11 @@ Error EditorInterface::save_scene() { if (!get_edited_scene_root()) { return ERR_CANT_CREATE; } - if (get_edited_scene_root()->get_filename() == String()) { + if (get_edited_scene_root()->get_scene_file_path() == String()) { return ERR_CANT_CREATE; } - save_scene_as(get_edited_scene_root()->get_filename()); + save_scene_as(get_edited_scene_root()->get_scene_file_path()); return OK; } diff --git a/editor/filesystem_dock.cpp b/editor/filesystem_dock.cpp index 5dd5c050e0..28bbfc2eff 100644 --- a/editor/filesystem_dock.cpp +++ b/editor/filesystem_dock.cpp @@ -1175,7 +1175,7 @@ void FileSystemDock::_try_move_item(const FileOrFolder &p_item, const String &p_ EditorData *ed = &editor->get_editor_data(); for (int j = 0; j < ed->get_edited_scene_count(); j++) { if (ed->get_scene_path(j) == file_changed_paths[i]) { - ed->get_edited_scene_root(j)->set_filename(new_item_path); + ed->get_edited_scene_root(j)->set_scene_file_path(new_item_path); editor->save_layout(); break; } @@ -1260,7 +1260,7 @@ void FileSystemDock::_update_resource_paths_after_move(const Map<String, String> continue; } - path = get_tree()->get_edited_scene_root()->get_filename(); + path = get_tree()->get_edited_scene_root()->get_scene_file_path(); } else { path = EditorNode::get_editor_data().get_scene_path(i); } @@ -1270,7 +1270,7 @@ void FileSystemDock::_update_resource_paths_after_move(const Map<String, String> } if (i == EditorNode::get_editor_data().get_edited_scene()) { - get_tree()->get_edited_scene_root()->set_filename(path); + get_tree()->get_edited_scene_root()->set_scene_file_path(path); } else { EditorNode::get_editor_data().set_scene_path(i, path); } diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index 66a1719ff3..a42bdfea34 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -1460,8 +1460,8 @@ bool CanvasItemEditor::_gui_input_open_scene_on_double_click(const Ref<InputEven List<CanvasItem *> selection = _get_edited_canvas_items(); if (selection.size() == 1) { CanvasItem *canvas_item = selection[0]; - if (canvas_item->get_filename() != "" && canvas_item != editor->get_edited_scene()) { - editor->open_request(canvas_item->get_filename()); + if (canvas_item->get_scene_file_path() != "" && canvas_item != editor->get_edited_scene()) { + editor->open_request(canvas_item->get_scene_file_path()); return true; } } @@ -5800,7 +5800,7 @@ void CanvasItemEditorViewport::_remove_preview() { } bool CanvasItemEditorViewport::_cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node) { - if (p_desired_node->get_filename() == p_target_scene_path) { + if (p_desired_node->get_scene_file_path() == p_target_scene_path) { return true; } @@ -5897,14 +5897,14 @@ bool CanvasItemEditorViewport::_create_instance(Node *parent, String &path, cons return false; } - if (editor->get_edited_scene()->get_filename() != "") { // cyclical instancing - if (_cyclical_dependency_exists(editor->get_edited_scene()->get_filename(), instantiated_scene)) { + if (editor->get_edited_scene()->get_scene_file_path() != "") { // cyclical instancing + if (_cyclical_dependency_exists(editor->get_edited_scene()->get_scene_file_path(), instantiated_scene)) { memdelete(instantiated_scene); return false; } } - instantiated_scene->set_filename(ProjectSettings::get_singleton()->localize_path(path)); + instantiated_scene->set_scene_file_path(ProjectSettings::get_singleton()->localize_path(path)); editor_data->get_undo_redo().add_do_method(parent, "add_child", instantiated_scene); editor_data->get_undo_redo().add_do_method(instantiated_scene, "set_owner", editor->get_edited_scene()); diff --git a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp index a4436525fb..6df2e34ceb 100644 --- a/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp +++ b/editor/plugins/gpu_particles_collision_sdf_editor_plugin.cpp @@ -33,7 +33,7 @@ void GPUParticlesCollisionSDFEditorPlugin::_bake() { if (col_sdf) { if (col_sdf->get_texture().is_null() || !col_sdf->get_texture()->get_path().is_resource_file()) { - String path = get_tree()->get_edited_scene_root()->get_filename(); + String path = get_tree()->get_edited_scene_root()->get_scene_file_path(); if (path == String()) { path = "res://" + col_sdf->get_name() + "_data.exr"; } else { diff --git a/editor/plugins/lightmap_gi_editor_plugin.cpp b/editor/plugins/lightmap_gi_editor_plugin.cpp index b4a70cd31d..123087446c 100644 --- a/editor/plugins/lightmap_gi_editor_plugin.cpp +++ b/editor/plugins/lightmap_gi_editor_plugin.cpp @@ -43,9 +43,9 @@ void LightmapGIEditorPlugin::_bake_select_file(const String &p_file) { switch (err) { case LightmapGI::BAKE_ERROR_NO_SAVE_PATH: { - String scene_path = lightmap->get_filename(); + String scene_path = lightmap->get_scene_file_path(); if (scene_path == String()) { - scene_path = lightmap->get_owner()->get_filename(); + scene_path = lightmap->get_owner()->get_scene_file_path(); } if (scene_path == String()) { EditorNode::get_singleton()->show_warning(TTR("Can't determine a save path for lightmap images.\nSave your scene and try again.")); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index fdd4baaf7d..e5e3be8a4d 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -3917,7 +3917,7 @@ void Node3DEditorViewport::_remove_preview() { } bool Node3DEditorViewport::_cyclical_dependency_exists(const String &p_target_scene_path, Node *p_desired_node) { - if (p_desired_node->get_filename() == p_target_scene_path) { + if (p_desired_node->get_scene_file_path() == p_target_scene_path) { return true; } @@ -3959,15 +3959,15 @@ bool Node3DEditorViewport::_create_instance(Node *parent, String &path, const Po return false; } - if (editor->get_edited_scene()->get_filename() != "") { // cyclical instancing - if (_cyclical_dependency_exists(editor->get_edited_scene()->get_filename(), instantiated_scene)) { + if (editor->get_edited_scene()->get_scene_file_path() != "") { // cyclical instancing + if (_cyclical_dependency_exists(editor->get_edited_scene()->get_scene_file_path(), instantiated_scene)) { memdelete(instantiated_scene); return false; } } if (scene != nullptr) { - instantiated_scene->set_filename(ProjectSettings::get_singleton()->localize_path(path)); + instantiated_scene->set_scene_file_path(ProjectSettings::get_singleton()->localize_path(path)); } editor_data->get_undo_redo().add_do_method(parent, "add_child", instantiated_scene); diff --git a/editor/plugins/occluder_instance_3d_editor_plugin.cpp b/editor/plugins/occluder_instance_3d_editor_plugin.cpp index ab88b9f00d..0328b1bea6 100644 --- a/editor/plugins/occluder_instance_3d_editor_plugin.cpp +++ b/editor/plugins/occluder_instance_3d_editor_plugin.cpp @@ -41,9 +41,9 @@ void OccluderInstance3DEditorPlugin::_bake_select_file(const String &p_file) { switch (err) { case OccluderInstance3D::BAKE_ERROR_NO_SAVE_PATH: { - String scene_path = occluder_instance->get_filename(); + String scene_path = occluder_instance->get_scene_file_path(); if (scene_path == String()) { - scene_path = occluder_instance->get_owner()->get_filename(); + scene_path = occluder_instance->get_owner()->get_scene_file_path(); } if (scene_path == String()) { EditorNode::get_singleton()->show_warning(TTR("Can't determine a save path for the occluder.\nSave your scene and try again.")); diff --git a/editor/plugins/voxel_gi_editor_plugin.cpp b/editor/plugins/voxel_gi_editor_plugin.cpp index 5bbc0c9dd5..9a44d40dcb 100644 --- a/editor/plugins/voxel_gi_editor_plugin.cpp +++ b/editor/plugins/voxel_gi_editor_plugin.cpp @@ -33,7 +33,7 @@ void VoxelGIEditorPlugin::_bake() { if (voxel_gi) { if (voxel_gi->get_probe_data().is_null()) { - String path = get_tree()->get_edited_scene_root()->get_filename(); + String path = get_tree()->get_edited_scene_root()->get_scene_file_path(); if (path == String()) { path = "res://" + voxel_gi->get_name() + "_data.res"; } else { diff --git a/editor/scene_tree_dock.cpp b/editor/scene_tree_dock.cpp index 5ce88949ef..d2e8880bf9 100644 --- a/editor/scene_tree_dock.cpp +++ b/editor/scene_tree_dock.cpp @@ -187,8 +187,8 @@ void SceneTreeDock::_perform_instantiate_scenes(const Vector<String> &p_files, N break; } - if (edited_scene->get_filename() != "") { - if (_cyclical_dependency_exists(edited_scene->get_filename(), instantiated_scene)) { + if (edited_scene->get_scene_file_path() != "") { + if (_cyclical_dependency_exists(edited_scene->get_scene_file_path(), instantiated_scene)) { accept->set_text(vformat(TTR("Cannot instance the scene '%s' because the current scene exists within one of its nodes."), p_files[i])); accept->popup_centered(); error = true; @@ -196,7 +196,7 @@ void SceneTreeDock::_perform_instantiate_scenes(const Vector<String> &p_files, N } } - instantiated_scene->set_filename(ProjectSettings::get_singleton()->localize_path(p_files[i])); + instantiated_scene->set_scene_file_path(ProjectSettings::get_singleton()->localize_path(p_files[i])); instances.push_back(instantiated_scene); } @@ -307,7 +307,7 @@ bool SceneTreeDock::_track_inherit(const String &p_target_scene_path, Node *p_de bool result = false; Vector<Node *> instances; while (true) { - if (p->get_filename() == p_target_scene_path) { + if (p->get_scene_file_path() == p_target_scene_path) { result = true; break; } @@ -442,7 +442,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (!node_clipboard.is_empty()) { _clear_clipboard(); } - clipboard_source_scene = editor->get_edited_scene()->get_filename(); + clipboard_source_scene = editor->get_edited_scene()->get_scene_file_path(); selection.sort_custom<Node::Comparator>(); @@ -465,9 +465,9 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { } bool has_cycle = false; - if (edited_scene->get_filename() != String()) { + if (edited_scene->get_scene_file_path() != String()) { for (Node *E : node_clipboard) { - if (edited_scene->get_filename() == E->get_filename()) { + if (edited_scene->get_scene_file_path() == E->get_scene_file_path()) { has_cycle = true; break; } @@ -496,7 +496,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { editor_data->get_undo_redo().add_do_method(editor_selection, "clear"); Map<RES, RES> resource_remap; - String target_scene = editor->get_edited_scene()->get_filename(); + String target_scene = editor->get_edited_scene()->get_scene_file_path(); if (target_scene != clipboard_source_scene) { if (!clipboard_resource_remap.has(target_scene)) { Map<RES, RES> remap; @@ -808,7 +808,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { return; } - if (node->get_filename() != String()) { + if (node->get_scene_file_path() != String()) { accept->set_text(TTR("Instantiated scenes can't become root")); accept->popup_centered(); return; @@ -818,14 +818,14 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { editor_data->get_undo_redo().add_do_method(node->get_parent(), "remove_child", node); editor_data->get_undo_redo().add_do_method(editor, "set_edited_scene", node); editor_data->get_undo_redo().add_do_method(node, "add_child", root); - editor_data->get_undo_redo().add_do_method(node, "set_filename", root->get_filename()); - editor_data->get_undo_redo().add_do_method(root, "set_filename", String()); + editor_data->get_undo_redo().add_do_method(node, "set_scene_file_path", root->get_scene_file_path()); + editor_data->get_undo_redo().add_do_method(root, "set_scene_file_path", String()); editor_data->get_undo_redo().add_do_method(node, "set_owner", (Object *)nullptr); editor_data->get_undo_redo().add_do_method(root, "set_owner", node); _node_replace_owner(root, root, node, MODE_DO); - editor_data->get_undo_redo().add_undo_method(root, "set_filename", root->get_filename()); - editor_data->get_undo_redo().add_undo_method(node, "set_filename", String()); + editor_data->get_undo_redo().add_undo_method(root, "set_scene_file_path", root->get_scene_file_path()); + editor_data->get_undo_redo().add_undo_method(node, "set_scene_file_path", String()); editor_data->get_undo_redo().add_undo_method(node, "remove_child", root); editor_data->get_undo_redo().add_undo_method(editor, "set_edited_scene", root); editor_data->get_undo_redo().add_undo_method(node->get_parent(), "add_child", node); @@ -887,7 +887,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { Node *node = remove_list[0]; if (node == editor_data->get_edited_scene_root()) { msg = vformat(TTR("Delete the root node \"%s\"?"), node->get_name()); - } else if (node->get_filename() == "" && node->get_child_count() > 0) { + } else if (node->get_scene_file_path() == "" && node->get_child_count() > 0) { // Display this message only for non-instantiated scenes msg = vformat(TTR("Delete node \"%s\" and its children?"), node->get_name()); } else { @@ -934,7 +934,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } - if (tocopy != editor_data->get_edited_scene_root() && tocopy->get_filename() != "") { + if (tocopy != editor_data->get_edited_scene_root() && tocopy->get_scene_file_path() != "") { accept->set_text(TTR("Can't save the branch of an already instantiated scene.\nTo create a variation of a scene, you can make an inherited scene based on the instantiated scene using Scene > New Inherited Scene... instead.")); accept->popup_centered(); break; @@ -1047,10 +1047,10 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { break; } - ERR_FAIL_COND(node->get_filename() == String()); + ERR_FAIL_COND(node->get_scene_file_path() == String()); undo_redo->create_action(TTR("Make Local")); - undo_redo->add_do_method(node, "set_filename", ""); - undo_redo->add_undo_method(node, "set_filename", node->get_filename()); + undo_redo->add_do_method(node, "set_scene_file_path", ""); + undo_redo->add_undo_method(node, "set_scene_file_path", node->get_scene_file_path()); _node_replace_owner(node, node, root); undo_redo->add_do_method(scene_tree, "update_tree"); undo_redo->add_undo_method(scene_tree, "update_tree"); @@ -1064,7 +1064,7 @@ void SceneTreeDock::_tool_selected(int p_tool, bool p_confirm_override) { if (e) { Node *node = e->get(); if (node) { - scene_tree->emit_signal(SNAME("open"), node->get_filename()); + scene_tree->emit_signal(SNAME("open"), node->get_scene_file_path()); } } } break; @@ -1694,7 +1694,7 @@ bool SceneTreeDock::_validate_no_instance() { List<Node *> selection = editor_selection->get_selected_node_list(); for (Node *E : selection) { - if (E != edited_scene && E->get_filename() != "") { + if (E != edited_scene && E->get_scene_file_path() != "") { accept->set_text(TTR("This operation can't be done on instantiated scenes.")); accept->popup_centered(); return false; @@ -2753,7 +2753,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { bool can_replace = true; for (Node *E : selection) { - if (E != edited_scene && (E->get_owner() != edited_scene || E->get_filename() != "")) { + if (E != edited_scene && (E->get_owner() != edited_scene || E->get_scene_file_path() != "")) { can_replace = false; break; } @@ -2785,7 +2785,7 @@ void SceneTreeDock::_tree_rmb(const Vector2 &p_menu_pos) { menu->add_icon_shortcut(get_theme_icon(SNAME("CopyNodePath"), SNAME("EditorIcons")), ED_GET_SHORTCUT("scene_tree/copy_node_path"), TOOL_COPY_NODE_PATH); } - bool is_external = (selection[0]->get_filename() != ""); + bool is_external = (selection[0]->get_scene_file_path() != ""); if (is_external) { bool is_inherited = selection[0]->get_scene_inherited_state() != nullptr; bool is_top_level = selection[0]->get_owner() == nullptr; @@ -2885,9 +2885,9 @@ void SceneTreeDock::attach_script_to_selected(bool p_extend) { Ref<Script> existing = selected->get_script(); - String path = selected->get_filename(); + String path = selected->get_scene_file_path(); if (path == "") { - String root_path = editor_data->get_edited_scene_root()->get_filename(); + String root_path = editor_data->get_edited_scene_root()->get_scene_file_path(); if (root_path == "") { path = String("res://").plus_file(selected->get_name()); } else { @@ -2939,7 +2939,7 @@ void SceneTreeDock::attach_shader_to_selected() { if (path == "") { String root_path; if (editor_data->get_edited_scene_root()) { - root_path = editor_data->get_edited_scene_root()->get_filename(); + root_path = editor_data->get_edited_scene_root()->get_scene_file_path(); } String shader_name; if (selected_shader_material->get_name().is_empty()) { diff --git a/editor/scene_tree_editor.cpp b/editor/scene_tree_editor.cpp index 3de87d9df7..ccca01ed8b 100644 --- a/editor/scene_tree_editor.cpp +++ b/editor/scene_tree_editor.cpp @@ -66,7 +66,7 @@ void SceneTreeEditor::_cell_button_pressed(Object *p_item, int p_column, int p_i emit_signal(SNAME("open"), n->get_scene_inherited_state()->get_path()); } } else { - emit_signal(SNAME("open"), n->get_filename()); + emit_signal(SNAME("open"), n->get_scene_file_path()); } } else if (p_id == BUTTON_SCRIPT) { Ref<Script> script_typed = n->get_script(); @@ -302,10 +302,10 @@ bool SceneTreeEditor::_add_nodes(Node *p_node, TreeItem *p_parent, bool p_scroll } item->set_tooltip(0, tooltip); - } else if (p_node != get_scene_node() && p_node->get_filename() != "" && can_open_instance) { + } else if (p_node != get_scene_node() && p_node->get_scene_file_path() != "" && can_open_instance) { item->add_button(0, get_theme_icon(SNAME("InstanceOptions"), SNAME("EditorIcons")), BUTTON_SUBSCENE, false, TTR("Open in Editor")); - String tooltip = String(p_node->get_name()) + "\n" + TTR("Instance:") + " " + p_node->get_filename() + "\n" + TTR("Type:") + " " + p_node->get_class(); + String tooltip = String(p_node->get_name()) + "\n" + TTR("Instance:") + " " + p_node->get_scene_file_path() + "\n" + TTR("Type:") + " " + p_node->get_class(); if (p_node->get_editor_description() != String()) { tooltip += "\n\n" + p_node->get_editor_description(); } @@ -954,7 +954,7 @@ Variant SceneTreeEditor::get_drag_data_fw(const Point2 &p_point, Control *p_from Node *n = get_node(np); if (n) { // Only allow selection if not part of an instantiated scene. - if (!n->get_owner() || n->get_owner() == get_scene_node() || n->get_owner()->get_filename() == String()) { + if (!n->get_owner() || n->get_owner() == get_scene_node() || n->get_owner()->get_scene_file_path() == String()) { selected.push_back(n); icons.push_back(next->get_icon(0)); } |