Many fixes to script editor remote debugger, closes #13346

This commit is contained in:
Juan Linietsky 2018-11-11 09:14:06 -03:00
parent c3023e84c2
commit d16ce4a8ed
3 changed files with 33 additions and 9 deletions

View file

@ -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();

View file

@ -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;

View file

@ -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<String> 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<String>::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;