Merge pull request #36150 from Chaosus/vs_vk_label

Added high-end (Vulkan) label to some functions in visual shader
This commit is contained in:
Yuri Roubinsky 2020-02-13 09:03:03 +03:00 committed by GitHub
commit 3bc7fe5f1c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 25 additions and 7 deletions

View File

@ -5356,7 +5356,7 @@ void EditorNode::_update_video_driver_color() {
} else if (video_driver->get_text() == "GLES3") { } else if (video_driver->get_text() == "GLES3") {
video_driver->add_color_override("font_color", Color::hex(0xa5557dff)); video_driver->add_color_override("font_color", Color::hex(0xa5557dff));
} else if (video_driver->get_text() == "Vulkan") { } else if (video_driver->get_text() == "Vulkan") {
video_driver->add_color_override("font_color", Color::hex(0xad1128ff)); video_driver->add_color_override("font_color", theme_base->get_color("vulkan_color", "Editor"));
} }
} }

View File

@ -409,6 +409,11 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_color("error_color", "Editor", error_color); theme->set_color("error_color", "Editor", error_color);
theme->set_color("property_color", "Editor", property_color); theme->set_color("property_color", "Editor", property_color);
if (!dark_theme) {
theme->set_color("vulkan_color", "Editor", Color::hex(0xad1128ff));
} else {
theme->set_color("vulkan_color", "Editor", Color(1.0, 0.0, 0.0));
}
const int thumb_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size"); const int thumb_size = EDITOR_GET("filesystem/file_dialog/thumbnail_size");
theme->set_constant("scale", "Editor", EDSCALE); theme->set_constant("scale", "Editor", EDSCALE);
theme->set_constant("thumb_size", "Editor", thumb_size); theme->set_constant("thumb_size", "Editor", thumb_size);

View File

@ -284,12 +284,8 @@ void VisualShaderEditor::update_custom_nodes() {
} }
String VisualShaderEditor::_get_description(int p_idx) { String VisualShaderEditor::_get_description(int p_idx) {
if (add_options[p_idx].highend) {
return TTR("(GLES3 only)") + " " + add_options[p_idx].description; // TODO: change it to (Vulkan Only) when its ready
} else {
return add_options[p_idx].description; return add_options[p_idx].description;
} }
}
void VisualShaderEditor::_update_options_menu() { void VisualShaderEditor::_update_options_menu() {
@ -1680,6 +1676,8 @@ void VisualShaderEditor::_notification(int p_what) {
if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) { if (p_what == NOTIFICATION_ENTER_TREE || p_what == NOTIFICATION_THEME_CHANGED) {
highend_label->set_modulate(get_color("vulkan_color", "Editor"));
error_panel->add_style_override("panel", get_stylebox("bg", "Tree")); error_panel->add_style_override("panel", get_stylebox("bg", "Tree"));
error_label->add_color_override("font_color", get_color("error_color", "Editor")); error_label->add_color_override("font_color", get_color("error_color", "Editor"));
@ -2037,8 +2035,10 @@ void VisualShaderEditor::_member_selected() {
if (item != NULL && item->has_meta("id")) { if (item != NULL && item->has_meta("id")) {
members_dialog->get_ok()->set_disabled(false); members_dialog->get_ok()->set_disabled(false);
highend_label->set_visible(add_options[item->get_meta("id")].highend);
node_desc->set_text(_get_description(item->get_meta("id"))); node_desc->set_text(_get_description(item->get_meta("id")));
} else { } else {
highend_label->set_visible(false);
members_dialog->get_ok()->set_disabled(true); members_dialog->get_ok()->set_disabled(true);
node_desc->set_text(""); node_desc->set_text("");
} }
@ -2425,10 +2425,22 @@ VisualShaderEditor::VisualShaderEditor() {
members->connect("item_selected", this, "_member_selected"); members->connect("item_selected", this, "_member_selected");
members->connect("nothing_selected", this, "_member_unselected"); members->connect("nothing_selected", this, "_member_unselected");
HBoxContainer *desc_hbox = memnew(HBoxContainer);
members_vb->add_child(desc_hbox);
Label *desc_label = memnew(Label); Label *desc_label = memnew(Label);
members_vb->add_child(desc_label); desc_hbox->add_child(desc_label);
desc_label->set_text(TTR("Description:")); desc_label->set_text(TTR("Description:"));
desc_hbox->add_spacer();
highend_label = memnew(Label);
desc_hbox->add_child(highend_label);
highend_label->set_visible(false);
highend_label->set_text("Vulkan");
highend_label->set_mouse_filter(Control::MOUSE_FILTER_STOP);
highend_label->set_tooltip(TTR("High-end node"));
node_desc = memnew(RichTextLabel); node_desc = memnew(RichTextLabel);
members_vb->add_child(node_desc); members_vb->add_child(node_desc);
node_desc->set_h_size_flags(SIZE_EXPAND_FILL); node_desc->set_h_size_flags(SIZE_EXPAND_FILL);

View File

@ -94,6 +94,7 @@ class VisualShaderEditor : public VBoxContainer {
AcceptDialog *alert; AcceptDialog *alert;
LineEdit *node_filter; LineEdit *node_filter;
RichTextLabel *node_desc; RichTextLabel *node_desc;
Label *highend_label;
void _tools_menu_option(int p_idx); void _tools_menu_option(int p_idx);
void _show_members_dialog(bool at_mouse_pos); void _show_members_dialog(bool at_mouse_pos);