1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Improve material and mesh preview buttons

This commit is contained in:
MewPurPur
2023-06-29 13:48:53 +02:00
parent a7583881af
commit 50f4c298e6
14 changed files with 123 additions and 117 deletions

View File

@@ -173,12 +173,6 @@ void EditorColorMap::create() {
add_conversion_exception("Sky");
add_conversion_exception("EditorControlAnchor");
add_conversion_exception("DefaultProjectIcon");
add_conversion_exception("GuiChecked");
add_conversion_exception("GuiRadioChecked");
add_conversion_exception("GuiIndeterminate");
add_conversion_exception("GuiCloseCustomizable");
add_conversion_exception("GuiGraphNodePort");
add_conversion_exception("GuiResizer");
add_conversion_exception("ZoomMore");
add_conversion_exception("ZoomLess");
add_conversion_exception("ZoomReset");
@@ -188,6 +182,18 @@ void EditorColorMap::create() {
add_conversion_exception("StatusSuccess");
add_conversion_exception("StatusWarning");
add_conversion_exception("OverbrightIndicator");
add_conversion_exception("MaterialPreviewCube");
add_conversion_exception("MaterialPreviewSphere");
add_conversion_exception("MaterialPreviewLight1");
add_conversion_exception("MaterialPreviewLight2");
// GUI
add_conversion_exception("GuiChecked");
add_conversion_exception("GuiRadioChecked");
add_conversion_exception("GuiIndeterminate");
add_conversion_exception("GuiCloseCustomizable");
add_conversion_exception("GuiGraphNodePort");
add_conversion_exception("GuiResizer");
add_conversion_exception("GuiMiniCheckerboard");
/// Code Editor.
@@ -941,6 +947,25 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
editor_log_button_pressed->set_border_color(accent_color);
theme->set_stylebox("pressed", "EditorLogFilterButton", editor_log_button_pressed);
// Buttons in material previews
const Color dim_light_color = icon_normal_color.darkened(0.24);
const Color dim_light_highlighted_color = icon_normal_color.darkened(0.18);
Ref<StyleBox> sb_empty_borderless = make_empty_stylebox();
theme->set_type_variation("PreviewLightButton", "Button");
// When pressed, don't use the accent color tint. When unpressed, dim the icon.
theme->set_color("icon_normal_color", "PreviewLightButton", dim_light_color);
theme->set_color("icon_focus_color", "PreviewLightButton", dim_light_color);
theme->set_color("icon_pressed_color", "PreviewLightButton", icon_normal_color);
theme->set_color("icon_hover_pressed_color", "PreviewLightButton", icon_normal_color);
// Unpressed icon is dim, so use a dim highlight.
theme->set_color("icon_hover_color", "PreviewLightButton", dim_light_highlighted_color);
theme->set_stylebox("normal", "PreviewLightButton", sb_empty_borderless);
theme->set_stylebox("hover", "PreviewLightButton", sb_empty_borderless);
theme->set_stylebox("focus", "PreviewLightButton", sb_empty_borderless);
theme->set_stylebox("pressed", "PreviewLightButton", sb_empty_borderless);
// ProjectTag
{
theme->set_type_variation("ProjectTag", "Button");