@@ -66,22 +66,23 @@ void OpenXRSelectInteractionProfileDialog::_on_select_interaction_profile(const
6666void OpenXRSelectInteractionProfileDialog::open (PackedStringArray p_do_not_include) {
6767 int available_count = 0 ;
6868
69- // out with the old.. .
70- while (main_vb->get_child_count () > 0 ) {
71- memdelete (main_vb->get_child (0 ));
69+ // Out with the old.
70+ while (main_vb->get_child_count () > 1 ) {
71+ memdelete (main_vb->get_child (1 ));
7272 }
7373
7474 selected_interaction_profile = " " ;
7575 ip_buttons.clear ();
7676
77- // in with the new
77+ // In with the new.
7878 PackedStringArray interaction_profiles = OpenXRInteractionProfileMetadata::get_singleton ()->get_interaction_profile_paths ();
7979 for (int i = 0 ; i < interaction_profiles.size (); i++) {
8080 const String &path = interaction_profiles[i];
8181 if (!p_do_not_include.has (path)) {
8282 Button *ip_button = memnew (Button);
8383 ip_button->set_flat (true );
8484 ip_button->set_text (OpenXRInteractionProfileMetadata::get_singleton ()->get_profile (path)->display_name );
85+ ip_button->set_text_alignment (HORIZONTAL_ALIGNMENT_LEFT);
8586 ip_button->connect (SceneStringName (pressed), callable_mp (this , &OpenXRSelectInteractionProfileDialog::_on_select_interaction_profile).bind (path));
8687 main_vb->add_child (ip_button);
8788
@@ -90,23 +91,16 @@ void OpenXRSelectInteractionProfileDialog::open(PackedStringArray p_do_not_inclu
9091 }
9192 }
9293
93- if (available_count == 0 ) {
94- // give warning that we have all profiles selected
95-
96- } else {
97- // TODO maybe if we only have one, auto select it?
98-
99- popup_centered ();
100- }
94+ all_selected->set_visible (available_count == 0 );
95+ get_cancel_button ()->set_visible (available_count > 0 );
96+ popup_centered ();
10197}
10298
10399void OpenXRSelectInteractionProfileDialog::ok_pressed () {
104- if (selected_interaction_profile = = " " ) {
105- return ;
100+ if (selected_interaction_profile ! = " " ) {
101+ emit_signal ( " interaction_profile_selected " , selected_interaction_profile) ;
106102 }
107103
108- emit_signal (" interaction_profile_selected" , selected_interaction_profile);
109-
110104 hide ();
111105}
112106
@@ -118,6 +112,10 @@ OpenXRSelectInteractionProfileDialog::OpenXRSelectInteractionProfileDialog() {
118112 add_child (scroll);
119113
120114 main_vb = memnew (VBoxContainer);
121- // main_vb->set_h_size_flags(Control::SIZE_EXPAND_FILL);
115+ main_vb->set_h_size_flags (Control::SIZE_EXPAND_FILL);
122116 scroll->add_child (main_vb);
117+
118+ all_selected = memnew (Label);
119+ all_selected->set_text (TTR (" All interaction profiles have been added to the action map." ));
120+ main_vb->add_child (all_selected);
123121}
0 commit comments