Skip to content

Commit 4201c7d

Browse files
committed
Make the frame time and info boxes have same margins
1 parent 25de53e commit 4201c7d

File tree

2 files changed

+17
-11
lines changed

2 files changed

+17
-11
lines changed

editor/plugins/node_3d_editor_plugin.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2903,8 +2903,8 @@ void Node3DEditorViewport::_notification(int p_what) {
29032903
}
29042904

29052905
bool show_info = view_menu->get_popup()->is_item_checked(view_menu->get_popup()->get_item_index(VIEW_INFORMATION));
2906-
if (show_info != info_label->is_visible()) {
2907-
info_label->set_visible(show_info);
2906+
if (show_info != info_panel->is_visible()) {
2907+
info_panel->set_visible(show_info);
29082908
}
29092909

29102910
Camera3D *current_camera;
@@ -3087,7 +3087,7 @@ void Node3DEditorViewport::_notification(int p_what) {
30873087
frame_time_gradient->set_color(1, get_theme_color(SNAME("warning_color"), EditorStringName(Editor)));
30883088
frame_time_gradient->set_color(2, get_theme_color(SNAME("error_color"), EditorStringName(Editor)));
30893089

3090-
info_label->add_theme_style_override(CoreStringName(normal), information_3d_stylebox);
3090+
info_panel->add_theme_style_override(SceneStringName(panel), information_3d_stylebox);
30913091

30923092
frame_time_panel->add_theme_style_override(SceneStringName(panel), information_3d_stylebox);
30933093
// Set a minimum width to prevent the width from changing all the time
@@ -5382,15 +5382,19 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
53825382
bottom_center_vbox->set_v_grow_direction(GROW_DIRECTION_BEGIN);
53835383
surface->add_child(bottom_center_vbox);
53845384

5385+
info_panel = memnew(PanelContainer);
5386+
info_panel->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, -90 * EDSCALE);
5387+
info_panel->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -90 * EDSCALE);
5388+
info_panel->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, -10 * EDSCALE);
5389+
info_panel->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, -10 * EDSCALE);
5390+
info_panel->set_h_grow_direction(GROW_DIRECTION_BEGIN);
5391+
info_panel->set_v_grow_direction(GROW_DIRECTION_BEGIN);
5392+
info_panel->set_mouse_filter(MOUSE_FILTER_IGNORE);
5393+
surface->add_child(info_panel);
5394+
info_panel->hide();
5395+
53855396
info_label = memnew(Label);
5386-
info_label->set_anchor_and_offset(SIDE_LEFT, ANCHOR_END, -90 * EDSCALE);
5387-
info_label->set_anchor_and_offset(SIDE_TOP, ANCHOR_END, -90 * EDSCALE);
5388-
info_label->set_anchor_and_offset(SIDE_RIGHT, ANCHOR_END, -10 * EDSCALE);
5389-
info_label->set_anchor_and_offset(SIDE_BOTTOM, ANCHOR_END, -10 * EDSCALE);
5390-
info_label->set_h_grow_direction(GROW_DIRECTION_BEGIN);
5391-
info_label->set_v_grow_direction(GROW_DIRECTION_BEGIN);
5392-
surface->add_child(info_label);
5393-
info_label->hide();
5397+
info_panel->add_child(info_label);
53945398

53955399
cinema_label = memnew(Label);
53965400
cinema_label->set_anchor_and_offset(SIDE_TOP, ANCHOR_BEGIN, 10 * EDSCALE);
@@ -5475,6 +5479,7 @@ Node3DEditorViewport::Node3DEditorViewport(Node3DEditor *p_spatial_editor, int p
54755479
top_right_vbox->add_child(rotation_control);
54765480

54775481
frame_time_panel = memnew(PanelContainer);
5482+
frame_time_panel->set_mouse_filter(MOUSE_FILTER_IGNORE);
54785483
top_right_vbox->add_child(frame_time_panel);
54795484
frame_time_panel->hide();
54805485

editor/plugins/node_3d_editor_plugin.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ class Node3DEditorViewport : public Control {
241241
real_t freelook_speed;
242242
Vector2 previous_mouse_position;
243243

244+
PanelContainer *info_panel = nullptr;
244245
Label *info_label = nullptr;
245246
Label *cinema_label = nullptr;
246247
Label *locked_label = nullptr;

0 commit comments

Comments
 (0)