1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-23 15:16:17 +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

@@ -44,7 +44,7 @@ class HBoxContainer;
class MeshInstance3D;
class SubViewport;
class SubViewportContainer;
class TextureButton;
class Button;
class MaterialEditor : public Control {
GDCLASS(MaterialEditor, Control);
@@ -71,27 +71,25 @@ class MaterialEditor : public Control {
HBoxContainer *layout_3d = nullptr;
TextureButton *sphere_switch = nullptr;
TextureButton *box_switch = nullptr;
TextureButton *light_1_switch = nullptr;
TextureButton *light_2_switch = nullptr;
Ref<Material> material;
Button *sphere_switch = nullptr;
Button *box_switch = nullptr;
Button *light_1_switch = nullptr;
Button *light_2_switch = nullptr;
struct ThemeCache {
Ref<Texture2D> light_1_on;
Ref<Texture2D> light_1_off;
Ref<Texture2D> light_2_on;
Ref<Texture2D> light_2_off;
Ref<Texture2D> sphere_on;
Ref<Texture2D> sphere_off;
Ref<Texture2D> box_on;
Ref<Texture2D> box_off;
Ref<Texture2D> light_1_icon;
Ref<Texture2D> light_2_icon;
Ref<Texture2D> sphere_icon;
Ref<Texture2D> box_icon;
Ref<Texture2D> checkerboard;
} theme_cache;
void _button_pressed(Node *p_button);
void _on_light_1_switch_pressed();
void _on_light_2_switch_pressed();
void _on_sphere_switch_pressed();
void _on_box_switch_pressed();
protected:
virtual void _update_theme_item_cache() override;