Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions include/core/Godot.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,15 @@ public:
godot::NativeScript *script = godot::NativeScript::_new(); \
script->set_library(godot::get_wrapper<godot::GDNativeLibrary>((godot_object *)godot::gdnlib)); \
script->set_class_name(#Name); \
Name *instance = godot::as<Name>(script->new_()); \
Variant instance_variant = script->new_(); \
Reference *instance_ref = Object::cast_to<Reference>(Object::___get_from_variant(instance_variant)); \
if (instance_ref) \
instance_ref->reference(); \
Name *instance = godot::as<Name>(instance_variant); \
return instance; \
} \
inline static size_t ___get_id() { return typeid(Name).hash_code(); } \
inline static size_t ___get_base_id() { return typeid(Base).hash_code(); } \
inline static size_t ___get_id() { return typeid(Name).hash_code(); } \
inline static size_t ___get_base_id() { return typeid(Base).hash_code(); } \
inline static const char *___get_base_type_name() { return Base::___get_class_name(); } \
inline static Object *___get_from_variant(godot::Variant a) { return (godot::Object *)godot::as<Name>(godot::Object::___get_from_variant(a)); } \
\
Expand All @@ -62,7 +66,11 @@ public:
godot::NativeScript *script = godot::NativeScript::_new(); \
script->set_library(godot::get_wrapper<godot::GDNativeLibrary>((godot_object *)godot::gdnlib)); \
script->set_class_name(#Name); \
Name *instance = godot::as<Name>(script->new_()); \
Variant instance_variant = script->new_(); \
Reference *instance_ref = Object::cast_to<Reference>(Object::___get_from_variant(instance_variant)); \
if (instance_ref) \
instance_ref->reference(); \
Name *instance = godot::as<Name>(instance_variant); \
return instance; \
} \
inline static size_t ___get_id() { return typeid(Name).hash_code(); }; \
Expand Down