From 4d57da4d0154722306fa279e0c0e0438f3817b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=8E=E9=9D=92=E5=B1=B1?= Date: Sat, 17 Feb 2024 11:53:30 +0800 Subject: [PATCH] Fix inherited scenes produce errors in editor when "editable_children" is true Since the same argument is used, `SceneState::get_node_deferred_nodepath_properties()` should use similar logic to `SceneState::get_property_value()`. Make `SceneState::get_property_value()` to return whether the property is deferred. --- scene/property_utils.cpp | 8 +++---- scene/resources/packed_scene.cpp | 40 +++++++++++++++++++++----------- scene/resources/packed_scene.h | 2 +- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/scene/property_utils.cpp b/scene/property_utils.cpp index 090c81aefe2..be58f1c1e19 100644 --- a/scene/property_utils.cpp +++ b/scene/property_utils.cpp @@ -73,15 +73,15 @@ Variant PropertyUtils::get_property_default_value(const Object *p_object, const for (int i = 0; i < states_stack.size(); ++i) { const SceneState::PackState &ia = states_stack[i]; bool found = false; - Variant value_in_ancestor = ia.state->get_property_value(ia.node, p_property, found); - const Vector &deferred_properties = ia.state->get_node_deferred_nodepath_properties(ia.node); + bool node_deferred = false; + Variant value_in_ancestor = ia.state->get_property_value(ia.node, p_property, found, node_deferred); if (found) { if (r_is_valid) { *r_is_valid = true; } // Replace properties stored as NodePaths with actual Nodes. // Otherwise, the property value would be considered as overridden. - if (deferred_properties.has(p_property)) { + if (node_deferred) { if (value_in_ancestor.get_type() == Variant::ARRAY) { Array paths = value_in_ancestor; @@ -103,7 +103,7 @@ Variant PropertyUtils::get_property_default_value(const Object *p_object, const } // Save script for later bool has_script = false; - Variant script = ia.state->get_property_value(ia.node, SNAME("script"), has_script); + Variant script = ia.state->get_property_value(ia.node, SNAME("script"), has_script, node_deferred); if (has_script) { Ref