diff options
author | Yuri Roubinski <chaosus89@gmail.com> | 2019-08-25 10:33:18 +0300 |
---|---|---|
committer | Yuri Roubinski <chaosus89@gmail.com> | 2019-08-25 11:01:42 +0300 |
commit | 1d2e5f281e10de94e462b8d93af6842a628b1554 (patch) | |
tree | e0609ade71545a6fa8a8ded04bdf32cc34a40fe9 | |
parent | a7aacfef7f0753034d6ac468dba4574f8d04d357 (diff) |
Fixes for visual shader member filter
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.cpp | 23 | ||||
-rw-r--r-- | editor/plugins/visual_shader_editor_plugin.h | 1 |
2 files changed, 14 insertions, 10 deletions
diff --git a/editor/plugins/visual_shader_editor_plugin.cpp b/editor/plugins/visual_shader_editor_plugin.cpp index 55ff3fc3dd..2a5255fcdc 100644 --- a/editor/plugins/visual_shader_editor_plugin.cpp +++ b/editor/plugins/visual_shader_editor_plugin.cpp @@ -230,6 +230,14 @@ void VisualShaderEditor::_update_custom_nodes() { } } +String VisualShaderEditor::_get_description(int i) { + if (add_options[i].highend) { + return TTR("(GLES3 only)") + " " + add_options[i].description; // TODO: change it to (Vulkan Only) when its ready + } else { + return add_options[i].description; + } +} + void VisualShaderEditor::_update_options_menu() { node_desc->set_text(""); @@ -333,11 +341,10 @@ void VisualShaderEditor::_update_options_menu() { else if (add_options[i].highend) item->set_custom_color(0, supported_color); item->set_text(0, add_options[i].name); - if (p_category == sub_category) { - if (is_first_item) { - item->select(0); - is_first_item = false; - } + if (is_first_item && use_filter) { + item->select(0); + node_desc->set_text(_get_description(i)); + is_first_item = false; } switch (add_options[i].return_type) { case VisualShaderNode::PORT_TYPE_SCALAR: @@ -1930,11 +1937,7 @@ void VisualShaderEditor::_member_selected() { if (item != NULL && item->has_meta("id")) { members_dialog->get_ok()->set_disabled(false); - if (add_options[item->get_meta("id")].highend) { - node_desc->set_text(TTR("(GLES3 only)") + " " + add_options[item->get_meta("id")].description); // TODO: change it to (Vulkan Only) when its ready - } else { - node_desc->set_text(add_options[item->get_meta("id")].description); - } + node_desc->set_text(_get_description(item->get_meta("id"))); } else { members_dialog->get_ok()->set_disabled(true); node_desc->set_text(""); diff --git a/editor/plugins/visual_shader_editor_plugin.h b/editor/plugins/visual_shader_editor_plugin.h index a2e9516a6e..4fee2ac920 100644 --- a/editor/plugins/visual_shader_editor_plugin.h +++ b/editor/plugins/visual_shader_editor_plugin.h @@ -158,6 +158,7 @@ class VisualShaderEditor : public VBoxContainer { void _show_preview_text(); void _update_preview(); + String _get_description(int i); static VisualShaderEditor *singleton; |