[GDNative] function to get class constructor

This commit is contained in:
Karroffel 2017-04-10 19:56:12 +02:00
parent 61a27601f7
commit cf45f3ab4b
2 changed files with 11 additions and 0 deletions

View file

@ -182,6 +182,13 @@ void GDAPI *godot_native_get_userdata(godot_object *p_instance) {
return NULL;
}
godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname) {
ClassDB::ClassInfo *class_info = ClassDB::classes.getptr(StringName(p_classname));
if (class_info)
return (godot_class_constructor)class_info->creation_func;
return NULL;
}
godot_dictionary GDAPI godot_get_global_constants() {
godot_dictionary constants;
godot_dictionary_new(&constants);

View file

@ -376,6 +376,10 @@ void GDAPI godot_script_register_signal(const char *p_name, const godot_signal *
void GDAPI *godot_native_get_userdata(godot_object *p_instance);
typedef godot_object *(*godot_class_constructor)();
godot_class_constructor GDAPI godot_get_class_constructor(const char *p_classname);
godot_dictionary GDAPI godot_get_global_constants();
////// System Functions