You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-22 15:06:45 +00:00
Merge pull request #111090 from dsnopek/gdextension-compat-unexposed-classes-redo
GDExtension: Prevent breaking compatibility for unexposed classes that can only be created once
This commit is contained in:
@@ -564,6 +564,12 @@ Object *ClassDB::_instantiate_internal(const StringName &p_class, bool p_require
|
||||
}
|
||||
ERR_FAIL_NULL_V_MSG(ti, nullptr, vformat("Cannot get class '%s'.", String(p_class)));
|
||||
ERR_FAIL_COND_V_MSG(ti->disabled, nullptr, vformat("Class '%s' is disabled.", String(p_class)));
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
// Force legacy unexposed classes to skip the exposed check to preserve backcompat.
|
||||
if (ti->gdextension && ti->gdextension->legacy_unexposed_class) {
|
||||
p_exposed_only = false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
if (p_exposed_only) {
|
||||
ERR_FAIL_COND_V_MSG(!ti->exposed, nullptr, vformat("Class '%s' isn't exposed.", String(p_class)));
|
||||
}
|
||||
@@ -623,6 +629,13 @@ bool ClassDB::_can_instantiate(ClassInfo *p_class_info, bool p_exposed_only) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifndef DISABLE_DEPRECATED
|
||||
// Force legacy unexposed classes to skip the exposed check to preserve backcompat.
|
||||
if (p_class_info->gdextension && p_class_info->gdextension->legacy_unexposed_class) {
|
||||
p_exposed_only = false;
|
||||
}
|
||||
#endif // DISABLE_DEPRECATED
|
||||
|
||||
if (p_exposed_only && !p_class_info->exposed) {
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user