summaryrefslogtreecommitdiffstats
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp41
1 files changed, 19 insertions, 22 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index 8c3637663d..f73eb81473 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -1279,11 +1279,9 @@ void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String
return;
}
}
- } else {
- if (FileAccess::exists(path + ".import")) {
- show_warning(TTR("This resource can't be saved because it was imported from another file. Make it unique first."));
- return;
- }
+ } else if (FileAccess::exists(path + ".import")) {
+ show_warning(TTR("This resource can't be saved because it was imported from another file. Make it unique first."));
+ return;
}
}
@@ -1811,11 +1809,18 @@ void EditorNode::save_all_scenes() {
_save_all_scenes();
}
-void EditorNode::save_scene_list(Vector<String> p_scene_filenames) {
+void EditorNode::save_scene_if_open(const String &p_scene_path) {
+ int idx = editor_data.get_edited_scene_from_path(p_scene_path);
+ if (idx >= 0) {
+ _save_scene(p_scene_path, idx);
+ }
+}
+
+void EditorNode::save_scene_list(const HashSet<String> &p_scene_paths) {
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_scene_file_path()) >= 0)) {
+ if (scene && p_scene_paths.has(scene->get_scene_file_path())) {
_save_scene(scene->get_scene_file_path(), i);
}
}
@@ -2342,21 +2347,15 @@ void EditorNode::_edit_current(bool p_skip_foreign) {
int subr_idx = current_res->get_path().find("::");
if (subr_idx != -1) {
String base_path = current_res->get_path().substr(0, subr_idx);
- if (!base_path.is_resource_file()) {
- if (FileAccess::exists(base_path + ".import")) {
+ if (FileAccess::exists(base_path + ".import")) {
+ if (!base_path.is_resource_file()) {
if (get_edited_scene() && get_edited_scene()->get_scene_file_path() == base_path) {
info_is_warning = true;
}
- editable_info = 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_scene_file_path() != base_path) && ResourceLoader::get_resource_type(base_path) == "PackedScene") {
- editable_info = TTR("This resource belongs to a scene that was instantiated or inherited.\nChanges to it must be made inside the original scene.");
- }
- }
- } else {
- if (FileAccess::exists(base_path + ".import")) {
- editable_info = 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.");
}
+ editable_info = 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_scene_file_path() != base_path) && ResourceLoader::get_resource_type(base_path) == "PackedScene") {
+ editable_info = TTR("This resource belongs to a scene that was instantiated or inherited.\nChanges to it must be made inside the original scene.");
}
} else if (current_res->get_path().is_resource_file()) {
if (FileAccess::exists(current_res->get_path() + ".import")) {
@@ -4062,11 +4061,9 @@ bool EditorNode::is_resource_read_only(Ref<Resource> p_resource, bool p_foreign_
}
}
}
- } else {
+ } else if (FileAccess::exists(path + ".import")) {
// The resource is not a subresource, but if it has an .import file, it's imported so treat it as read only.
- if (FileAccess::exists(path + ".import")) {
- return true;
- }
+ return true;
}
return false;