Merge pull request #729 from bruvzg/static_methods
Add support for static method bindings.pull/730/head
commit
3d4d004fb6
|
@ -1119,10 +1119,19 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us
|
||||||
return_type = method["return_value"]["type"]
|
return_type = method["return_value"]["type"]
|
||||||
meta_type = method["return_value"]["meta"] if "meta" in method["return_value"] else None
|
meta_type = method["return_value"]["meta"] if "meta" in method["return_value"] else None
|
||||||
if is_pod_type(return_type) or is_variant(return_type) or is_enum(return_type):
|
if is_pod_type(return_type) or is_variant(return_type) or is_enum(return_type):
|
||||||
|
if method["is_static"]:
|
||||||
|
method_call += f"return internal::_call_native_mb_ret<{get_gdnative_type(correct_type(return_type, meta_type))}>(___method_bind, nullptr"
|
||||||
|
else:
|
||||||
method_call += f"return internal::_call_native_mb_ret<{get_gdnative_type(correct_type(return_type, meta_type))}>(___method_bind, _owner"
|
method_call += f"return internal::_call_native_mb_ret<{get_gdnative_type(correct_type(return_type, meta_type))}>(___method_bind, _owner"
|
||||||
elif is_refcounted(return_type):
|
elif is_refcounted(return_type):
|
||||||
|
if method["is_static"]:
|
||||||
|
method_call += f"return Ref<{return_type}>::___internal_constructor(internal::_call_native_mb_ret_obj<{return_type}>(___method_bind, _nullptr"
|
||||||
|
else:
|
||||||
method_call += f"return Ref<{return_type}>::___internal_constructor(internal::_call_native_mb_ret_obj<{return_type}>(___method_bind, _owner"
|
method_call += f"return Ref<{return_type}>::___internal_constructor(internal::_call_native_mb_ret_obj<{return_type}>(___method_bind, _owner"
|
||||||
is_ref = True
|
is_ref = True
|
||||||
|
else:
|
||||||
|
if method["is_static"]:
|
||||||
|
method_call += f"return internal::_call_native_mb_ret_obj<{return_type}>(___method_bind, nullptr"
|
||||||
else:
|
else:
|
||||||
method_call += f"return internal::_call_native_mb_ret_obj<{return_type}>(___method_bind, _owner"
|
method_call += f"return internal::_call_native_mb_ret_obj<{return_type}>(___method_bind, _owner"
|
||||||
else:
|
else:
|
||||||
|
@ -1511,7 +1520,9 @@ def make_signature(
|
||||||
|
|
||||||
function_signature += ")"
|
function_signature += ")"
|
||||||
|
|
||||||
if "is_const" in function_data and function_data["is_const"]:
|
if "is_static" in function_data and function_data["is_static"] and for_header:
|
||||||
|
function_signature = "static " + function_signature
|
||||||
|
elif "is_const" in function_data and function_data["is_const"]:
|
||||||
function_signature += " const"
|
function_signature += " const"
|
||||||
|
|
||||||
return function_signature
|
return function_signature
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue