You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-18 14:21:41 +00:00
[Core] Add ClassDB functions to retrieve/construct extensions.
Calling the constructor alone is not enough if the class to be instantiated is not a base class. This commit adds two functions, one for retrieving the the extension class reference, the other to construct an instance using the constructor and the extension class reference.
This commit is contained in:
@@ -545,6 +545,13 @@ Object *ClassDB::instantiate(const StringName &p_class) {
|
||||
return ti->creation_func();
|
||||
}
|
||||
|
||||
Object *ClassDB::construct_extended(Object *(*p_create_func)(), ObjectNativeExtension *p_extension) {
|
||||
initializing_with_extension = true;
|
||||
initializing_extension = p_extension;
|
||||
initializing_extension_instance = p_extension->create_instance(p_extension->class_userdata);
|
||||
return p_create_func();
|
||||
}
|
||||
|
||||
bool ClassDB::can_instantiate(const StringName &p_class) {
|
||||
OBJTYPE_RLOCK;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user