From 7edd5e4b399c3613846add2e62b8ea4538b9064b Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Mon, 25 Jul 2022 14:29:33 +0200 Subject: [PATCH] Require ScriptInstance to be valid in the editor debugger This fixes an issue with visual scripts spamming error messages in the editor when running the project with the remote scene tree visible. (cherry picked from commit 829c8247559a21d0b6f540e4a548d935c3a24643) --- editor/script_editor_debugger.cpp | 46 ++++++++++++++++--------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/editor/script_editor_debugger.cpp b/editor/script_editor_debugger.cpp index 6edd944ecfd..3b0aa2e2719 100644 --- a/editor/script_editor_debugger.cpp +++ b/editor/script_editor_debugger.cpp @@ -595,25 +595,25 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da le_clear->set_disabled(false); le_set->set_disabled(false); } else if (p_msg == "message:inspect_object") { - ScriptEditorDebuggerInspectedObject *debugObj = nullptr; + ScriptEditorDebuggerInspectedObject *debug_obj = nullptr; ObjectID id = p_data[0]; String type = p_data[1]; Array properties = p_data[2]; if (remote_objects.has(id)) { - debugObj = remote_objects[id]; + debug_obj = remote_objects[id]; } else { - debugObj = memnew(ScriptEditorDebuggerInspectedObject); - debugObj->remote_object_id = id; - debugObj->type_name = type; - remote_objects[id] = debugObj; - debugObj->connect("value_edited", this, "_scene_tree_property_value_edited"); + debug_obj = memnew(ScriptEditorDebuggerInspectedObject); + debug_obj->remote_object_id = id; + debug_obj->type_name = type; + remote_objects[id] = debug_obj; + debug_obj->connect("value_edited", this, "_scene_tree_property_value_edited"); } - int old_prop_size = debugObj->prop_list.size(); + int old_prop_size = debug_obj->prop_list.size(); - debugObj->prop_list.clear(); + debug_obj->prop_list.clear(); int new_props_added = 0; Set changed; for (int i = 0; i < properties.size(); i++) { @@ -646,12 +646,14 @@ void ScriptEditorDebugger::_parse_message(const String &p_msg, const Array &p_da var = ResourceLoader::load(path); if (pinfo.hint_string == "Script") { - if (debugObj->get_script() != var) { - debugObj->set_script(RefPtr()); + if (debug_obj->get_script() != var) { + debug_obj->set_script(RefPtr()); Ref