diff options
Diffstat (limited to 'editor/script_editor_debugger.cpp')
-rw-r--r-- | editor/script_editor_debugger.cpp | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index a36a844710..089ffa285d 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; } @@ -467,7 +467,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da String type = p_data[1]; Array properties = p_data[2]; - bool is_new_object = false; if (remote_objects.has(id)) { debugObj = remote_objects[id]; } else { @@ -475,10 +474,14 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da debugObj->remote_object_id = id; debugObj->type_name = type; remote_objects[id] = debugObj; - is_new_object = true; 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 +514,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") { @@ -1272,7 +1291,7 @@ void ScriptEditorDebugger::stop() { breaked = false; server->stop(); - + _clear_remote_objects(); ppeer->set_stream_peer(Ref<StreamPeer>()); if (connection.is_valid()) { @@ -2234,7 +2253,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; |