Added property info for ptr and ref + ported the implementation of the `check` method
parent
512ec5b236
commit
0c6e26dabe
|
@ -276,7 +276,7 @@ struct GetTypeInfo<Ref<T>, typename EnableIf<TypeInherits<RefCounted, T>::value>
|
||||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||||
|
|
||||||
static inline PropertyInfo get_class_info() {
|
static inline PropertyInfo get_class_info() {
|
||||||
return make_property_info(Variant::Type::OBJECT, T::get_class_static());
|
return make_property_info(Variant::Type::OBJECT, "", PROPERTY_HINT_RESOURCE_TYPE, T::get_class_static());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -286,7 +286,7 @@ struct GetTypeInfo<const Ref<T> &, typename EnableIf<TypeInherits<RefCounted, T>
|
||||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||||
|
|
||||||
static inline PropertyInfo get_class_info() {
|
static inline PropertyInfo get_class_info() {
|
||||||
return make_property_info(Variant::Type::OBJECT, T::get_class_static());
|
return make_property_info(Variant::Type::OBJECT, "", PROPERTY_HINT_RESOURCE_TYPE, T::get_class_static());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -122,8 +122,14 @@ struct VariantCaster<const T &> {
|
||||||
template <typename T>
|
template <typename T>
|
||||||
struct VariantObjectClassChecker {
|
struct VariantObjectClassChecker {
|
||||||
static _FORCE_INLINE_ bool check(const Variant &p_variant) {
|
static _FORCE_INLINE_ bool check(const Variant &p_variant) {
|
||||||
|
using TStripped = std::remove_pointer_t<T>;
|
||||||
|
if constexpr (std::is_base_of<Object, TStripped>::value) {
|
||||||
|
Object *obj = p_variant;
|
||||||
|
return Object::cast_to<TStripped>(p_variant) || !obj;
|
||||||
|
} else {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
|
|
|
@ -201,7 +201,7 @@ struct GetTypeInfo<T *, typename EnableIf<TypeInherits<Object, T>::value>::type>
|
||||||
static const GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_OBJECT;
|
static const GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_OBJECT;
|
||||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||||
static inline PropertyInfo get_class_info() {
|
static inline PropertyInfo get_class_info() {
|
||||||
return make_property_info(Variant::Type::OBJECT, T::get_class_static());
|
return make_property_info(Variant::Type::OBJECT, "", PROPERTY_HINT_RESOURCE_TYPE, T::get_class_static());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -210,7 +210,7 @@ struct GetTypeInfo<const T *, typename EnableIf<TypeInherits<Object, T>::value>:
|
||||||
static const GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_OBJECT;
|
static const GDExtensionVariantType VARIANT_TYPE = GDEXTENSION_VARIANT_TYPE_OBJECT;
|
||||||
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
static const GDExtensionClassMethodArgumentMetadata METADATA = GDEXTENSION_METHOD_ARGUMENT_METADATA_NONE;
|
||||||
static inline PropertyInfo get_class_info() {
|
static inline PropertyInfo get_class_info() {
|
||||||
return make_property_info(Variant::Type::OBJECT, T::get_class_static());
|
return make_property_info(Variant::Type::OBJECT, "", PROPERTY_HINT_RESOURCE_TYPE, T::get_class_static());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue