summaryrefslogtreecommitdiff
path: root/tools/editor/plugins
diff options
context:
space:
mode:
authorJuan Linietsky <reduzio@gmail.com>2016-06-08 20:00:02 -0300
committerJuan Linietsky <reduzio@gmail.com>2016-06-08 20:00:52 -0300
commitf8f30662d93a46eb4b1ece6d45be28760d5ad58c (patch)
tree3424b030b66b649cac699d813cf6d102677c4d7f /tools/editor/plugins
parent1bdb55831dc90075665b1900b1cf4cdf1a5fe335 (diff)
-Ability to reload (and soft reload) tool scripts. Please test!
Diffstat (limited to 'tools/editor/plugins')
-rw-r--r--tools/editor/plugins/script_editor_plugin.cpp13
-rw-r--r--tools/editor/plugins/script_editor_plugin.h2
2 files changed, 15 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 );
diff --git a/tools/editor/plugins/script_editor_plugin.h b/tools/editor/plugins/script_editor_plugin.h
index 4eb3519059..5a9dce759e 100644
--- a/tools/editor/plugins/script_editor_plugin.h
+++ b/tools/editor/plugins/script_editor_plugin.h
@@ -142,6 +142,8 @@ class ScriptEditor : public VBoxContainer {
EDIT_INDENT_RIGHT,
EDIT_INDENT_LEFT,
EDIT_CLONE_DOWN,
+ FILE_TOOL_RELOAD,
+ FILE_TOOL_RELOAD_SOFT,
SEARCH_FIND,
SEARCH_FIND_NEXT,
SEARCH_FIND_PREV,