From 528200912116293a1f9a2b33d80d232d7743be82 Mon Sep 17 00:00:00 2001 From: Emmanuel Leblond Date: Mon, 3 Oct 2022 14:28:33 +0200 Subject: [PATCH 1/2] Fix Variant types displayed as `Nil` in extension_api.json --- binding_generator.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/binding_generator.py b/binding_generator.py index f87eacd2..0bf46ea9 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -280,10 +280,7 @@ def generate_builtin_bindings(api, output_dir, build_config): if "operators" in builtin_api: for operator in builtin_api["operators"]: if "right_type" in operator: - # FIXME Temporary workaround for incorrect JSON - if operator["right_type"] == "Nil": - used_classes.add("Variant") - elif is_included(operator["right_type"], class_name): + if is_included(operator["right_type"], class_name): used_classes.add(operator["right_type"]) for type_name in fully_used_classes: @@ -728,8 +725,12 @@ def generate_builtin_class_source(builtin_api, size, used_classes, fully_used_cl if "operators" in builtin_api: for operator in builtin_api["operators"]: if "right_type" in operator: + if operator["right_type"] == "Variant": + right_type_variant_type = "GDNATIVE_VARIANT_TYPE_NIL" + else: + right_type_variant_type = f"GDNATIVE_VARIANT_TYPE_{camel_to_snake(operator['right_type']).upper()}" result.append( - f'\t_method_bindings.operator_{get_operator_id_name(operator["name"])}_{operator["right_type"]} = internal::gdn_interface->variant_get_ptr_operator_evaluator(GDNATIVE_VARIANT_OP_{get_operator_id_name(operator["name"]).upper()}, {enum_type_name}, GDNATIVE_VARIANT_TYPE_{camel_to_snake(operator["right_type"]).upper()});' + f'\t_method_bindings.operator_{get_operator_id_name(operator["name"])}_{operator["right_type"]} = internal::gdn_interface->variant_get_ptr_operator_evaluator(GDNATIVE_VARIANT_OP_{get_operator_id_name(operator["name"]).upper()}, {enum_type_name}, {right_type_variant_type});' ) else: result.append( From d17b256fdd407742bb30a595f7bbb1ea0a19ccb9 Mon Sep 17 00:00:00 2001 From: Emmanuel Leblond Date: Wed, 5 Oct 2022 10:53:12 +0200 Subject: [PATCH 2/2] Correct godot-headers/extension_api.json `operator.right_type` field Nil -> Variant --- godot-headers/extension_api.json | 170 +++++++++++++++---------------- 1 file changed, 85 insertions(+), 85 deletions(-) diff --git a/godot-headers/extension_api.json b/godot-headers/extension_api.json index db992e8e..2401a6b3 100644 --- a/godot-headers/extension_api.json +++ b/godot-headers/extension_api.json @@ -5715,17 +5715,17 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "or", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -6172,7 +6172,7 @@ "arguments": [ { "name": "from", - "type": "Nil" + "type": "Variant" } ] } @@ -6185,27 +6185,27 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "and", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "or", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "xor", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -6343,12 +6343,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -6365,17 +6365,17 @@ }, { "name": "and", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "or", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "xor", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -6703,12 +6703,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -6721,17 +6721,17 @@ }, { "name": "and", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "or", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "xor", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -7025,17 +7025,17 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "%", - "right_type": "Nil", + "right_type": "Variant", "return_type": "String" }, { @@ -8648,12 +8648,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -9404,12 +9404,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -9645,12 +9645,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -9953,12 +9953,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -10319,12 +10319,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -11126,12 +11126,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -11381,12 +11381,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -11848,12 +11848,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -12394,12 +12394,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -12660,12 +12660,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -12970,12 +12970,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -13372,12 +13372,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -13819,12 +13819,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -14184,12 +14184,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -15889,12 +15889,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -16449,12 +16449,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -16564,12 +16564,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -16718,12 +16718,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -16797,12 +16797,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -16998,12 +16998,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -17158,12 +17158,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -17367,12 +17367,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -18032,7 +18032,7 @@ }, { "name": "script", - "type": "Nil" + "type": "Variant" } ] }, @@ -18127,12 +18127,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -19006,12 +19006,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -19347,12 +19347,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -19688,12 +19688,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -20029,12 +20029,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -20370,12 +20370,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -20711,12 +20711,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -21057,12 +21057,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { @@ -21403,12 +21403,12 @@ "operators": [ { "name": "==", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, { "name": "!=", - "right_type": "Nil", + "right_type": "Variant", "return_type": "bool" }, {