diff options
author | Thaddeus Crews <repiteo@outlook.com> | 2024-10-24 13:22:56 -0500 |
---|---|---|
committer | Thaddeus Crews <repiteo@outlook.com> | 2024-10-24 13:22:56 -0500 |
commit | fa673be2b1320189dac66a6d303c3a69ee92d7b9 (patch) | |
tree | 50a92dab6fc9cb77421de1c95b8ca9a798f9f2db /scene/property_utils.cpp | |
parent | 1001a8c6639897e0f64ea7c2a67f71dcba91375c (diff) | |
parent | 06998a3927e1c36212ba98615c2aefe92fe5b5e0 (diff) | |
download | redot-engine-fa673be2b1320189dac66a6d303c3a69ee92d7b9.tar.gz |
Merge pull request #91341 from bjornmp/NewMaster
Enforce custom nodes to keep their original type
Diffstat (limited to 'scene/property_utils.cpp')
-rw-r--r-- | scene/property_utils.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/property_utils.cpp b/scene/property_utils.cpp index 94a037bd9b..f068e34beb 100644 --- a/scene/property_utils.cpp +++ b/scene/property_utils.cpp @@ -89,6 +89,16 @@ Variant PropertyUtils::get_property_default_value(const Object *p_object, const *r_is_valid = false; } + // Handle special case "script" property, where the default value is either null or the custom type script. + // Do this only if there's no states stack cache to trace for default values. + if (!p_states_stack_cache && p_property == CoreStringName(script) && p_object->has_meta(SceneStringName(_custom_type_script))) { + Ref<Script> ct_scr = p_object->get_meta(SceneStringName(_custom_type_script)); + if (r_is_valid) { + *r_is_valid = true; + } + return ct_scr; + } + Ref<Script> topmost_script; if (const Node *node = Object::cast_to<Node>(p_object)) { |