@@ -2038,8 +2038,7 @@ void ColorPicker::set_presets_visible(bool p_visible) {
20382038 return ;
20392039 }
20402040 presets_visible = p_visible;
2041- btn_preset->set_visible (p_visible);
2042- btn_recent_preset->set_visible (p_visible);
2041+ swatches_vbc->set_visible (p_visible);
20432042}
20442043
20452044bool ColorPicker::are_presets_visible () const {
@@ -2348,6 +2347,9 @@ ColorPicker::ColorPicker() {
23482347 _update_controls ();
23492348 updating = false ;
23502349
2350+ swatches_vbc = memnew (VBoxContainer);
2351+ real_vbox->add_child (swatches_vbc);
2352+
23512353 preset_container = memnew (GridContainer);
23522354 preset_container->set_h_size_flags (SIZE_EXPAND_FILL);
23532355 preset_container->set_columns (PRESET_COLUMN_COUNT);
@@ -2357,7 +2359,7 @@ ColorPicker::ColorPicker() {
23572359
23582360 HBoxContainer *palette_box = memnew (HBoxContainer);
23592361 palette_box->set_h_size_flags (SIZE_EXPAND_FILL);
2360- real_vbox ->add_child (palette_box);
2362+ swatches_vbc ->add_child (palette_box);
23612363
23622364 btn_preset = memnew (Button);
23632365 btn_preset->set_text (" Swatches" );
@@ -2382,9 +2384,9 @@ ColorPicker::ColorPicker() {
23822384 palette_name = memnew (Label);
23832385 palette_name->hide ();
23842386 palette_name->set_mouse_filter (MOUSE_FILTER_PASS);
2385- real_vbox ->add_child (palette_name);
2387+ swatches_vbc ->add_child (palette_name);
23862388
2387- real_vbox ->add_child (preset_container);
2389+ swatches_vbc ->add_child (preset_container);
23882390
23892391 recent_preset_hbc = memnew (HBoxContainer);
23902392 recent_preset_hbc->set_v_size_flags (SIZE_SHRINK_BEGIN);
@@ -2398,9 +2400,9 @@ ColorPicker::ColorPicker() {
23982400 btn_recent_preset->set_focus_mode (FOCUS_NONE);
23992401 btn_recent_preset->set_text_alignment (HORIZONTAL_ALIGNMENT_LEFT);
24002402 btn_recent_preset->connect (SceneStringName (toggled), callable_mp (this , &ColorPicker::_show_hide_preset).bind (btn_recent_preset, recent_preset_hbc));
2401- real_vbox ->add_child (btn_recent_preset);
2403+ swatches_vbc ->add_child (btn_recent_preset);
24022404
2403- real_vbox ->add_child (recent_preset_hbc);
2405+ swatches_vbc ->add_child (recent_preset_hbc);
24042406
24052407 set_pick_color (Color (1 , 1 , 1 ));
24062408
0 commit comments