diff options
Diffstat (limited to 'core/object/make_virtuals.py')
-rw-r--r-- | core/object/make_virtuals.py | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/core/object/make_virtuals.py b/core/object/make_virtuals.py index 9948620c73..af90593140 100644 --- a/core/object/make_virtuals.py +++ b/core/object/make_virtuals.py @@ -1,8 +1,8 @@ proto = """ #define GDVIRTUAL$VER($RET m_name $ARG) \\ StringName _gdvirtual_##m_name##_sn = #m_name;\\ +GDNativeExtensionClassCallVirtual _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, #m_name) : (GDNativeExtensionClassCallVirtual) nullptr;\\ bool _gdvirtual_##m_name##_call($CALLARGS) $CONST { \\ - GDNativeExtensionClassCallVirtual _gdvirtual_##m_name = (_get_extension() && _get_extension()->get_virtual) ? _get_extension()->get_virtual(_get_extension()->class_userdata, #m_name) : (GDNativeExtensionClassCallVirtual) nullptr;\\ ScriptInstance *script_instance = ((Object*)(this))->get_script_instance();\\ if (script_instance) {\\ Callable::CallError ce; \\ @@ -23,6 +23,16 @@ bool _gdvirtual_##m_name##_call($CALLARGS) $CONST { \\ \\ return false;\\ }\\ +bool _gdvirtual_##m_name##_overriden() const { \\ + ScriptInstance *script_instance = ((Object*)(this))->get_script_instance();\\ + if (script_instance) {\\ + return script_instance->has_method(_gdvirtual_##m_name##_sn);\\ + }\\ + if (_gdvirtual_##m_name) {\\ + return true;\\ + }\\ + return false;\\ +}\\ \\ _FORCE_INLINE_ static MethodInfo _gdvirtual_##m_name##_get_method_info() { \\ MethodInfo method_info;\\ @@ -77,7 +87,7 @@ def generate_version(argcount, const=False, returns=False): callptrargs += "\t\t" callptrargsptr += ", " argtext += "m_type" + str(i + 1) - callargtext += "const m_type" + str(i + 1) + "& arg" + str(i + 1) + callargtext += "m_type" + str(i + 1) + " arg" + str(i + 1) callsiargs += "Variant(arg" + str(i + 1) + ")" callsiargptrs += "&vargs[" + str(i) + "]" callptrargs += ( @@ -103,7 +113,7 @@ def generate_version(argcount, const=False, returns=False): if returns: if argcount > 0: callargtext += "," - callargtext += " m_ret& r_ret" + callargtext += " m_ret& r_ret" s = s.replace("$CALLSIBEGIN", "Variant ret = ") s = s.replace("$CALLSIRET", "r_ret = ret;") s = s.replace("$CALLPTRRETPASS", "&ret") |