From d16ce4a8edb26fb4730c51405662479f7ebf6617 Mon Sep 17 00:00:00 2001 From: Juan Linietsky Date: Sun, 11 Nov 2018 09:14:06 -0300 Subject: [PATCH] Many fixes to script editor remote debugger, closes #13346 --- editor/editor_node.cpp | 3 ++ editor/plugins/script_editor_plugin.cpp | 2 +- editor/script_editor_debugger.cpp | 37 +++++++++++++++++++------ 3 files changed, 33 insertions(+), 9 deletions(-) diff --git a/editor/editor_node.cpp b/editor/editor_node.cpp index bc517933ba82..d8cb12543f24 100644 --- a/editor/editor_node.cpp +++ b/editor/editor_node.cpp @@ -5286,10 +5286,13 @@ EditorNode::EditorNode() { p->add_check_item(TTR("Visible Navigation"), RUN_DEBUG_NAVIGATION); p->set_item_tooltip(p->get_item_count() - 1, TTR("Navigation meshes and polygons will be visible on the running game if this option is turned on.")); p->add_separator(); + //those are now on by default, since they are harmless p->add_check_item(TTR("Sync Scene Changes"), RUN_LIVE_DEBUG); p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any changes made to the scene in the editor will be replicated in the running game.\nWhen used remotely on a device, this is more efficient with network filesystem.")); + p->set_item_checked(p->get_item_count() - 1, true); p->add_check_item(TTR("Sync Script Changes"), RUN_RELOAD_SCRIPTS); p->set_item_tooltip(p->get_item_count() - 1, TTR("When this option is turned on, any script that is saved will be reloaded on the running game.\nWhen used remotely on a device, this is more efficient with network filesystem.")); + p->set_item_checked(p->get_item_count() - 1, true); p->connect("id_pressed", this, "_menu_option"); menu_hb->add_spacer(); diff --git a/editor/plugins/script_editor_plugin.cpp b/editor/plugins/script_editor_plugin.cpp index 323dfa681b7c..085660b79ea9 100644 --- a/editor/plugins/script_editor_plugin.cpp +++ b/editor/plugins/script_editor_plugin.cpp @@ -2895,7 +2895,7 @@ ScriptEditor::ScriptEditor(EditorNode *p_editor) { restoring_layout = false; waiting_update_names = false; pending_auto_reload = false; - auto_reload_running_scripts = false; + auto_reload_running_scripts = true; members_overview_enabled = EditorSettings::get_singleton()->get("text_editor/open_scripts/show_members_overview"); help_overview_enabled = EditorSettings::get_singleton()->get("text_editor/help/show_help_index"); editor = p_editor; diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index ab3e3b9a4996..ba9837ef6eb0 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -123,8 +123,8 @@ protected: if (!prop_values.has(p_name) || String(p_name).begins_with("Constants/")) return false; - emit_signal("value_edited", p_name, p_value); prop_values[p_name] = p_value; + emit_signal("value_edited", p_name, p_value); return true; } @@ -479,6 +479,11 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da debugObj->connect("value_edited", this, "_scene_tree_property_value_edited"); } + int old_prop_size = debugObj->prop_list.size(); + + debugObj->prop_list.clear(); + int new_props_added = 0; + Set changed; for (int i = 0; i < properties.size(); i++) { Array prop = properties[i]; @@ -511,18 +516,34 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da } } - if (is_new_object) { - //don't update.. it's the same, instead refresh - debugObj->prop_list.push_back(pinfo); - } + //always add the property, since props may have been added or removed + debugObj->prop_list.push_back(pinfo); - debugObj->prop_values[pinfo.name] = var; + if (!debugObj->prop_values.has(pinfo.name)) { + new_props_added++; + debugObj->prop_values[pinfo.name] = var; + } else { + + if (bool(Variant::evaluate(Variant::OP_NOT_EQUAL, debugObj->prop_values[pinfo.name], var))) { + debugObj->prop_values[pinfo.name] = var; + changed.insert(pinfo.name); + } + } } if (editor->get_editor_history()->get_current() != debugObj->get_instance_id()) { editor->push_item(debugObj, ""); } else { - debugObj->update(); + + if (old_prop_size == debugObj->prop_list.size() && new_props_added == 0) { + //only some may have changed, if so, then update those, if exist + for (Set::Element *E = changed.front(); E; E = E->next()) { + EditorNode::get_singleton()->get_inspector()->update_property(E->get()); + } + } else { + //full update, because props were added or removed + debugObj->update(); + } } } else if (p_msg == "message:video_mem") { @@ -2234,7 +2255,7 @@ ScriptEditorDebugger::ScriptEditorDebugger(EditorNode *p_editor) { p_editor->get_undo_redo()->set_method_notify_callback(_method_changeds, this); p_editor->get_undo_redo()->set_property_notify_callback(_property_changeds, this); - live_debug = false; + live_debug = true; last_path_id = false; error_count = 0; warning_count = 0;