godotengine / godot

Godot Engine – Multi-platform 2D and 3D game engine
https://godotengine.org
MIT License
90.12k stars 21.16k forks source link

VoxelGI information label is cut off #53529

Closed Calinou closed 2 years ago

Calinou commented 3 years ago

Godot version

4.0.dev (2fc31fdfc)

System information

Fedora 34, GeForce GTX 1080 (NVIDIA 470.57.02)

Issue description

The information label that displays the VoxelGI's VRAM size is cut off:

Cut off label

It's supposed to display 128 × 128 × 128 - VRAM Size: 8 MB.

The label's text is set here: https://github.com/godotengine/godot/blob/8afd2171d1f767c13a18b478b8fc8e6cb9df2157/editor/plugins/voxel_gi_editor_plugin.cpp#L64-L96

Printing text with print_line() confirms that the text here is correct, but the Label node itself is cut off. This may be due to https://github.com/godotengine/godot/pull/35891.

Steps to reproduce

Minimal reproduction project

N/A

mrjustaguy commented 3 years ago

I think there might be some other similar issues with unintended cutoff like with this VoxelGI example

Calinou commented 3 years ago

I reverted https://github.com/godotengine/godot/pull/35891's commit (https://github.com/godotengine/godot/commit/81d2d2b41ad286c29f513ff5221938b3760f48ba) locally and it resolved the issue:

image

This means this bug is a regression from https://github.com/godotengine/godot/pull/35891.

