Cleaned up remote menu

-Merged fileserver & deploy dumb clients option
-Live Script Reloading can now happen automatically on script save
-Changed Live to Mirror term to differentiate from Unity and Unreal, as
what Godot does is not the same thing.
This commit is contained in:
Juan Linietsky 2016-06-03 12:34:11 -03:00
parent a0a16aec3a
commit 2ca4995a6f
4 changed files with 42 additions and 11 deletions

View file

@ -2760,10 +2760,12 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
if (ischecked) {
file_server->stop();
run_native->set_deploy_dumb(false);
//debug_button->set_icon(gui_base->get_icon("FileServer","EditorIcons"));
//debug_button->get_popup()->set_item_text( debug_button->get_popup()->get_item_index(RUN_FILE_SERVER),"Enable File Server");
} else {
file_server->start();
run_native->set_deploy_dumb(true);
//debug_button->set_icon(gui_base->get_icon("FileServerActive","EditorIcons"));
//debug_button->get_popup()->set_item_text( debug_button->get_popup()->get_item_index(RUN_FILE_SERVER),"Disable File Server");
}
@ -2779,13 +2781,13 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
ScriptEditor::get_singleton()->get_debugger()->set_live_debugging(!ischecked);
} break;
case RUN_DEPLOY_DUMB_CLIENTS: {
/*case RUN_DEPLOY_DUMB_CLIENTS: {
bool ischecked = debug_button->get_popup()->is_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS));
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_DUMB_CLIENTS),!ischecked);
run_native->set_deploy_dumb(!ischecked);
} break;
} break;*/
case RUN_DEPLOY_REMOTE_DEBUG: {
bool ischecked = debug_button->get_popup()->is_item_checked( debug_button->get_popup()->get_item_index(RUN_DEPLOY_REMOTE_DEBUG));
@ -2809,7 +2811,11 @@ void EditorNode::_menu_option_confirm(int p_option,bool p_confirmed) {
} break;
case RUN_RELOAD_SCRIPTS: {
ScriptEditor::get_singleton()->get_debugger()->reload_scripts();
bool ischecked = debug_button->get_popup()->is_item_checked( debug_button->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS));
debug_button->get_popup()->set_item_checked( debug_button->get_popup()->get_item_index(RUN_RELOAD_SCRIPTS),!ischecked);
ScriptEditor::get_singleton()->set_live_auto_reload_running_scripts(!ischecked);
} break;
case SETTINGS_UPDATE_ALWAYS: {
@ -5779,16 +5785,14 @@ EditorNode::EditorNode() {
debug_button->set_tooltip(TTR("Debug options"));
p=debug_button->get_popup();
p->add_check_item(TTR("Live Editing"),RUN_LIVE_DEBUG);
p->add_check_item(TTR("File Server"),RUN_FILE_SERVER);
p->add_separator();
p->add_check_item(TTR("Deploy Remote Debug"),RUN_DEPLOY_REMOTE_DEBUG);
p->add_check_item(TTR("Deploy File Server Clients"),RUN_DEPLOY_DUMB_CLIENTS);
p->add_check_item(TTR("Remote Debug Deploys"),RUN_DEPLOY_REMOTE_DEBUG);
p->add_check_item(TTR("Use PC Filesystem for Deploys"),RUN_FILE_SERVER);
p->add_separator();
p->add_check_item(TTR("Visible Collision Shapes"),RUN_DEBUG_COLLISONS);
p->add_check_item(TTR("Visible Navigation"),RUN_DEBUG_NAVIGATION);
p->add_separator();
p->add_item(TTR("Reload Scripts"),RUN_RELOAD_SCRIPTS);
p->add_check_item(TTR("Mirror Scene Editing"),RUN_LIVE_DEBUG);
p->add_check_item(TTR("Mirror Script Changes"),RUN_RELOAD_SCRIPTS);
p->connect("item_pressed",this,"_menu_option");
/*

View file

@ -169,7 +169,7 @@ private:
RUN_SETTINGS,
RUN_PROJECT_MANAGER,
RUN_FILE_SERVER,
RUN_DEPLOY_DUMB_CLIENTS,
//RUN_DEPLOY_DUMB_CLIENTS,
RUN_LIVE_DEBUG,
RUN_DEBUG_COLLISONS,
RUN_DEBUG_NAVIGATION,

View file

@ -887,8 +887,19 @@ void ScriptEditor::_res_saved_callback(const Ref<Resource>& p_res) {
_update_script_names();
if (!pending_auto_reload && auto_reload_running_scripts) {
call_deferred("_live_auto_reload_running_scripts");
pending_auto_reload=true;
}
}
void ScriptEditor::_live_auto_reload_running_scripts() {
pending_auto_reload=false;
debugger->reload_scripts();
}
bool ScriptEditor::_test_script_times_on_disk() {
@ -2475,6 +2486,11 @@ void ScriptEditor::set_scene_root_script( Ref<Script> p_script ) {
}
}
void ScriptEditor::set_live_auto_reload_running_scripts(bool p_enabled) {
auto_reload_running_scripts=p_enabled;
}
void ScriptEditor::_bind_methods() {
ObjectTypeDB::bind_method("_file_dialog_action",&ScriptEditor::_file_dialog_action);
@ -2505,6 +2521,8 @@ void ScriptEditor::_bind_methods() {
ObjectTypeDB::bind_method("_request_help",&ScriptEditor::_help_class_open);
ObjectTypeDB::bind_method("_history_forward",&ScriptEditor::_history_forward);
ObjectTypeDB::bind_method("_history_back",&ScriptEditor::_history_back);
ObjectTypeDB::bind_method("_live_auto_reload_running_scripts",&ScriptEditor::_live_auto_reload_running_scripts);
}
ScriptEditor::ScriptEditor(EditorNode *p_editor) {
@ -2514,6 +2532,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) {
completion_cache = memnew( EditorScriptCodeCompletionCache );
restoring_layout=false;
waiting_update_names=false;
auto_reload_running_scripts=false;
editor=p_editor;
menu_hb = memnew( HBoxContainer );
@ -2875,6 +2894,8 @@ void ScriptEditorPlugin::edited_scene_changed() {
script_editor->edited_scene_changed();
}
ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
editor=p_node;

View file

@ -236,6 +236,10 @@ class ScriptEditor : public VBoxContainer {
bool grab_focus_block;
bool pending_auto_reload;
bool auto_reload_running_scripts;
void _live_auto_reload_running_scripts();
ScriptEditorQuickOpen *quick_open;
EditorScriptCodeCompletionCache *completion_cache;
@ -322,6 +326,7 @@ public:
virtual void edited_scene_changed();
ScriptEditorDebugger *get_debugger() { return debugger; }
void set_live_auto_reload_running_scripts(bool p_enabled);
ScriptEditor(EditorNode *p_editor);
~ScriptEditor();
@ -357,6 +362,7 @@ public:
virtual void get_breakpoints(List<String> *p_breakpoints);
virtual void edited_scene_changed();
ScriptEditorPlugin(EditorNode *p_node);