From b5d8154d170c7e0820ec170e5951087fce9b9868 Mon Sep 17 00:00:00 2001 From: Yuri Roubinski Date: Fri, 2 Aug 2019 17:03:45 +0300 Subject: [PATCH] Added link to docs for shader editor (cherry picked from commit 770ce20ea3b8e4e75d4b9e74dd124726583acb1c) --- editor/plugins/shader_editor_plugin.cpp | 10 ++++++++++ editor/plugins/shader_editor_plugin.h | 4 ++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/editor/plugins/shader_editor_plugin.cpp b/editor/plugins/shader_editor_plugin.cpp index 428dd28c097..8e5a3df5edd 100644 --- a/editor/plugins/shader_editor_plugin.cpp +++ b/editor/plugins/shader_editor_plugin.cpp @@ -346,6 +346,9 @@ void ShaderEditor::_menu_option(int p_option) { goto_line_dialog->popup_find_line(shader_editor->get_text_edit()); } break; + case HELP_DOCS: { + OS::get_singleton()->shell_open("https://docs.godotengine.org/en/stable/tutorials/shading/shading_reference/index.html"); + } break; } if (p_option != SEARCH_FIND && p_option != SEARCH_REPLACE && p_option != SEARCH_GOTO_LINE) { shader_editor->get_text_edit()->call_deferred("grab_focus"); @@ -577,10 +580,17 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) { search_menu->get_popup()->add_shortcut(ED_GET_SHORTCUT("script_text_editor/goto_line"), SEARCH_GOTO_LINE); search_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + help_menu = memnew(MenuButton); + help_menu->set_text(TTR("Help")); + help_menu->set_switch_on_hover(true); + help_menu->get_popup()->add_icon_item(p_node->get_gui_base()->get_icon("Instance", "EditorIcons"), TTR("Online Docs"), HELP_DOCS); + help_menu->get_popup()->connect("id_pressed", this, "_menu_option"); + add_child(main_container); main_container->add_child(hbc); hbc->add_child(search_menu); hbc->add_child(edit_menu); + hbc->add_child(help_menu); hbc->add_style_override("panel", p_node->get_gui_base()->get_stylebox("ScriptEditorPanel", "EditorStyles")); main_container->add_child(shader_editor); diff --git a/editor/plugins/shader_editor_plugin.h b/editor/plugins/shader_editor_plugin.h index 46c78c1d33e..c8b5956b0dd 100644 --- a/editor/plugins/shader_editor_plugin.h +++ b/editor/plugins/shader_editor_plugin.h @@ -88,12 +88,12 @@ class ShaderEditor : public PanelContainer { SEARCH_FIND_PREV, SEARCH_REPLACE, SEARCH_GOTO_LINE, - + HELP_DOCS, }; MenuButton *edit_menu; MenuButton *search_menu; - MenuButton *settings_menu; + MenuButton *help_menu; PopupMenu *context_menu; uint64_t idle;