Added link to docs for shader editor

(cherry picked from commit 770ce20ea3)
This commit is contained in:
Yuri Roubinski 2019-08-02 17:03:45 +03:00 committed by Rémi Verschelde
parent 7ebfb73a4a
commit b5d8154d17
2 changed files with 12 additions and 2 deletions

View File

@ -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);

View File

@ -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;