From 60851af4daf2d64631cfa87718da068b2ae47a4f Mon Sep 17 00:00:00 2001 From: Jeff Ward Date: Tue, 15 Aug 2023 20:03:49 -0400 Subject: Add functions for non-ptr style virtual calls in GDExtension This adds two functions to `GDExtensionClassCreationInfo` that allow for developers to supply a generic virtual call function along with user data to be sent to that call. If `get_virutal_call_data_func` is not null, extensions call this function to get user data to pass to a supplied `call_virtual_with_data_func`. Both must be provided is one is provided. If `get_virtual_call_data_func` is null, Godot falls back to the old `get_virtual_func` logic. Fixes #63275 Co-authored-by: David Snopek --- core/object/object.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'core/object/object.h') diff --git a/core/object/object.h b/core/object/object.h index 3a698f7526..7da1c68edf 100644 --- a/core/object/object.h +++ b/core/object/object.h @@ -347,6 +347,8 @@ struct ObjectGDExtension { GDExtensionClassCreateInstance create_instance; GDExtensionClassFreeInstance free_instance; GDExtensionClassGetVirtual get_virtual; + GDExtensionClassGetVirtualCallData get_virtual_call_data; + GDExtensionClassCallVirtualWithData call_virtual_with_data; }; #define GDVIRTUAL_CALL(m_name, ...) _gdvirtual_##m_name##_call(__VA_ARGS__) -- cgit v1.2.3