From 051ef479c93c0c830b60059e3dabed6fc381cdd6 Mon Sep 17 00:00:00 2001 From: TechnoPorg Date: Tue, 25 Jan 2022 08:37:41 -0700 Subject: Allow method binds to take Object subclasses as arguments This commit adds a condition to VariantCaster that casts Variants of type OBJECT to any type T, if T is derived from Object. This change enables a fair bit of code cleanup. First, the Variant implicit cast operators for Node and Control can be removed, which allows for some invalid includes to be removed. Second, helper methods in Tree whose sole purpose was to cast arguments to TreeItem * are no longer necessary. A few small changes also had to be made to other files, due to the changes cascading down all the includes. --- core/io/resource.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/io') diff --git a/core/io/resource.h b/core/io/resource.h index a0800c57cb..dea2160616 100644 --- a/core/io/resource.h +++ b/core/io/resource.h @@ -37,6 +37,8 @@ #include "core/templates/safe_refcount.h" #include "core/templates/self_list.h" +class Node; + #define RES_BASE_EXTENSION(m_ext) \ public: \ static void register_custom_data_to_otdb() { ClassDB::add_resource_base_extension(m_ext, get_class_static()); } \ -- cgit v1.2.3