Merge pull request #94158 from BastiaanOlij/fix_action_map
OpenXR: Couple of small fixes on the action map
This commit is contained in:
commit
b6434f2ac7
@ -176,6 +176,10 @@
|
|||||||
Triggers a haptic pulse on a device associated with this interface.
|
Triggers a haptic pulse on a device associated with this interface.
|
||||||
[param action_name] is the name of the action for this pulse.
|
[param action_name] is the name of the action for this pulse.
|
||||||
[param tracker_name] is optional and can be used to direct the pulse to a specific device provided that device is bound to this haptic.
|
[param tracker_name] is optional and can be used to direct the pulse to a specific device provided that device is bound to this haptic.
|
||||||
|
[param frequency] is the frequency of the pulse, set to [code]0.0[/code] to have the system use a default frequency.
|
||||||
|
[param amplitude] is the amplitude of the pulse between [code]0.0[/code] and [code]1.0[/code].
|
||||||
|
[param duration_sec] is the duration of the pulse in seconds.
|
||||||
|
[param delay_sec] is a delay in seconds before the pulse is given.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
<method name="uninitialize">
|
<method name="uninitialize">
|
||||||
|
@ -38,6 +38,10 @@
|
|||||||
<description>
|
<description>
|
||||||
Triggers a haptic pulse on a device associated with this interface.
|
Triggers a haptic pulse on a device associated with this interface.
|
||||||
[param action_name] is the name of the action for this pulse.
|
[param action_name] is the name of the action for this pulse.
|
||||||
|
[param frequency] is the frequency of the pulse, set to [code]0.0[/code] to have the system use a default frequency.
|
||||||
|
[param amplitude] is the amplitude of the pulse between [code]0.0[/code] and [code]1.0[/code].
|
||||||
|
[param duration_sec] is the duration of the pulse in seconds.
|
||||||
|
[param delay_sec] is a delay in seconds before the pulse is given.
|
||||||
</description>
|
</description>
|
||||||
</method>
|
</method>
|
||||||
</methods>
|
</methods>
|
||||||
|
@ -127,9 +127,12 @@ Ref<OpenXRInteractionProfile> OpenXRInteractionProfile::new_profile(const char *
|
|||||||
|
|
||||||
void OpenXRInteractionProfile::set_interaction_profile_path(const String p_input_profile_path) {
|
void OpenXRInteractionProfile::set_interaction_profile_path(const String p_input_profile_path) {
|
||||||
OpenXRInteractionProfileMetadata *pmd = OpenXRInteractionProfileMetadata::get_singleton();
|
OpenXRInteractionProfileMetadata *pmd = OpenXRInteractionProfileMetadata::get_singleton();
|
||||||
ERR_FAIL_NULL(pmd);
|
if (pmd) {
|
||||||
|
interaction_profile_path = pmd->check_profile_name(p_input_profile_path);
|
||||||
interaction_profile_path = pmd->check_profile_name(p_input_profile_path);
|
} else {
|
||||||
|
// OpenXR module not enabled, ignore checks.
|
||||||
|
interaction_profile_path = p_input_profile_path;
|
||||||
|
}
|
||||||
emit_changed();
|
emit_changed();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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) {
|
void OpenXRActionMapEditor::_load_action_map(const String p_path, bool p_create_new_if_missing) {
|
||||||
Error err = OK;
|
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 != OK) {
|
||||||
if ((err == ERR_FILE_NOT_FOUND || err == ERR_CANT_OPEN) && p_create_new_if_missing) {
|
if ((err == ERR_FILE_NOT_FOUND || err == ERR_CANT_OPEN) && p_create_new_if_missing) {
|
||||||
action_map.instantiate();
|
action_map.instantiate();
|
||||||
@ -257,10 +257,16 @@ void OpenXRActionMapEditor::_load_action_map(const String p_path, bool p_create_
|
|||||||
// Save it immediately
|
// Save it immediately
|
||||||
err = ResourceSaver::save(action_map, p_path);
|
err = ResourceSaver::save(action_map, p_path);
|
||||||
if (err != OK) {
|
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]));
|
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 {
|
} else {
|
||||||
EditorNode::get_singleton()->show_warning(vformat(TTR("Error loading %s: %s."), edited_path, error_names[err]));
|
EditorNode::get_singleton()->show_warning(vformat(TTR("Error loading %s: %s."), edited_path, error_names[err]));
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user