Merge pull request #726 from bruvzg/fix_build_after_59140
Sync godot-headers and fix build after "Create GDExtension clases for PhysicsServer3D".pull/729/head
commit
c6109fb08e
|
@ -870,12 +870,28 @@ def generate_engine_classes_bindings(api, output_dir, use_template_get_node):
|
|||
result.append(f"#ifndef {header_guard}")
|
||||
result.append(f"#define {header_guard}")
|
||||
|
||||
used_classes = []
|
||||
expanded_format = native_struct["format"].replace("(", " ").replace(")", ";").replace(",", ";")
|
||||
for field in expanded_format.split(";"):
|
||||
field_type = field.strip().split(" ")[0].split("::")[0]
|
||||
if field_type != "" and not is_included_type(field_type) and not is_pod_type(field_type):
|
||||
if not field_type in used_classes:
|
||||
used_classes.append(field_type)
|
||||
|
||||
result.append("")
|
||||
|
||||
for included in used_classes:
|
||||
result.append(f"#include <godot_cpp/{get_include_path(included)}>")
|
||||
|
||||
if len(used_classes) > 0:
|
||||
result.append("")
|
||||
|
||||
result.append("namespace godot {")
|
||||
result.append("")
|
||||
|
||||
result.append(f"struct {struct_name} {{")
|
||||
for field in native_struct["format"].split(","):
|
||||
for field in native_struct["format"].split(";"):
|
||||
if field != "":
|
||||
result.append(f"\t{field};")
|
||||
result.append("};")
|
||||
|
||||
|
@ -1582,10 +1598,15 @@ def is_pod_type(type_name):
|
|||
return type_name in [
|
||||
"Nil",
|
||||
"void",
|
||||
"int",
|
||||
"float",
|
||||
"bool",
|
||||
"real_t",
|
||||
"float",
|
||||
"double",
|
||||
"int",
|
||||
"int8_t",
|
||||
"uint8_t",
|
||||
"int16_t",
|
||||
"uint16_t",
|
||||
"int32_t",
|
||||
"int64_t",
|
||||
"uint32_t",
|
||||
|
@ -1601,6 +1622,7 @@ def is_included_type(type_name):
|
|||
"AABB",
|
||||
"Basis",
|
||||
"Color",
|
||||
"ObjectID",
|
||||
"Plane",
|
||||
"Quaternion",
|
||||
"Rect2",
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -306,6 +306,8 @@ typedef struct {
|
|||
void (*print_warning)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line);
|
||||
void (*print_script_error)(const char *p_description, const char *p_function, const char *p_file, int32_t p_line);
|
||||
|
||||
uint64_t (*get_native_struct_size)(const char *p_name);
|
||||
|
||||
/* GODOT VARIANT */
|
||||
|
||||
/* variant general */
|
||||
|
|
|
@ -134,6 +134,28 @@ MethodInfo::MethodInfo(const PropertyInfo &p_ret, const char *p_name, const Args
|
|||
arguments = { args... };
|
||||
}
|
||||
|
||||
class ObjectID {
|
||||
uint64_t id = 0;
|
||||
|
||||
public:
|
||||
_FORCE_INLINE_ bool is_ref_counted() const { return (id & (uint64_t(1) << 63)) != 0; }
|
||||
_FORCE_INLINE_ bool is_valid() const { return id != 0; }
|
||||
_FORCE_INLINE_ bool is_null() const { return id == 0; }
|
||||
_FORCE_INLINE_ operator uint64_t() const { return id; }
|
||||
_FORCE_INLINE_ operator int64_t() const { return id; }
|
||||
|
||||
_FORCE_INLINE_ bool operator==(const ObjectID &p_id) const { return id == p_id.id; }
|
||||
_FORCE_INLINE_ bool operator!=(const ObjectID &p_id) const { return id != p_id.id; }
|
||||
_FORCE_INLINE_ bool operator<(const ObjectID &p_id) const { return id < p_id.id; }
|
||||
|
||||
_FORCE_INLINE_ void operator=(int64_t p_int64) { id = p_int64; }
|
||||
_FORCE_INLINE_ void operator=(uint64_t p_uint64) { id = p_uint64; }
|
||||
|
||||
_FORCE_INLINE_ ObjectID() {}
|
||||
_FORCE_INLINE_ explicit ObjectID(const uint64_t p_id) { id = p_id; }
|
||||
_FORCE_INLINE_ explicit ObjectID(const int64_t p_id) { id = p_id; }
|
||||
};
|
||||
|
||||
class ObjectDB {
|
||||
public:
|
||||
static Object *get_instance(uint64_t p_object_id) {
|
||||
|
|
Loading…
Reference in New Issue