Raise error if Resource is of wrong type as function argument

This commit is contained in:
Florian Kothmeier 2020-10-06 23:22:25 +02:00
parent 0582cefcbb
commit a2c419bdc9
No known key found for this signature in database
GPG Key ID: 1B676CDB21FBF963
1 changed files with 12 additions and 0 deletions

View File

@ -122,6 +122,18 @@ struct VariantObjectClassChecker {
}
};
template <typename T>
class Ref;
template <typename T>
struct VariantObjectClassChecker<const Ref<T> &> {
static _FORCE_INLINE_ bool check(const Variant &p_variant) {
Object *obj = p_variant;
const Ref<T> node = p_variant;
return node.ptr() || !obj;
}
};
template <>
struct VariantObjectClassChecker<Node *> {
static _FORCE_INLINE_ bool check(const Variant &p_variant) {