From 829c8247559a21d0b6f540e4a548d935c3a24643 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. --- editor/debugger/editor_debugger_inspector.cpp | 44 ++++++++++--------- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/editor/debugger/editor_debugger_inspector.cpp b/editor/debugger/editor_debugger_inspector.cpp index 0e3d424a4b6..58206efc20f 100644 --- a/editor/debugger/editor_debugger_inspector.cpp +++ b/editor/debugger/editor_debugger_inspector.cpp @@ -126,25 +126,25 @@ void EditorDebuggerInspector::_object_selected(ObjectID p_object) { } ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { - EditorDebuggerRemoteObject *debugObj = nullptr; + EditorDebuggerRemoteObject *debug_obj = nullptr; SceneDebuggerObject obj; obj.deserialize(p_arr); ERR_FAIL_COND_V(obj.id.is_null(), ObjectID()); if (remote_objects.has(obj.id)) { - debugObj = remote_objects[obj.id]; + debug_obj = remote_objects[obj.id]; } else { - debugObj = memnew(EditorDebuggerRemoteObject); - debugObj->remote_object_id = obj.id; - debugObj->type_name = obj.class_name; - remote_objects[obj.id] = debugObj; - debugObj->connect("value_edited", callable_mp(this, &EditorDebuggerInspector::_object_edited)); + debug_obj = memnew(EditorDebuggerRemoteObject); + debug_obj->remote_object_id = obj.id; + debug_obj->type_name = obj.class_name; + remote_objects[obj.id] = debug_obj; + debug_obj->connect("value_edited", callable_mp(this, &EditorDebuggerInspector::_object_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; HashSet changed; for (int i = 0; i < obj.properties.size(); i++) { @@ -165,12 +165,14 @@ ObjectID EditorDebuggerInspector::add_object(const Array &p_arr) { var = ResourceLoader::load(path); if (pinfo.hint_string == "Script") { - if (debugObj->get_script() != var) { - debugObj->set_script(Ref()); + if (debug_obj->get_script() != var) { + debug_obj->set_script(Ref()); Ref