diff options
author | Juan Linietsky <reduzio@gmail.com> | 2016-06-08 20:00:02 -0300 |
---|---|---|
committer | Juan Linietsky <reduzio@gmail.com> | 2016-06-08 20:00:52 -0300 |
commit | f8f30662d93a46eb4b1ece6d45be28760d5ad58c (patch) | |
tree | 3424b030b66b649cac699d813cf6d102677c4d7f /tools/editor/plugins/script_editor_plugin.cpp | |
parent | 1bdb55831dc90075665b1900b1cf4cdf1a5fe335 (diff) | |
download | redot-engine-f8f30662d93a46eb4b1ece6d45be28760d5ad58c.tar.gz |
-Ability to reload (and soft reload) tool scripts. Please test!
Diffstat (limited to 'tools/editor/plugins/script_editor_plugin.cpp')
-rw-r--r-- | tools/editor/plugins/script_editor_plugin.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/editor/plugins/script_editor_plugin.cpp b/tools/editor/plugins/script_editor_plugin.cpp index 1833e3844a..d2d1f9e625 100644 --- a/tools/editor/plugins/script_editor_plugin.cpp +++ b/tools/editor/plugins/script_editor_plugin.cpp @@ -1412,6 +1412,16 @@ void ScriptEditor::_menu_option(int p_option) { } break; + case FILE_TOOL_RELOAD: + case FILE_TOOL_RELOAD_SOFT: { + + TextEdit *te = current->get_text_edit(); + Ref<Script> scr = current->get_edited_script(); + if (scr.is_null()) + return; + scr->set_source_code(te->get_text()); + scr->get_language()->reload_tool_script(scr,p_option==FILE_TOOL_RELOAD_SOFT); + } break; case EDIT_TRIM_TRAILING_WHITESAPCE: { _trim_trailing_whitespace(current->get_text_edit()); } break; @@ -2602,6 +2612,9 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { edit_menu->get_popup()->add_item(TTR("Trim Trailing Whitespace"), EDIT_TRIM_TRAILING_WHITESAPCE, KEY_MASK_CTRL|KEY_MASK_ALT|KEY_T); edit_menu->get_popup()->add_item(TTR("Auto Indent"),EDIT_AUTO_INDENT,KEY_MASK_CMD|KEY_I); edit_menu->get_popup()->connect("item_pressed", this,"_menu_option"); + edit_menu->get_popup()->add_separator(); + edit_menu->get_popup()->add_item(TTR("Reload Tool Script"),FILE_TOOL_RELOAD,KEY_MASK_CMD|KEY_R); + edit_menu->get_popup()->add_item(TTR("Reload Tool Script (Soft)"),FILE_TOOL_RELOAD_SOFT,KEY_MASK_CMD|KEY_MASK_SHIFT|KEY_R); search_menu = memnew( MenuButton ); |