3636#include " editor/gui/editor_run_bar.h"
3737#include " editor/themes/editor_scale.h"
3838#include " scene/gui/check_box.h"
39+ #include " scene/gui/flow_container.h"
3940#include " scene/resources/image_texture.h"
4041
4142void EditorProfiler::_make_metric_ptrs (Metric &m) {
@@ -658,27 +659,39 @@ Vector<Vector<String>> EditorProfiler::get_data_as_csv() const {
658659
659660EditorProfiler::EditorProfiler () {
660661 HBoxContainer *hb = memnew (HBoxContainer);
662+ hb->add_theme_constant_override (SNAME (" separation" ), 8 * EDSCALE);
661663 add_child (hb);
664+
665+ FlowContainer *container = memnew (FlowContainer);
666+ container->set_h_size_flags (SIZE_EXPAND_FILL);
667+ container->add_theme_constant_override (SNAME (" h_separation" ), 8 * EDSCALE);
668+ container->add_theme_constant_override (SNAME (" v_separation" ), 2 * EDSCALE);
669+ hb->add_child (container);
670+
662671 activate = memnew (Button);
663672 activate->set_toggle_mode (true );
664673 activate->set_disabled (true );
665674 activate->set_text (TTR (" Start" ));
666675 activate->connect (SceneStringName (pressed), callable_mp (this , &EditorProfiler::_activate_pressed));
667- hb ->add_child (activate);
676+ container ->add_child (activate);
668677
669678 clear_button = memnew (Button);
670679 clear_button->set_text (TTR (" Clear" ));
671680 clear_button->connect (SceneStringName (pressed), callable_mp (this , &EditorProfiler::_clear_pressed));
672681 clear_button->set_disabled (true );
673- hb ->add_child (clear_button);
682+ container ->add_child (clear_button);
674683
675684 CheckBox *autostart_checkbox = memnew (CheckBox);
676685 autostart_checkbox->set_text (TTR (" Autostart" ));
677686 autostart_checkbox->set_pressed (EditorSettings::get_singleton ()->get_project_metadata (" debug_options" , " autostart_profiler" , false ));
678687 autostart_checkbox->connect (SceneStringName (toggled), callable_mp (this , &EditorProfiler::_autostart_toggled));
679- hb->add_child (autostart_checkbox);
688+ container->add_child (autostart_checkbox);
689+
690+ HBoxContainer *hb_measure = memnew (HBoxContainer);
691+ hb_measure->add_theme_constant_override (SNAME (" separation" ), 2 * EDSCALE);
692+ container->add_child (hb_measure);
680693
681- hb ->add_child (memnew (Label (TTR (" Measure:" ))));
694+ hb_measure ->add_child (memnew (Label (TTR (" Measure:" ))));
682695
683696 display_mode = memnew (OptionButton);
684697 display_mode->add_item (TTR (" Frame Time (ms)" ));
@@ -687,9 +700,13 @@ EditorProfiler::EditorProfiler() {
687700 display_mode->add_item (TTR (" Physics Frame %" ));
688701 display_mode->connect (SceneStringName (item_selected), callable_mp (this , &EditorProfiler::_combo_changed));
689702
690- hb ->add_child (display_mode);
703+ hb_measure ->add_child (display_mode);
691704
692- hb->add_child (memnew (Label (TTR (" Time:" ))));
705+ HBoxContainer *hb_time = memnew (HBoxContainer);
706+ hb_time->add_theme_constant_override (SNAME (" separation" ), 2 * EDSCALE);
707+ container->add_child (hb_time);
708+
709+ hb_time->add_child (memnew (Label (TTR (" Time:" ))));
693710
694711 display_time = memnew (OptionButton);
695712 // TRANSLATORS: This is an option in the profiler to display the time spent in a function, including the time spent in other functions called by that function.
@@ -698,28 +715,28 @@ EditorProfiler::EditorProfiler() {
698715 display_time->add_item (TTR (" Self" ));
699716 display_time->set_tooltip_text (TTR (" Inclusive: Includes time from other functions called by this function.\n Use this to spot bottlenecks.\n\n Self: Only count the time spent in the function itself, not in other functions called by that function.\n Use this to find individual functions to optimize." ));
700717 display_time->connect (SceneStringName (item_selected), callable_mp (this , &EditorProfiler::_combo_changed));
701-
702- hb->add_child (display_time);
718+ hb_time->add_child (display_time);
703719
704720 display_internal_profiles = memnew (CheckButton (TTR (" Display internal functions" )));
705721 display_internal_profiles->set_visible (EDITOR_GET (" debugger/profile_native_calls" ));
706722 display_internal_profiles->set_pressed (false );
707723 display_internal_profiles->connect (SceneStringName (pressed), callable_mp (this , &EditorProfiler::_internal_profiles_pressed));
708- hb ->add_child (display_internal_profiles);
724+ container ->add_child (display_internal_profiles);
709725
710- hb->add_spacer ();
726+ HBoxContainer *hb_frame = memnew (HBoxContainer);
727+ hb_frame->add_theme_constant_override (SNAME (" separation" ), 2 * EDSCALE);
728+ hb_frame->set_v_size_flags (SIZE_SHRINK_BEGIN);
729+ hb->add_child (hb_frame);
711730
712- hb ->add_child (memnew (Label (TTR (" Frame #:" ))));
731+ hb_frame ->add_child (memnew (Label (TTR (" Frame #:" ))));
713732
714733 cursor_metric_edit = memnew (SpinBox);
715734 cursor_metric_edit->set_h_size_flags (SIZE_FILL);
716735 cursor_metric_edit->set_value (0 );
717736 cursor_metric_edit->set_editable (false );
718- hb ->add_child (cursor_metric_edit);
737+ hb_frame ->add_child (cursor_metric_edit);
719738 cursor_metric_edit->connect (SceneStringName (value_changed), callable_mp (this , &EditorProfiler::_cursor_metric_changed));
720739
721- hb->add_theme_constant_override (" separation" , 8 * EDSCALE);
722-
723740 h_split = memnew (HSplitContainer);
724741 add_child (h_split);
725742 h_split->set_v_size_flags (SIZE_EXPAND_FILL);
0 commit comments