Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix PopupPanel and PopupMenu menu styles #96518

Merged
merged 1 commit into from
Oct 24, 2024

Conversation

Giganzo
Copy link
Contributor

@Giganzo Giganzo commented Sep 3, 2024

Fixes: #96517
Edit: Fixes: #67657 (border part)

This makes popup menus using PopupPanel and PopupMenus have same base look, as it is in Godot 3.

Panel border

Adding a default border to the PopupPanel to make it easier to differentiate from the background.
I believe this was removed in PR #45607 and then added back for PopupMenus in PR #48655 (also removed support for Border Size on PopupMenus)

Before:
ps_ss_before

After:
Screenshot_20240902_224247

Border color

In Godot 3 both styles of popup menus uses the same border color, light on dark theme and dark border on light themes.

Godot 3 example:

1 2
ps_3_2 ps_3_1

Currently Godot 4 uses dark border for PopupMenus and with Border Size in Editor Settings set to 1 or 2 PopupPanel uses a light border in dark themes.

Before: with border size set

1 2
Screenshot_20240902_133942 ps_border_size_color_before

After: border size is set to deafult

1 2
Screenshot_20240903_000646 Screenshot_20240902_224259

Because the PopupMenu border is visible by default I went with that color for both in this PR.

Maybe there could be a editor setting for changing outline color, but that would need to be a proposal in that case.

Border Size

In Godot 3 both PopupPanel and PopupMenus uses the Border Size.

PopupPanel uses this already.

This PR also changes PopupMenus to use the editor setting Border Size for the outer border.

Separator width

Due to the change of using Border Size the separator line in PopupMenus was much more obvious that it overlaps the outer border. So this was also changed

Before:
ps_sep_zoom_before

After:
Screenshot_20240902_224601

Compact

Before:
ps_ap_compact_before

After:
Screenshot_20240903_003120

@@ -1331,17 +1334,17 @@ void EditorThemeManager::_populate_standard_styles(const Ref<EditorTheme> &p_the

Ref<StyleBoxLine> style_popup_separator(memnew(StyleBoxLine));
style_popup_separator->set_color(p_config.separator_color);
style_popup_separator->set_grow_begin(p_config.popup_margin - MAX(Math::round(EDSCALE), p_config.border_width));
style_popup_separator->set_grow_end(p_config.popup_margin - MAX(Math::round(EDSCALE), p_config.border_width));
style_popup_separator->set_grow_begin(Math::round(EDSCALE) - MAX(Math::round(EDSCALE), p_config.border_width));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks sus. There is EDSCALE on both sides, so this has high chance of being 0. Though not sure what's the expected value here.

Copy link
Member

@KoBeWi KoBeWi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested some popups and they visually look fine with default settings. The border is an improvement.

@KoBeWi KoBeWi requested a review from Calinou September 28, 2024 20:03
@akien-mga akien-mga modified the milestones: 4.x, 4.4 Oct 1, 2024
@KoBeWi KoBeWi force-pushed the popup-panel-style branch from 0c75c1f to 549bffd Compare October 20, 2024 11:27
@KoBeWi KoBeWi requested a review from a team as a code owner October 20, 2024 11:27
@Repiteo Repiteo merged commit 3b70a96 into godotengine:master Oct 24, 2024
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 24, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants