Fix inspecting nested dictionaries/arrays when debugging

This commit is contained in:
kleonc 2022-05-04 00:49:34 +02:00
parent 37fd526ddd
commit 2e4e8bb87c

View file

@ -672,7 +672,8 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
new_props_added++; new_props_added++;
debugObj->prop_values[pinfo.name] = var; debugObj->prop_values[pinfo.name] = var;
} else { } else {
if (bool(Variant::evaluate(Variant::OP_NOT_EQUAL, debugObj->prop_values[pinfo.name], var))) { // Compare using `deep_equal` so dictionaries/arrays will be compared by value.
if (!debugObj->prop_values[pinfo.name].deep_equal(var)) {
debugObj->prop_values[pinfo.name] = var; debugObj->prop_values[pinfo.name] = var;
changed.insert(pinfo.name); changed.insert(pinfo.name);
} }
@ -715,7 +716,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
vmem_total->set_tooltip(TTR("Bytes:") + " " + itos(total)); vmem_total->set_tooltip(TTR("Bytes:") + " " + itos(total));
vmem_total->set_text(String::humanize_size(total)); vmem_total->set_text(String::humanize_size(total));
} else if (p_msg == "stack_dump") { } else if (p_msg == "stack_dump") {
stack_dump->clear(); stack_dump->clear();
TreeItem *r = stack_dump->create_item(); TreeItem *r = stack_dump->create_item();
@ -801,7 +801,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
variables->update(); variables->update();
inspector->edit(variables); inspector->edit(variables);
} else if (p_msg == "output") { } else if (p_msg == "output") {
//OUT //OUT
for (int i = 0; i < p_data.size(); i++) { for (int i = 0; i < p_data.size(); i++) {
@ -837,7 +836,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
EditorNode::get_log()->add_message(str, msg_type); EditorNode::get_log()->add_message(str, msg_type);
} }
} else if (p_msg == "performance") { } else if (p_msg == "performance") {
Array arr = p_data[0]; Array arr = p_data[0];
Vector<float> p; Vector<float> p;
@ -871,7 +869,6 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
} }
perf_history.push_front(p); perf_history.push_front(p);
perf_draw->update(); perf_draw->update();
} else if (p_msg == "error") { } else if (p_msg == "error") {
// Should have at least two elements, error array and stack items count. // Should have at least two elements, error array and stack items count.
ERR_FAIL_COND_MSG(p_data.size() < 2, "Malformed error message from script debugger."); ERR_FAIL_COND_MSG(p_data.size() < 2, "Malformed error message from script debugger.");
@ -999,11 +996,9 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da
} else { } else {
error_count++; error_count++;
} }
} else if (p_msg == "profile_sig") { } else if (p_msg == "profile_sig") {
//cache a signature //cache a signature
profiler_signature[p_data[1]] = p_data[0]; profiler_signature[p_data[1]] = p_data[0];
} else if (p_msg == "profile_frame" || p_msg == "profile_total") { } else if (p_msg == "profile_frame" || p_msg == "profile_total") {
EditorProfiler::Metric metric; EditorProfiler::Metric metric;
metric.valid = true; metric.valid = true;