Implement Variant::get_type_by_name()
This commit is contained in:
@ -332,6 +332,9 @@ public:
|
||||
Variant duplicate(bool deep = false) const;
|
||||
|
||||
static String get_type_name(Variant::Type type);
|
||||
#if GODOT_VERSION_MINOR >= 7
|
||||
static Variant::Type get_type_by_name(const String &p_name);
|
||||
#endif
|
||||
static bool can_convert(Variant::Type from, Variant::Type to);
|
||||
static bool can_convert_strict(Variant::Type from, Variant::Type to);
|
||||
|
||||
|
||||
@ -755,6 +755,12 @@ String Variant::get_type_name(Variant::Type type) {
|
||||
return result;
|
||||
}
|
||||
|
||||
#if GODOT_VERSION_MINOR >= 7
|
||||
Variant::Type Variant::get_type_by_name(const String &p_name) {
|
||||
return static_cast<Variant::Type>(::godot::gdextension_interface::variant_get_type_by_name(p_name._native_ptr()));
|
||||
}
|
||||
#endif
|
||||
|
||||
bool Variant::can_convert(Variant::Type from, Variant::Type to) {
|
||||
GDExtensionBool can = ::godot::gdextension_interface::variant_can_convert(static_cast<GDExtensionVariantType>(from), static_cast<GDExtensionVariantType>(to));
|
||||
return PtrToArg<bool>::convert(&can);
|
||||
|
||||
Reference in New Issue
Block a user