Skip to content

Commit c10c656

Browse files
committed
Merge pull request godotengine#99133 from dsnopek/gdextension-reloadable-when-not-createable
GDExtension: Check if class without recreate callback is creatable, before marking whole extension as unreloadable
2 parents daab1d6 + e4aaf9f commit c10c656

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

core/extension/gdextension.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,16 @@ void GDExtension::_register_extension_class_internal(GDExtensionClassLibraryPtr
410410
}
411411

412412
if (self->reloadable && p_extension_funcs->recreate_instance_func == nullptr) {
413-
ERR_PRINT(vformat("Extension marked as reloadable, but attempted to register class '%s' which doesn't support reloading. Perhaps your language binding don't support it? Reloading disabled for this extension.", class_name));
414-
self->reloadable = false;
413+
bool can_create_class = (bool)p_extension_funcs->create_instance_func;
414+
#ifndef DISABLE_DEPRECATED
415+
if (!can_create_class && p_deprecated_funcs) {
416+
can_create_class = (bool)p_deprecated_funcs->create_instance_func;
417+
}
418+
#endif
419+
if (can_create_class) {
420+
ERR_PRINT(vformat("Extension marked as reloadable, but attempted to register class '%s' which doesn't support reloading. Perhaps your language binding don't support it? Reloading disabled for this extension.", class_name));
421+
self->reloadable = false;
422+
}
415423
}
416424

417425
extension->gdextension.library = self;

0 commit comments

Comments
 (0)