diff options
author | Juan Linietsky <juan@godotengine.org> | 2019-03-04 11:06:15 -0300 |
---|---|---|
committer | Juan Linietsky <juan@godotengine.org> | 2019-03-04 11:06:49 -0300 |
commit | e653c79ef786cb00f739388df987b7105a7c55c8 (patch) | |
tree | a63aa7a03a0e5da07659287f4d3abc6d94f1c11a /editor | |
parent | e23a19248200c860acc627fb16c440cb5128a361 (diff) |
Better warnings when resources can't be saved. Fixes #26531
Diffstat (limited to 'editor')
-rw-r--r-- | editor/editor_node.cpp | 18 |
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; |