Merge pull request #53254 from Calinou/node-rename-filename
Rename Node's `filename` property to `scene_file_path` for clarity
This commit is contained in:
commit
5b7ec95de7
19 changed files with 141 additions and 141 deletions
|
@ -700,9 +700,6 @@
|
|||
<member name="custom_multiplayer" type="MultiplayerAPI" setter="set_custom_multiplayer" getter="get_custom_multiplayer">
|
||||
The override to the default [MultiplayerAPI]. Set to [code]null[/code] to use the default [SceneTree] one.
|
||||
</member>
|
||||
<member name="filename" type="String" setter="set_filename" getter="get_filename">
|
||||
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.
|
||||
</member>
|
||||
<member name="multiplayer" type="MultiplayerAPI" setter="" getter="get_multiplayer">
|
||||
The [MultiplayerAPI] instance associated with this node. Either the [member custom_multiplayer], or the default SceneTree one (if inside tree).
|
||||
</member>
|
||||
|
@ -719,6 +716,9 @@
|
|||
<member name="process_priority" type="int" setter="set_process_priority" getter="get_process_priority" default="0">
|
||||
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.
|
||||
</member>
|
||||
<member name="scene_file_path" type="String" setter="set_scene_file_path" getter="get_scene_file_path">
|
||||
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.
|
||||
</member>
|
||||
</members>
|
||||
<signals>
|
||||
<signal name="ready">
|
||||
|
|
|
@ -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("");
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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."));
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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."));
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ void SceneExporterGLTFPlugin::convert_scene_to_gltf2() {
|
|||
editor->show_accept(TTR("This operation can't be done without a scene."), TTR("OK"));
|
||||
return;
|
||||
}
|
||||
String filename = String(root->get_filename().get_file().get_basename());
|
||||
String filename = String(root->get_scene_file_path().get_file().get_basename());
|
||||
if (filename.is_empty()) {
|
||||
filename = root->get_name();
|
||||
}
|
||||
|
|
|
@ -114,8 +114,8 @@ void Node::_notification(int p_notification) {
|
|||
memdelete(data.path_cache);
|
||||
data.path_cache = nullptr;
|
||||
}
|
||||
if (data.filename.length()) {
|
||||
get_multiplayer()->scene_enter_exit_notify(data.filename, this, false);
|
||||
if (data.scene_file_path.length()) {
|
||||
get_multiplayer()->scene_enter_exit_notify(data.scene_file_path, this, false);
|
||||
}
|
||||
} break;
|
||||
case NOTIFICATION_PATH_CHANGED: {
|
||||
|
@ -146,9 +146,9 @@ void Node::_notification(int p_notification) {
|
|||
|
||||
GDVIRTUAL_CALL(_ready);
|
||||
|
||||
if (data.filename.length()) {
|
||||
if (data.scene_file_path.length()) {
|
||||
ERR_FAIL_COND(!is_inside_tree());
|
||||
get_multiplayer()->scene_enter_exit_notify(data.filename, this, true);
|
||||
get_multiplayer()->scene_enter_exit_notify(data.scene_file_path, this, true);
|
||||
}
|
||||
|
||||
} break;
|
||||
|
@ -235,7 +235,7 @@ void Node::_propagate_enter_tree() {
|
|||
data.blocked--;
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
SceneDebugger::add_to_cache(data.filename, this);
|
||||
SceneDebugger::add_to_cache(data.scene_file_path, this);
|
||||
#endif
|
||||
// enter groups
|
||||
}
|
||||
|
@ -253,7 +253,7 @@ void Node::_propagate_exit_tree() {
|
|||
//block while removing children
|
||||
|
||||
#ifdef DEBUG_ENABLED
|
||||
SceneDebugger::remove_from_cache(data.filename, this);
|
||||
SceneDebugger::remove_from_cache(data.scene_file_path, this);
|
||||
#endif
|
||||
data.blocked++;
|
||||
|
||||
|
@ -1846,12 +1846,12 @@ void Node::remove_and_skip() {
|
|||
data.parent->remove_child(this);
|
||||
}
|
||||
|
||||
void Node::set_filename(const String &p_filename) {
|
||||
data.filename = p_filename;
|
||||
void Node::set_scene_file_path(const String &p_scene_file_path) {
|
||||
data.scene_file_path = p_scene_file_path;
|
||||
}
|
||||
|
||||
String Node::get_filename() const {
|
||||
return data.filename;
|
||||
String Node::get_scene_file_path() const {
|
||||
return data.scene_file_path;
|
||||
}
|
||||
|
||||
void Node::set_editor_description(const String &p_editor_description) {
|
||||
|
@ -1948,8 +1948,8 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
|
|||
nip->set_instance_path(ip->get_instance_path());
|
||||
node = nip;
|
||||
|
||||
} else if ((p_flags & DUPLICATE_USE_INSTANCING) && get_filename() != String()) {
|
||||
Ref<PackedScene> res = ResourceLoader::load(get_filename());
|
||||
} else if ((p_flags & DUPLICATE_USE_INSTANCING) && get_scene_file_path() != String()) {
|
||||
Ref<PackedScene> res = ResourceLoader::load(get_scene_file_path());
|
||||
ERR_FAIL_COND_V(res.is_null(), nullptr);
|
||||
PackedScene::GenEditState ges = PackedScene::GEN_EDIT_STATE_DISABLED;
|
||||
#ifdef TOOLS_ENABLED
|
||||
|
@ -1972,8 +1972,8 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
|
|||
ERR_FAIL_COND_V(!node, nullptr);
|
||||
}
|
||||
|
||||
if (get_filename() != "") { //an instance
|
||||
node->set_filename(get_filename());
|
||||
if (get_scene_file_path() != "") { //an instance
|
||||
node->set_scene_file_path(get_scene_file_path());
|
||||
node->data.editable_instance = data.editable_instance;
|
||||
}
|
||||
|
||||
|
@ -2004,7 +2004,7 @@ Node *Node::_duplicate(int p_flags, Map<const Node *, Node *> *r_duplimap) const
|
|||
|
||||
node_tree.push_back(descendant);
|
||||
|
||||
if (descendant->get_filename() != "" && instance_roots.has(descendant->get_owner())) {
|
||||
if (descendant->get_scene_file_path() != "" && instance_roots.has(descendant->get_owner())) {
|
||||
instance_roots.push_back(descendant);
|
||||
}
|
||||
}
|
||||
|
@ -2313,7 +2313,7 @@ void Node::replace_by(Node *p_node, bool p_keep_groups) {
|
|||
owned_by_owner[i]->set_owner(owner);
|
||||
}
|
||||
|
||||
p_node->set_filename(get_filename());
|
||||
p_node->set_scene_file_path(get_scene_file_path());
|
||||
}
|
||||
|
||||
void Node::_replace_connections_target(Node *p_new_target) {
|
||||
|
@ -2693,8 +2693,8 @@ void Node::_bind_methods() {
|
|||
ClassDB::bind_method(D_METHOD("get_index", "include_internal"), &Node::get_index, DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("print_tree"), &Node::print_tree);
|
||||
ClassDB::bind_method(D_METHOD("print_tree_pretty"), &Node::print_tree_pretty);
|
||||
ClassDB::bind_method(D_METHOD("set_filename", "filename"), &Node::set_filename);
|
||||
ClassDB::bind_method(D_METHOD("get_filename"), &Node::get_filename);
|
||||
ClassDB::bind_method(D_METHOD("set_scene_file_path", "scene_file_path"), &Node::set_scene_file_path);
|
||||
ClassDB::bind_method(D_METHOD("get_scene_file_path"), &Node::get_scene_file_path);
|
||||
ClassDB::bind_method(D_METHOD("propagate_notification", "what"), &Node::propagate_notification);
|
||||
ClassDB::bind_method(D_METHOD("propagate_call", "method", "args", "parent_first"), &Node::propagate_call, DEFVAL(Array()), DEFVAL(false));
|
||||
ClassDB::bind_method(D_METHOD("set_physics_process", "enable"), &Node::set_physics_process);
|
||||
|
@ -2839,7 +2839,7 @@ void Node::_bind_methods() {
|
|||
ADD_SIGNAL(MethodInfo("tree_exited"));
|
||||
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING_NAME, "name", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_name", "get_name");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "filename", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_filename", "get_filename");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::STRING, "scene_file_path", PROPERTY_HINT_NONE, "", PROPERTY_USAGE_NONE), "set_scene_file_path", "get_scene_file_path");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "owner", PROPERTY_HINT_RESOURCE_TYPE, "Node", PROPERTY_USAGE_NONE), "set_owner", "get_owner");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", PROPERTY_USAGE_NONE), "", "get_multiplayer");
|
||||
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "custom_multiplayer", PROPERTY_HINT_RESOURCE_TYPE, "MultiplayerAPI", PROPERTY_USAGE_NONE), "set_custom_multiplayer", "get_custom_multiplayer");
|
||||
|
|
|
@ -96,7 +96,7 @@ private:
|
|||
};
|
||||
|
||||
struct Data {
|
||||
String filename;
|
||||
String scene_file_path;
|
||||
Ref<SceneState> instance_state;
|
||||
Ref<SceneState> inherited_state;
|
||||
|
||||
|
@ -353,8 +353,8 @@ public:
|
|||
void print_tree();
|
||||
void print_tree_pretty();
|
||||
|
||||
void set_filename(const String &p_filename);
|
||||
String get_filename() const;
|
||||
void set_scene_file_path(const String &p_scene_file_path);
|
||||
String get_scene_file_path() const;
|
||||
|
||||
void set_editor_description(const String &p_editor_description);
|
||||
String get_editor_description() const;
|
||||
|
|
|
@ -1105,7 +1105,7 @@ Error SceneTree::change_scene_to(const Ref<PackedScene> &p_scene) {
|
|||
|
||||
Error SceneTree::reload_current_scene() {
|
||||
ERR_FAIL_COND_V(!current_scene, ERR_UNCONFIGURED);
|
||||
String fname = current_scene->get_filename();
|
||||
String fname = current_scene->get_scene_file_path();
|
||||
return change_scene(fname);
|
||||
}
|
||||
|
||||
|
|
|
@ -384,7 +384,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
|
|||
|
||||
// save the child instantiated scenes that are chosen as editable, so they can be restored
|
||||
// upon load back
|
||||
if (p_node != p_owner && p_node->get_filename() != String() && p_owner->is_editable_instance(p_node)) {
|
||||
if (p_node != p_owner && p_node->get_scene_file_path() != String() && p_owner->is_editable_instance(p_node)) {
|
||||
editable_instances.push_back(p_owner->get_path_to(p_node));
|
||||
// Node is the root of an editable instance.
|
||||
is_editable_instance = true;
|
||||
|
@ -437,14 +437,14 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
|
|||
}
|
||||
}
|
||||
|
||||
if (p_node->get_filename() != String() && p_node->get_owner() == p_owner && instantiated_by_owner) {
|
||||
if (p_node->get_scene_file_path() != String() && p_node->get_owner() == p_owner && instantiated_by_owner) {
|
||||
if (p_node->get_scene_instance_load_placeholder()) {
|
||||
//it's a placeholder, use the placeholder path
|
||||
nd.instance = _vm_get_variant(p_node->get_filename(), variant_map);
|
||||
nd.instance = _vm_get_variant(p_node->get_scene_file_path(), variant_map);
|
||||
nd.instance |= FLAG_INSTANCE_IS_PLACEHOLDER;
|
||||
} else {
|
||||
//must instance ourselves
|
||||
Ref<PackedScene> instance = ResourceLoader::load(p_node->get_filename());
|
||||
Ref<PackedScene> instance = ResourceLoader::load(p_node->get_scene_file_path());
|
||||
if (!instance.is_valid()) {
|
||||
return ERR_CANT_OPEN;
|
||||
}
|
||||
|
@ -454,7 +454,7 @@ Error SceneState::_parse_node(Node *p_owner, Node *p_node, int p_parent_idx, Map
|
|||
}
|
||||
n = nullptr;
|
||||
} else {
|
||||
if (n->get_filename() != String()) {
|
||||
if (n->get_scene_file_path() != String()) {
|
||||
//is an instance
|
||||
Ref<SceneState> state = n->get_scene_instance_state();
|
||||
if (state.is_valid()) {
|
||||
|
@ -714,7 +714,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName
|
|||
|
||||
ERR_CONTINUE(!common_parent);
|
||||
|
||||
if (common_parent != p_owner && common_parent->get_filename() == String()) {
|
||||
if (common_parent != p_owner && common_parent->get_scene_file_path() == String()) {
|
||||
common_parent = common_parent->get_owner();
|
||||
}
|
||||
|
||||
|
@ -774,7 +774,7 @@ Error SceneState::_parse_connections(Node *p_owner, Node *p_node, Map<StringName
|
|||
|
||||
nl = nullptr;
|
||||
} else {
|
||||
if (nl->get_filename() != String()) {
|
||||
if (nl->get_scene_file_path() != String()) {
|
||||
//is an instance
|
||||
Ref<SceneState> state = nl->get_scene_instance_state();
|
||||
if (state.is_valid()) {
|
||||
|
@ -1652,7 +1652,7 @@ Node *PackedScene::instantiate(GenEditState p_edit_state) const {
|
|||
}
|
||||
|
||||
if (get_path() != "" && get_path().find("::") == -1) {
|
||||
s->set_filename(get_path());
|
||||
s->set_scene_file_path(get_path());
|
||||
}
|
||||
|
||||
s->notification(Node::NOTIFICATION_INSTANCED);
|
||||
|
|
Loading…
Reference in a new issue