From 5d9117d4bdc7aa736ef441b8e584c6b3004646c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pedro=20J=2E=20Est=C3=A9banez?= Date: Wed, 22 Dec 2021 20:47:34 +0100 Subject: [PATCH] Assume that non registered properties default to null (cherry picked from commit 5f0fe3c6ae5d9e3f00703eded81ae6df3d078eae) --- scene/property_utils.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/scene/property_utils.cpp b/scene/property_utils.cpp index bed00e72e3d..3ad72e95dad 100644 --- a/scene/property_utils.cpp +++ b/scene/property_utils.cpp @@ -112,7 +112,12 @@ Variant PropertyUtils::get_property_default_value(const Object *p_object, const if (r_is_class_default) { *r_is_class_default = true; } - return ClassDB::class_get_default_property_value(p_object->get_class_name(), p_property, r_is_valid); + // This is saying that properties not registered in the class DB are considered to have a default value of null + // (that covers cases like synthetic properties in the style of whatever/0, whatever/1, which may not have a value in any ancestor). + if (r_is_valid) { + *r_is_valid = true; + } + return ClassDB::class_get_default_property_value(p_object->get_class_name(), p_property); } // Like SceneState::PackState, but using a raw pointer to avoid the cost of