summaryrefslogtreecommitdiff
path: root/editor/shader_create_dialog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'editor/shader_create_dialog.cpp')
-rw-r--r--editor/shader_create_dialog.cpp43
1 files changed, 22 insertions, 21 deletions
diff --git a/editor/shader_create_dialog.cpp b/editor/shader_create_dialog.cpp
index bd1f2529ca..fc7fff325c 100644
--- a/editor/shader_create_dialog.cpp
+++ b/editor/shader_create_dialog.cpp
@@ -37,11 +37,16 @@
#include "scene/resources/visual_shader.h"
#include "servers/rendering/shader_types.h"
+enum ShaderType {
+ SHADER_TYPE_TEXT,
+ SHADER_TYPE_VISUAL,
+ SHADER_TYPE_INC,
+ SHADER_TYPE_MAX,
+};
+
void ShaderCreateDialog::_notification(int p_what) {
switch (p_what) {
case NOTIFICATION_ENTER_TREE: {
- _update_theme();
-
String last_lang = EditorSettings::get_singleton()->get_project_metadata("shader_setup", "last_selected_language", "");
if (!last_lang.is_empty()) {
for (int i = 0; i < type_menu->get_item_count(); i++) {
@@ -60,29 +65,25 @@ void ShaderCreateDialog::_notification(int p_what) {
} break;
case NOTIFICATION_THEME_CHANGED: {
- _update_theme();
- } break;
- }
-}
+ Ref<Texture2D> shader_icon = gc->get_theme_icon(SNAME("Shader"), SNAME("EditorIcons"));
+ if (shader_icon.is_valid()) {
+ type_menu->set_item_icon(0, shader_icon);
+ }
-void ShaderCreateDialog::_update_theme() {
- Ref<Texture2D> shader_icon = gc->get_theme_icon(SNAME("Shader"), SNAME("EditorIcons"));
- if (shader_icon.is_valid()) {
- type_menu->set_item_icon(0, shader_icon);
- }
+ Ref<Texture2D> visual_shader_icon = gc->get_theme_icon(SNAME("VisualShader"), SNAME("EditorIcons"));
+ if (visual_shader_icon.is_valid()) {
+ type_menu->set_item_icon(1, visual_shader_icon);
+ }
- Ref<Texture2D> visual_shader_icon = gc->get_theme_icon(SNAME("VisualShader"), SNAME("EditorIcons"));
- if (visual_shader_icon.is_valid()) {
- type_menu->set_item_icon(1, visual_shader_icon);
- }
+ Ref<Texture2D> include_icon = gc->get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons"));
+ if (include_icon.is_valid()) {
+ type_menu->set_item_icon(2, include_icon);
+ }
- Ref<Texture2D> include_icon = gc->get_theme_icon(SNAME("TextFile"), SNAME("EditorIcons"));
- if (include_icon.is_valid()) {
- type_menu->set_item_icon(2, include_icon);
+ path_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
+ status_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
+ } break;
}
-
- path_button->set_icon(get_theme_icon(SNAME("Folder"), SNAME("EditorIcons")));
- status_panel->add_theme_style_override("panel", get_theme_stylebox(SNAME("bg"), SNAME("Tree")));
}
void ShaderCreateDialog::_update_language_info() {