feat: updated engine version to 4.4-rc1

This commit is contained in:
Sara 2025-02-23 14:38:14 +01:00
parent ee00efde1f
commit 21ba8e33af
5459 changed files with 1128836 additions and 198305 deletions

View file

@ -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 = get_custom_type_script(p_object);
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)) {
@ -172,7 +182,7 @@ Variant PropertyUtils::get_property_default_value(const Object *p_object, const
// Heuristically check if this is a synthetic property (whatever/0, whatever/1, etc.)
// because they are not in the class DB yet must have a default (null).
String prop_str = String(p_property);
int p = prop_str.rfind("/");
int p = prop_str.rfind_char('/');
if (p != -1 && p < prop_str.length() - 1) {
bool all_digits = true;
for (int i = p + 1; i < prop_str.length(); i++) {
@ -272,3 +282,29 @@ Vector<SceneState::PackState> PropertyUtils::get_node_states_stack(const Node *p
}
return states_stack_ret;
}
void PropertyUtils::assign_custom_type_script(Object *p_object, const Ref<Script> &p_script) {
ERR_FAIL_NULL(p_object);
ERR_FAIL_COND(p_script.is_null());
const String &path = p_script->get_path();
ERR_FAIL_COND(!path.is_resource_file());
ResourceUID::ID script_uid = ResourceLoader::get_resource_uid(path);
if (script_uid != ResourceUID::INVALID_ID) {
p_object->set_meta(SceneStringName(_custom_type_script), ResourceUID::get_singleton()->id_to_text(script_uid));
}
}
Ref<Script> PropertyUtils::get_custom_type_script(const Object *p_object) {
Variant custom_script = p_object->get_meta(SceneStringName(_custom_type_script));
#ifndef DISABLE_DEPRECATED
if (custom_script.get_type() == Variant::OBJECT) {
// Convert old script meta.
Ref<Script> script_object(custom_script);
assign_custom_type_script(const_cast<Object *>(p_object), script_object);
return script_object;
}
#endif
return ResourceLoader::load(custom_script);
}