diff options
author | Thomas Herzog <karroffel@users.noreply.github.com> | 2017-04-10 22:30:45 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-04-10 22:30:45 +0200 |
commit | a1413b9a68426027c29542f4b450f551dbd1d494 (patch) | |
tree | b442e18e010eec0e2cbcfa84802aed340139e9aa /modules/gdnative | |
parent | 246dfc65ca22339a9092b07cd0af51a2ed9ac1f3 (diff) | |
parent | cf45f3ab4bc7062702e3d94baf4e681861ab3e42 (diff) |
Merge pull request #8349 from karroffel/gdnative-constructor
[GDNative] function to get class constructor
Diffstat (limited to 'modules/gdnative')
-rw-r--r-- | modules/gdnative/godot.cpp | 7 | ||||
-rw-r--r-- | modules/gdnative/godot.h | 4 |
2 files changed, 11 insertions, 0 deletions
diff --git a/modules/gdnative/godot.cpp b/modules/gdnative/godot.cpp index 5ad716d0cd..7477a28db6 100644 --- a/modules/gdnative/godot.cpp +++ b/modules/gdnative/godot.cpp @@ -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); diff --git a/modules/gdnative/godot.h b/modules/gdnative/godot.h index 45ac64feee..bba0a3f98d 100644 --- a/modules/gdnative/godot.h +++ b/modules/gdnative/godot.h @@ -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 |