Merge pull request #42607 from Dragoncraft89/type_checks
Raise error if Resource is of wrong type as function argument
This commit is contained in:
commit
5c5cfaabf2
1 changed files with 12 additions and 0 deletions
|
@ -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) {
|
||||
|
|
Loading…
Reference in a new issue