Skip to content

Commit c6109fb

Browse files
authored
Merge pull request #726 from bruvzg/fix_build_after_59140
Sync godot-headers and fix build after "Create GDExtension clases for PhysicsServer3D".
2 parents 7bcf579 + 93de1b2 commit c6109fb

File tree

4 files changed

+4303
-1157
lines changed

4 files changed

+4303
-1157
lines changed

binding_generator.py

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -870,13 +870,29 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node):
870870
result.append(f"#ifndef {header_guard}")
871871
result.append(f"#define {header_guard}")
872872

873+
used_classes = []
874+
expanded_format = native_struct["format"].replace("(", " ").replace(")", ";").replace(",", ";")
875+
for field in expanded_format.split(";"):
876+
field_type = field.strip().split(" ")[0].split("::")[0]
877+
if field_type != "" and not is_included_type(field_type) and not is_pod_type(field_type):
878+
if not field_type in used_classes:
879+
used_classes.append(field_type)
880+
873881
result.append("")
882+
883+
for included in used_classes:
884+
result.append(f"#include <godot_cpp/{get_include_path(included)}>")
885+
886+
if len(used_classes) > 0:
887+
result.append("")
888+
874889
result.append("namespace godot {")
875890
result.append("")
876891

877892
result.append(f"struct {struct_name} {{")
878-
for field in native_struct["format"].split(","):
879-
result.append(f"\t{field};")
893+
for field in native_struct["format"].split(";"):
894+
if field != "":
895+
result.append(f"\t{field};")
880896
result.append("};")
881897

882898
result.append("")
@@ -1582,10 +1598,15 @@ def is_pod_type(type_name):
15821598
return type_name in [
15831599
"Nil",
15841600
"void",
1585-
"int",
1586-
"float",
15871601
"bool",
1602+
"real_t",
1603+
"float",
15881604
"double",
1605+
"int",
1606+
"int8_t",
1607+
"uint8_t",
1608+
"int16_t",
1609+
"uint16_t",
15891610
"int32_t",
15901611
"int64_t",
15911612
"uint32_t",
@@ -1601,6 +1622,7 @@ def is_included_type(type_name):
16011622
"AABB",
16021623
"Basis",
16031624
"Color",
1625+
"ObjectID",
16041626
"Plane",
16051627
"Quaternion",
16061628
"Rect2",

0 commit comments

Comments
 (0)