summaryrefslogtreecommitdiffstats
path: root/modules/openxr/editor/openxr_action_map_editor.cpp
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2024-07-10 14:41:37 +1000
committerBastiaan Olij <mux213@gmail.com>2024-07-11 20:06:46 +1000
commit95b72631aa78fe5da45a911b59cab2d6f2b76c49 (patch)
tree333dc7d8428a142dae580cac77a7c10df3195b53 /modules/openxr/editor/openxr_action_map_editor.cpp
parent82cedc83c9069125207c128f9a07ce3d82c317cc (diff)
downloadredot-engine-95b72631aa78fe5da45a911b59cab2d6f2b76c49.tar.gz
Couple of small fixes on the action map: now saves when CTRL-S is pressed/project is run, no longer looses content if OpenXR is not enabled, and a small documentation fix.
Diffstat (limited to 'modules/openxr/editor/openxr_action_map_editor.cpp')
-rw-r--r--modules/openxr/editor/openxr_action_map_editor.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/modules/openxr/editor/openxr_action_map_editor.cpp b/modules/openxr/editor/openxr_action_map_editor.cpp
index 937973f388..51e6c3e277 100644
--- a/modules/openxr/editor/openxr_action_map_editor.cpp
+++ b/modules/openxr/editor/openxr_action_map_editor.cpp
@@ -248,7 +248,7 @@ void OpenXRActionMapEditor::_on_interaction_profile_selected(const String p_path
void OpenXRActionMapEditor::_load_action_map(const String p_path, bool p_create_new_if_missing) {
Error err = OK;
- action_map = ResourceLoader::load(p_path, "", ResourceFormatLoader::CACHE_MODE_IGNORE, &err);
+ action_map = ResourceLoader::load(p_path, "", ResourceFormatLoader::CACHE_MODE_REUSE, &err);
if (err != OK) {
if ((err == ERR_FILE_NOT_FOUND || err == ERR_CANT_OPEN) && p_create_new_if_missing) {
action_map.instantiate();
@@ -257,10 +257,16 @@ void OpenXRActionMapEditor::_load_action_map(const String p_path, bool p_create_
// Save it immediately
err = ResourceSaver::save(action_map, p_path);
if (err != OK) {
- // show warning but continue
+ // Show warning but continue.
EditorNode::get_singleton()->show_warning(vformat(TTR("Error saving file %s: %s"), edited_path, error_names[err]));
+ } else {
+ // Reload so it's cached.
+ action_map = ResourceLoader::load(p_path, "", ResourceFormatLoader::CACHE_MODE_REUSE, &err);
+ if (err != OK) {
+ // Show warning but continue.
+ EditorNode::get_singleton()->show_warning(vformat(TTR("Error reloading file %s: %s"), edited_path, error_names[err]));
+ }
}
-
} else {
EditorNode::get_singleton()->show_warning(vformat(TTR("Error loading %s: %s."), edited_path, error_names[err]));