summaryrefslogtreecommitdiffstats
path: root/editor/editor_node.cpp
diff options
context:
space:
mode:
authorJFonS <joan.fonssanchez@gmail.com>2018-11-18 15:17:04 +0100
committerJFonS <joan.fonssanchez@gmail.com>2018-11-18 15:17:04 +0100
commitdbca3b81ba567658e51c1418a7614c5aefd6a18d (patch)
treef17dcf7e00b879ddd96d0431b68642a9d0ff2b91 /editor/editor_node.cpp
parente77afb85072a7bea10075221b9a24abd442e1318 (diff)
downloadredot-engine-dbca3b81ba567658e51c1418a7614c5aefd6a18d.tar.gz
Add Save option to resource property menu
Diffstat (limited to 'editor/editor_node.cpp')
-rw-r--r--editor/editor_node.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp
index dbbf5d08b8..d562bff422 100644
--- a/editor/editor_node.cpp
+++ b/editor/editor_node.cpp
@@ -637,6 +637,7 @@ void EditorNode::save_resource(const Ref<Resource> &p_resource) {
void EditorNode::save_resource_as(const Ref<Resource> &p_resource, const String &p_at_path) {
file->set_mode(EditorFileDialog::MODE_SAVE_FILE);
+ saving_resource = p_resource;
current_option = RESOURCE_SAVE_AS;
List<String> extensions;
@@ -1263,15 +1264,13 @@ void EditorNode::_dialog_action(String p_file) {
case RESOURCE_SAVE:
case RESOURCE_SAVE_AS: {
- uint32_t current = editor_history.get_current();
+ ERR_FAIL_COND(saving_resource.is_null())
+ save_resource_in_path(saving_resource, p_file);
+ saving_resource = Ref<Resource>();
+ ObjectID current = editor_history.get_current();
Object *current_obj = current > 0 ? ObjectDB::get_instance(current) : NULL;
-
- ERR_FAIL_COND(!Object::cast_to<Resource>(current_obj))
-
- RES current_res = RES(Object::cast_to<Resource>(current_obj));
-
- save_resource_in_path(current_res, p_file);
-
+ ERR_FAIL_COND(!current_obj);
+ current_obj->_change_notify();
} break;
case SETTINGS_LAYOUT_SAVE: {
@@ -5777,6 +5776,7 @@ EditorNode::EditorNode() {
_edit_current();
current = NULL;
+ saving_resource = Ref<Resource>();
reference_resource_mem = true;
save_external_resources_mem = true;