summaryrefslogtreecommitdiff
path: root/editor/plugins
diff options
context:
space:
mode:
authorYuri Roubinsky <chaosus89@gmail.com>2021-12-21 17:21:55 +0300
committerYuri Roubinsky <chaosus89@gmail.com>2021-12-21 22:20:09 +0300
commite8a457ba898ffde5dbc02d573103f00d626f3a5b (patch)
treebe17a45bf01aa3118c9c35729bcd28aa0dd106f0 /editor/plugins
parentd3d6208ec8ef3007400384c96d31f6e308c71827 (diff)
Refactor render_mode in shaders, forbid declaring duplicates
Diffstat (limited to 'editor/plugins')
-rw-r--r--editor/plugins/shader_editor_plugin.cpp14
1 files changed, 12 insertions, 2 deletions
diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp
index fa23ccf200..d5ee52dfab 100644
--- a/editor/plugins/shader_editor_plugin.cpp
+++ b/editor/plugins/shader_editor_plugin.cpp
@@ -138,8 +138,18 @@ void ShaderTextEditor::_load_theme_settings() {
}
}
- for (int i = 0; i < ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader->get_mode())).size(); i++) {
- built_ins.push_back(ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader->get_mode()))[i]);
+ const Vector<ShaderLanguage::ModeInfo> &modes = ShaderTypes::get_singleton()->get_modes(RenderingServer::ShaderMode(shader->get_mode()));
+
+ for (int i = 0; i < modes.size(); i++) {
+ const ShaderLanguage::ModeInfo &info = modes[i];
+
+ if (!info.options.is_empty()) {
+ for (int j = 0; j < info.options.size(); j++) {
+ built_ins.push_back(String(info.name) + "_" + String(info.options[j]));
+ }
+ } else {
+ built_ins.push_back(String(info.name));
+ }
}
}