summaryrefslogtreecommitdiff
path: root/editor
diff options
context:
space:
mode:
Diffstat (limited to 'editor')
-rw-r--r--editor/editor_node.cpp18
1 files changed, 17 insertions, 1 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index afaf90a158..1c9e07ae5b 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -619,7 +619,11 @@ void EditorNode::save_resource_in_path(const Ref<Resource> &p_resource, const St
Error err = ResourceSaver::save(path, p_resource, flg | ResourceSaver::FLAG_REPLACE_SUBRESOURCE_PATHS);
if (err != OK) {
- show_accept(TTR("Error saving resource!"), TTR("OK"));
+ if (ResourceLoader::is_imported(p_resource->get_path())) {
+ show_accept(TTR("Imported resources can't be saved."), TTR("OK"));
+ } else {
+ show_accept(TTR("Error saving resource!"), TTR("OK"));
+ }
return;
}
@@ -639,6 +643,18 @@ void EditorNode::save_resource(const Ref<Resource> &p_resource) {
void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String &p_at_path) {
+ {
+ String path = p_resource->get_path();
+ int srpos = path.find("::");
+ if (srpos != -1) {
+ String base = path.substr(0, srpos);
+ if (!get_edited_scene() || get_edited_scene()->get_filename() != base) {
+ show_warning(TTR("This resource can't be saved because it does not belong to the edited scene. Make it unique first."));
+ return;
+ }
+ }
+ }
+
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
saving_resource = p_resource;