Merge pull request #31033 from Chaosus/shader_button

Added link to docs for shader editor
This commit is contained in:
Rémi Verschelde 2019-08-02 16:30:43 +02:00 committed by GitHub
commit 045ab51ae5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -342,6 +342,9 @@ void ShaderEditor::_menu_option(int p_option) {
shader_editor->remove_all_bookmarks(); shader_editor->remove_all_bookmarks();
} break; } 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) { if (p_option != SEARCH_FIND && p_option != SEARCH_REPLACE && p_option != SEARCH_GOTO_LINE) {
shader_editor->get_text_edit()->call_deferred("grab_focus"); shader_editor->get_text_edit()->call_deferred("grab_focus");
@ -657,11 +660,18 @@ ShaderEditor::ShaderEditor(EditorNode *p_node) {
bookmarks_menu->connect("about_to_show", this, "_update_bookmark_list"); bookmarks_menu->connect("about_to_show", this, "_update_bookmark_list");
bookmarks_menu->get_popup()->connect("index_pressed", this, "_bookmark_item_pressed"); bookmarks_menu->get_popup()->connect("index_pressed", this, "_bookmark_item_pressed");
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); add_child(main_container);
main_container->add_child(hbc); main_container->add_child(hbc);
hbc->add_child(search_menu); hbc->add_child(search_menu);
hbc->add_child(edit_menu); hbc->add_child(edit_menu);
hbc->add_child(bookmarks_menu); hbc->add_child(bookmarks_menu);
hbc->add_child(help_menu);
hbc->add_style_override("panel", p_node->get_gui_base()->get_stylebox("ScriptEditorPanel", "EditorStyles")); hbc->add_style_override("panel", p_node->get_gui_base()->get_stylebox("ScriptEditorPanel", "EditorStyles"));
main_container->add_child(shader_editor); main_container->add_child(shader_editor);

View File

@ -94,13 +94,13 @@ class ShaderEditor : public PanelContainer {
BOOKMARK_GOTO_NEXT, BOOKMARK_GOTO_NEXT,
BOOKMARK_GOTO_PREV, BOOKMARK_GOTO_PREV,
BOOKMARK_REMOVE_ALL, BOOKMARK_REMOVE_ALL,
HELP_DOCS,
}; };
MenuButton *edit_menu; MenuButton *edit_menu;
MenuButton *search_menu; MenuButton *search_menu;
MenuButton *bookmarks_menu; MenuButton *bookmarks_menu;
MenuButton *settings_menu; MenuButton *help_menu;
PopupMenu *context_menu; PopupMenu *context_menu;
uint64_t idle; uint64_t idle;