@@ -1918,11 +1918,17 @@ def generate_engine_class_source(class_api, used_classes, fully_used_classes, us
1918
1918
)
1919
1919
method_call = "\t "
1920
1920
has_return = "return_value" in method and method ["return_value" ]["type" ] != "void"
1921
+ has_meta = "return_value" in method and "meta" in method ["return_value" ]
1921
1922
1922
1923
if has_return :
1923
- result .append (
1924
- f'\t CHECK_METHOD_BIND_RET(_gde_method_bind, { get_default_value_for_type (method ["return_value" ]["type" ])} );'
1925
- )
1924
+ if has_meta :
1925
+ result .append (
1926
+ f'\t CHECK_METHOD_BIND_RET(_gde_method_bind, { get_default_value_for_type (method ["return_value" ]["type" ], method ["return_value" ]["meta" ])} );'
1927
+ )
1928
+ else :
1929
+ result .append (
1930
+ f'\t CHECK_METHOD_BIND_RET(_gde_method_bind, { get_default_value_for_type (method ["return_value" ]["type" ])} );'
1931
+ )
1926
1932
else :
1927
1933
result .append ("\t CHECK_METHOD_BIND(_gde_method_bind);" )
1928
1934
@@ -2708,15 +2714,9 @@ def correct_default_value(value, type_name):
2708
2714
return value
2709
2715
2710
2716
2711
- def correct_typed_array (type_name ):
2712
- if type_name .startswith ("typedarray::" ):
2713
- return type_name .replace ("typedarray::" , "TypedArray<" ) + ">"
2714
- return type_name
2715
-
2716
-
2717
2717
def correct_type (type_name , meta = None , use_alias = True ):
2718
2718
type_conversion = {"float" : "double" , "int" : "int64_t" , "Nil" : "Variant" }
2719
- if meta is not None :
2719
+ if meta is not None and not type_name . startswith ( "typedarray::" ) :
2720
2720
if "int" in meta :
2721
2721
return f"{ meta } _t"
2722
2722
elif meta in type_conversion :
@@ -2726,7 +2726,10 @@ def correct_type(type_name, meta=None, use_alias=True):
2726
2726
if type_name in type_conversion :
2727
2727
return type_conversion [type_name ]
2728
2728
if type_name .startswith ("typedarray::" ):
2729
- return type_name .replace ("typedarray::" , "TypedArray<" ) + ">"
2729
+ elem_type = type_name [len ("typedarray::" ) :]
2730
+ if meta is not None :
2731
+ elem_type = correct_type (elem_type , meta )
2732
+ return "TypedArray<" + elem_type + ">"
2730
2733
if is_enum (type_name ):
2731
2734
if is_bitfield (type_name ):
2732
2735
base_class = get_enum_class (type_name )
@@ -2832,15 +2835,15 @@ def get_operator_id_name(op):
2832
2835
return op_id_map [op ]
2833
2836
2834
2837
2835
- def get_default_value_for_type (type_name ):
2838
+ def get_default_value_for_type (type_name , meta = None ):
2836
2839
if type_name == "int" :
2837
2840
return "0"
2838
2841
if type_name == "float" :
2839
2842
return "0.0"
2840
2843
if type_name == "bool" :
2841
2844
return "false"
2842
2845
if type_name .startswith ("typedarray::" ):
2843
- return f"{ correct_type (type_name )} ()"
2846
+ return f"{ correct_type (type_name , meta )} ()"
2844
2847
if is_enum (type_name ):
2845
2848
return f"{ correct_type (type_name )} (0)"
2846
2849
if is_variant (type_name ):
0 commit comments