1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +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

@@ -109,14 +109,11 @@ StyleBoxPreview::StyleBoxPreview() {
set_anchors_and_offsets_preset(PRESET_FULL_RECT);
grid_preview = memnew(Button);
// This theme variation works better than the normal theme because there's no focus highlight.
grid_preview->set_theme_type_variation("PreviewLightButton");
grid_preview->set_toggle_mode(true);
grid_preview->connect("toggled", callable_mp(this, &StyleBoxPreview::_grid_preview_toggled));
grid_preview->set_pressed(grid_preview_enabled);
grid_preview->set_flat(true);
grid_preview->add_theme_style_override("normal", memnew(StyleBoxEmpty));
grid_preview->add_theme_style_override("hover", memnew(StyleBoxEmpty));
grid_preview->add_theme_style_override("focus", memnew(StyleBoxEmpty));
grid_preview->add_theme_style_override("pressed", memnew(StyleBoxEmpty));
add_child(grid_preview);
}