Revert patch ```patch From 507695a6a74448f3c48d99615264351a780772fa Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Thu, 7 Oct 2021 16:11:39 +0200 Subject: [PATCH] Revert "Highlight context menu items at the top of the 2D/3D viewports" This reverts commit 81d2d2b41ad286c29f513ff5221938b3760f48ba. --- editor/plugins/canvas_item_editor_plugin.cpp | 40 +++----------------- editor/plugins/canvas_item_editor_plugin.h | 5 --- editor/plugins/node_3d_editor_plugin.cpp | 29 +------------- editor/plugins/node_3d_editor_plugin.h | 5 --- 4 files changed, 7 insertions(+), 72 deletions(-) diff --git a/editor/plugins/canvas_item_editor_plugin.cpp b/editor/plugins/canvas_item_editor_plugin.cpp index ef872bcead..be8acc1bb7 100644 --- a/editor/plugins/canvas_item_editor_plugin.cpp +++ b/editor/plugins/canvas_item_editor_plugin.cpp @@ -3856,10 +3856,7 @@ void CanvasItemEditor::_notification(int p_what) { key_auto_insert_button->add_theme_color_override("icon_pressed_color", key_auto_color.lerp(Color(1, 0, 0), 0.55)); animation_menu->set_icon(get_theme_icon(SNAME("GuiTabMenuHl"), SNAME("EditorIcons"))); - _update_context_menu_stylebox(); - presets_menu->set_icon(get_theme_icon(SNAME("ControlLayout"), SNAME("EditorIcons"))); - PopupMenu *p = presets_menu->get_popup(); p->clear(); @@ -3965,18 +3962,6 @@ void CanvasItemEditor::edit(CanvasItem *p_canvas_item) { } } -void CanvasItemEditor::_update_context_menu_stylebox() { - // This must be called when the theme changes to follow the new accent color. - Ref context_menu_stylebox = memnew(StyleBoxFlat); - const Color accent_color = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("accent_color"), SNAME("Editor")); - context_menu_stylebox->set_bg_color(accent_color * Color(1, 1, 1, 0.1)); - // Add an underline to the StyleBox, but prevent its minimum vertical size from changing. - context_menu_stylebox->set_border_color(accent_color); - context_menu_stylebox->set_border_width(SIDE_BOTTOM, Math::round(2 * EDSCALE)); - context_menu_stylebox->set_default_margin(SIDE_BOTTOM, 0); - context_menu_container->add_theme_style_override("panel", context_menu_stylebox); -} - void CanvasItemEditor::_update_scrollbars() { updating_scroll = true; @@ -5150,11 +5135,11 @@ void CanvasItemEditor::remove_control_from_info_overlay(Control *p_control) { void CanvasItemEditor::add_control_to_menu_panel(Control *p_control) { ERR_FAIL_COND(!p_control); - hbc_context_menu->add_child(p_control); + hb->add_child(p_control); } void CanvasItemEditor::remove_control_from_menu_panel(Control *p_control) { - hbc_context_menu->remove_child(p_control); + hb->remove_child(p_control); } HSplitContainer *CanvasItemEditor::get_palette_split() { @@ -5533,21 +5518,10 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { p->add_separator(); p->add_check_shortcut(ED_SHORTCUT("canvas_item_editor/preview_canvas_scale", TTR("Preview Canvas Scale"), KEY_MASK_SHIFT | KEY_MASK_CMD | KEY_P), PREVIEW_CANVAS_SCALE); - hb->add_child(memnew(VSeparator)); - - context_menu_container = memnew(PanelContainer); - hbc_context_menu = memnew(HBoxContainer); - context_menu_container->add_child(hbc_context_menu); - // Use a custom stylebox to make contextual menu items stand out from the rest. - // This helps with editor usability as contextual menu items change when selecting nodes, - // even though it may not be immediately obvious at first. - hb->add_child(context_menu_container); - _update_context_menu_stylebox(); - presets_menu = memnew(MenuButton); presets_menu->set_shortcut_context(this); presets_menu->set_text(TTR("Layout")); - hbc_context_menu->add_child(presets_menu); + hb->add_child(presets_menu); presets_menu->hide(); presets_menu->set_switch_on_hover(true); @@ -5561,18 +5535,17 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { anchor_mode_button = memnew(Button); anchor_mode_button->set_flat(true); - hbc_context_menu->add_child(anchor_mode_button); + hb->add_child(anchor_mode_button); anchor_mode_button->set_toggle_mode(true); anchor_mode_button->hide(); anchor_mode_button->connect("toggled", callable_mp(this, &CanvasItemEditor::_button_toggle_anchor_mode)); animation_hb = memnew(HBoxContainer); - hbc_context_menu->add_child(animation_hb); + hb->add_child(animation_hb); animation_hb->add_child(memnew(VSeparator)); animation_hb->hide(); key_loc_button = memnew(Button); - key_loc_button->set_flat(true); key_loc_button->set_toggle_mode(true); key_loc_button->set_pressed(true); key_loc_button->set_focus_mode(FOCUS_NONE); @@ -5581,7 +5554,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { animation_hb->add_child(key_loc_button); key_rot_button = memnew(Button); - key_rot_button->set_flat(true); key_rot_button->set_toggle_mode(true); key_rot_button->set_pressed(true); key_rot_button->set_focus_mode(FOCUS_NONE); @@ -5590,7 +5562,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { animation_hb->add_child(key_rot_button); key_scale_button = memnew(Button); - key_scale_button->set_flat(true); key_scale_button->set_toggle_mode(true); key_scale_button->set_focus_mode(FOCUS_NONE); key_scale_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_SCALE)); @@ -5598,7 +5569,6 @@ CanvasItemEditor::CanvasItemEditor(EditorNode *p_editor) { animation_hb->add_child(key_scale_button); key_insert_button = memnew(Button); - key_insert_button->set_flat(true); key_insert_button->set_focus_mode(FOCUS_NONE); key_insert_button->connect("pressed", callable_mp(this, &CanvasItemEditor::_popup_callback), varray(ANIM_INSERT_KEY)); key_insert_button->set_tooltip(TTR("Insert keys (based on mask).")); diff --git a/editor/plugins/canvas_item_editor_plugin.h b/editor/plugins/canvas_item_editor_plugin.h index 1965efbf30..42aa89f748 100644 --- a/editor/plugins/canvas_item_editor_plugin.h +++ b/editor/plugins/canvas_item_editor_plugin.h @@ -230,10 +230,6 @@ private: HScrollBar *h_scroll; VScrollBar *v_scroll; HBoxContainer *hb; - // Used for secondary menu items which are displayed depending on the currently selected node - // (such as MeshInstance's "Mesh" menu). - PanelContainer *context_menu_container; - HBoxContainer *hbc_context_menu; Map popup_temporarily_timers; @@ -539,7 +535,6 @@ private: HSplitContainer *palette_split; VSplitContainer *bottom_split; - void _update_context_menu_stylebox(); void _popup_warning_temporarily(Control *p_control, const double p_duration); void _popup_warning_depop(Control *p_control); diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index ea6ef8ab84..c9b3e4ef51 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -6052,18 +6052,6 @@ void fragment() { _generate_selection_boxes(); } -void Node3DEditor::_update_context_menu_stylebox() { - // This must be called when the theme changes to follow the new accent color. - Ref context_menu_stylebox = memnew(StyleBoxFlat); - const Color accent_color = EditorNode::get_singleton()->get_gui_base()->get_theme_color(SNAME("accent_color"), SNAME("Editor")); - context_menu_stylebox->set_bg_color(accent_color * Color(1, 1, 1, 0.1)); - // Add an underline to the StyleBox, but prevent its minimum vertical size from changing. - context_menu_stylebox->set_border_color(accent_color); - context_menu_stylebox->set_border_width(SIDE_BOTTOM, Math::round(2 * EDSCALE)); - context_menu_stylebox->set_default_margin(SIDE_BOTTOM, 0); - context_menu_container->add_theme_style_override("panel", context_menu_stylebox); -} - void Node3DEditor::_update_gizmos_menu() { gizmos_menu->clear(); @@ -6674,7 +6662,6 @@ void Node3DEditor::_notification(int p_what) { case NOTIFICATION_THEME_CHANGED: { _update_theme(); _update_gizmos_menu_theme(); - _update_context_menu_stylebox(); sun_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window"))); environ_title->add_theme_font_override("font", get_theme_font(SNAME("title_font"), SNAME("Window"))); } break; @@ -6723,11 +6710,11 @@ Vector Node3DEditor::get_subgizmo_selection() { } void Node3DEditor::add_control_to_menu_panel(Control *p_control) { - hbc_context_menu->add_child(p_control); + hbc_menu->add_child(p_control); } void Node3DEditor::remove_control_from_menu_panel(Control *p_control) { - hbc_context_menu->remove_child(p_control); + hbc_menu->remove_child(p_control); } void Node3DEditor::set_can_preview(Camera3D *p_preview) { @@ -7337,18 +7324,6 @@ Node3DEditor::Node3DEditor(EditorNode *p_editor) { view_menu->set_shortcut_context(this); hbc_menu->add_child(view_menu); - hbc_menu->add_child(memnew(VSeparator)); - - context_menu_container = memnew(PanelContainer); - hbc_context_menu = memnew(HBoxContainer); - context_menu_container->add_child(hbc_context_menu); - // Use a custom stylebox to make contextual menu items stand out from the rest. - // This helps with editor usability as contextual menu items change when selecting nodes, - // even though it may not be immediately obvious at first. - hbc_menu->add_child(context_menu_container); - _update_context_menu_stylebox(); - - // Get the view menu popup and have it stay open when a checkable item is selected p = view_menu->get_popup(); p->set_hide_on_checkable_item_selection(false); diff --git a/editor/plugins/node_3d_editor_plugin.h b/editor/plugins/node_3d_editor_plugin.h index 2d5aeaa981..127b204bad 100644 --- a/editor/plugins/node_3d_editor_plugin.h +++ b/editor/plugins/node_3d_editor_plugin.h @@ -636,10 +636,6 @@ private: void _update_camera_override_button(bool p_game_running); void _update_camera_override_viewport(Object *p_viewport); HBoxContainer *hbc_menu; - // Used for secondary menu items which are displayed depending on the currently selected node - // (such as MeshInstance's "Mesh" menu). - PanelContainer *context_menu_container; - HBoxContainer *hbc_context_menu; void _generate_selection_boxes(); UndoRedo *undo_redo; @@ -647,7 +643,6 @@ private: int camera_override_viewport_id; void _init_indicators(); - void _update_context_menu_stylebox(); void _update_gizmos_menu(); void _update_gizmos_menu_theme(); void _init_grid(); -- 2.31.1 ```
Calinou commented 2 years ago

Note that this issue also manifests itself in the GPUParticles3DCollisionSDF node editor, which has a similar VRAM size label. We can apply a similar fix there (use a tooltip instead of a label).