1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Use const ref parameters in the OpenXR module

This commit is contained in:
Aaron Franke
2025-09-26 17:02:33 -07:00
parent b4472f4670
commit c3e6002c6e
36 changed files with 183 additions and 185 deletions

View File

@@ -61,7 +61,7 @@ void OpenXRInteractionProfileEditorBase::_do_update_interaction_profile() {
}
}
void OpenXRInteractionProfileEditorBase::_add_binding(const String p_action, const String p_path) {
void OpenXRInteractionProfileEditorBase::_add_binding(const String &p_action, const String &p_path) {
ERR_FAIL_COND(action_map.is_null());
ERR_FAIL_COND(interaction_profile.is_null());
@@ -88,7 +88,7 @@ void OpenXRInteractionProfileEditorBase::_add_binding(const String p_action, con
_do_update_interaction_profile();
}
void OpenXRInteractionProfileEditorBase::_remove_binding(const String p_action, const String p_path) {
void OpenXRInteractionProfileEditorBase::_remove_binding(const String &p_action, const String &p_path) {
ERR_FAIL_COND(action_map.is_null());
ERR_FAIL_COND(interaction_profile.is_null());
@@ -125,13 +125,13 @@ void OpenXRInteractionProfileEditorBase::_theme_changed() {
}
}
void OpenXRInteractionProfileEditorBase::remove_all_for_action_set(Ref<OpenXRActionSet> p_action_set) {
void OpenXRInteractionProfileEditorBase::remove_all_for_action_set(const Ref<OpenXRActionSet> &p_action_set) {
// Note, don't need to remove bindings themselves as remove_all_for_action will be called for each before this is called.
// TODO update binding modifiers
}
void OpenXRInteractionProfileEditorBase::remove_all_for_action(Ref<OpenXRAction> p_action) {
void OpenXRInteractionProfileEditorBase::remove_all_for_action(const Ref<OpenXRAction> &p_action) {
Vector<Ref<OpenXRIPBinding>> bindings = interaction_profile->get_bindings_for_action(p_action);
if (bindings.size() > 0) {
String action_name = p_action->get_name_with_set();
@@ -185,7 +185,7 @@ OpenXRInteractionProfileEditorBase::OpenXRInteractionProfileEditorBase() {
toolbar_vb->add_child(binding_modifiers_btn);
}
void OpenXRInteractionProfileEditorBase::setup(Ref<OpenXRActionMap> p_action_map, Ref<OpenXRInteractionProfile> p_interaction_profile) {
void OpenXRInteractionProfileEditorBase::setup(const Ref<OpenXRActionMap> &p_action_map, const Ref<OpenXRInteractionProfile> &p_interaction_profile) {
ERR_FAIL_NULL(binding_modifiers_dialog);
binding_modifiers_dialog->setup(p_action_map, p_interaction_profile);
@@ -214,12 +214,12 @@ void OpenXRInteractionProfileEditorBase::setup(Ref<OpenXRActionMap> p_action_map
///////////////////////////////////////////////////////////////////////////
// Default interaction profile editor
void OpenXRInteractionProfileEditor::select_action_for(const String p_io_path) {
void OpenXRInteractionProfileEditor::select_action_for(const String &p_io_path) {
selecting_for_io_path = p_io_path;
select_action_dialog->open();
}
void OpenXRInteractionProfileEditor::_on_action_selected(const String p_action) {
void OpenXRInteractionProfileEditor::_on_action_selected(const String &p_action) {
undo_redo->create_action(TTR("Add binding"));
undo_redo->add_do_method(this, "_add_binding", p_action, selecting_for_io_path);
undo_redo->add_undo_method(this, "_remove_binding", p_action, selecting_for_io_path);
@@ -228,7 +228,7 @@ void OpenXRInteractionProfileEditor::_on_action_selected(const String p_action)
selecting_for_io_path = "";
}
void OpenXRInteractionProfileEditor::_on_remove_pressed(const String p_action, const String p_for_io_path) {
void OpenXRInteractionProfileEditor::_on_remove_pressed(const String &p_action, const String &p_for_io_path) {
undo_redo->create_action(TTR("Remove binding"));
undo_redo->add_do_method(this, "_remove_binding", p_action, p_for_io_path);
undo_redo->add_undo_method(this, "_add_binding", p_action, p_for_io_path);
@@ -396,7 +396,7 @@ OpenXRInteractionProfileEditor::OpenXRInteractionProfileEditor() {
interaction_profile_sc->add_child(interaction_profile_hb);
}
void OpenXRInteractionProfileEditor::setup(Ref<OpenXRActionMap> p_action_map, Ref<OpenXRInteractionProfile> p_interaction_profile) {
void OpenXRInteractionProfileEditor::setup(const Ref<OpenXRActionMap> &p_action_map, const Ref<OpenXRInteractionProfile> &p_interaction_profile) {
OpenXRInteractionProfileEditorBase::setup(p_action_map, p_interaction_profile);
select_action_dialog = memnew(OpenXRSelectActionDialog(p_action_map));