summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorPedro J. Estébanez <pedrojrulez@gmail.com>2021-12-22 20:47:34 +0100
committerPedro J. Estébanez <pedrojrulez@gmail.com>2022-01-06 18:58:42 +0100
commit5f0fe3c6ae5d9e3f00703eded81ae6df3d078eae (patch)
treecb0fc4646bbab69b1a21d6f2a2025d96c315902a /scene
parentd7f6993357c68b630e2c59fa7ebe86ece5653997 (diff)
Assume that non registered properties default to null
Diffstat (limited to 'scene')
-rw-r--r--scene/property_utils.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/scene/property_utils.cpp b/scene/property_utils.cpp
index 6ffc1f148a..be349da40a 100644
--- a/scene/property_utils.cpp
+++ b/scene/property_utils.cpp
@@ -114,7 +114,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