summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.gitignore11
-rw-r--r--SConstruct (renamed from include/SConstruct)37
-rw-r--r--binding_generator.py623
-rw-r--r--binding_generator/.gitignore4
-rw-r--r--binding_generator/Cargo.toml9
-rw-r--r--binding_generator/src/main.rs772
-rw-r--r--include/core/Array.hpp (renamed from include/godot_cpp/core/Array.hpp)0
-rw-r--r--include/core/Basis.hpp (renamed from include/godot_cpp/core/Basis.hpp)0
-rw-r--r--include/core/Color.hpp (renamed from include/godot_cpp/core/Color.hpp)0
-rw-r--r--include/core/CoreTypes.hpp (renamed from include/godot_cpp/core/CoreTypes.hpp)0
-rw-r--r--include/core/Defs.hpp (renamed from include/godot_cpp/core/Defs.hpp)0
-rw-r--r--include/core/Dictionary.hpp (renamed from include/godot_cpp/core/Dictionary.hpp)0
-rw-r--r--include/core/Godot.hpp (renamed from include/godot_cpp/Godot.hpp)6
-rw-r--r--include/core/Image.hpp (renamed from include/godot_cpp/core/Image.hpp)0
-rw-r--r--include/core/InputEvent.hpp (renamed from include/godot_cpp/core/InputEvent.hpp)0
-rw-r--r--include/core/NodePath.hpp (renamed from include/godot_cpp/core/NodePath.hpp)0
-rw-r--r--include/core/Plane.hpp (renamed from include/godot_cpp/core/Plane.hpp)0
-rw-r--r--include/core/PoolArrays.hpp (renamed from include/godot_cpp/core/PoolArrays.hpp)0
-rw-r--r--include/core/Quat.hpp (renamed from include/godot_cpp/core/Quat.hpp)0
-rw-r--r--include/core/RID.hpp (renamed from include/godot_cpp/core/RID.hpp)0
-rw-r--r--include/core/Rect2.hpp (renamed from include/godot_cpp/core/Rect2.hpp)0
-rw-r--r--include/core/Rect3.hpp (renamed from include/godot_cpp/core/Rect3.hpp)0
-rw-r--r--include/core/String.hpp (renamed from include/godot_cpp/core/String.hpp)0
-rw-r--r--include/core/Transform.hpp (renamed from include/godot_cpp/core/Transform.hpp)0
-rw-r--r--include/core/Transform2D.hpp (renamed from include/godot_cpp/core/Transform2D.hpp)0
-rw-r--r--include/core/Variant.hpp (renamed from include/godot_cpp/core/Variant.hpp)0
-rw-r--r--include/core/Vector2.hpp (renamed from include/godot_cpp/core/Vector2.hpp)0
-rw-r--r--include/core/Vector3.hpp (renamed from include/godot_cpp/core/Vector3.hpp)0
-rw-r--r--src/core/Array.cpp (renamed from include/godot_cpp/core/Array.cpp)0
-rw-r--r--src/core/Basis.cpp (renamed from include/godot_cpp/core/Basis.cpp)0
-rw-r--r--src/core/Color.cpp (renamed from include/godot_cpp/core/Color.cpp)0
-rw-r--r--src/core/Dictionary.cpp (renamed from include/godot_cpp/core/Dictionary.cpp)0
-rw-r--r--src/core/Image.cpp (renamed from include/godot_cpp/core/Image.cpp)0
-rw-r--r--src/core/InputEvent.cpp (renamed from include/godot_cpp/core/InputEvent.cpp)0
-rw-r--r--src/core/NodePath.cpp (renamed from include/godot_cpp/core/NodePath.cpp)0
-rw-r--r--src/core/Plane.cpp (renamed from include/godot_cpp/core/Plane.cpp)0
-rw-r--r--src/core/PoolArrays.cpp (renamed from include/godot_cpp/core/PoolArrays.cpp)0
-rw-r--r--src/core/Quat.cpp (renamed from include/godot_cpp/core/Quat.cpp)0
-rw-r--r--src/core/RID.cpp (renamed from include/godot_cpp/core/RID.cpp)0
-rw-r--r--src/core/Rect2.cpp (renamed from include/godot_cpp/core/Rect2.cpp)0
-rw-r--r--src/core/Rect3.cpp (renamed from include/godot_cpp/core/Rect3.cpp)0
-rw-r--r--src/core/String.cpp (renamed from include/godot_cpp/core/String.cpp)0
-rw-r--r--src/core/Transform.cpp (renamed from include/godot_cpp/core/Transform.cpp)0
-rw-r--r--src/core/Transform2D.cpp (renamed from include/godot_cpp/core/Transform2D.cpp)0
-rw-r--r--src/core/Variant.cpp (renamed from include/godot_cpp/core/Variant.cpp)0
-rw-r--r--src/core/Vector2.cpp (renamed from include/godot_cpp/core/Vector2.cpp)0
-rw-r--r--src/core/Vector3.cpp (renamed from include/godot_cpp/core/Vector3.cpp)0
47 files changed, 650 insertions, 812 deletions
diff --git a/.gitignore b/.gitignore
index d8a92a5..65b551b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,7 +1,8 @@
-include/godot_cpp/*.hpp
-include/godot_cpp/impl/
-include/godot.h
-include/godot
+src/*.cpp
+include/*.hpp
*.os
*.so
-*.obj \ No newline at end of file
+*.obj
+*.pyc
+*.json
+bin
diff --git a/include/SConstruct b/SConstruct
index 9b86034..a4305ca 100644
--- a/include/SConstruct
+++ b/SConstruct
@@ -3,9 +3,11 @@ import os, subprocess
# Local dependency paths, adapt them to your setup
-godot_headers_path = "../../godot_headers/"
-godot_bin_path = "../../godot_fork/bin/"
-godot_lib_path = "../../godot_fork/bin/"
+godot_headers_path = "../godot_headers/"
+godot_bin_path = "../godot_fork/bin/"
+
+# for windows
+godot_lib_path = "../godot_fork/bin/"
env = Environment()
@@ -30,7 +32,7 @@ if target == "core":
if platform == "linux":
env.Append(CCFLAGS = ['-g','-O3', '-std=c++14'])
- env.Append(CPPPATH=['.', godot_headers_path])
+ env.Append(CPPPATH=['include/core', godot_headers_path])
if platform == "windows":
env.Append(LIBS=[godot_name + '.lib'])
@@ -39,9 +41,9 @@ if target == "core":
env.Append(CPPFLAGS=['-D_GD_CPP_CORE_API_IMPL'])
sources = []
- add_sources(sources, "godot_cpp/core")
+ add_sources(sources, "src/core")
- library = env.SharedLibrary(target='godot_cpp_core', source=sources)
+ library = env.SharedLibrary(target='bin/godot_cpp_core', source=sources)
Default(library)
@@ -61,16 +63,13 @@ elif target == "bindings":
subprocess.call([godot_executable, '--gdnative-generate-json-api', json_api_file])
- binding_generator_executable = '../binding_generator/target/debug/binding_generator'
- if platform == "windows":
- binding_generator_executable += ".exe"
-
- # TODO Should that be the job of the generator?
- if not os.path.isdir('godot_cpp/impl'):
- os.mkdir('godot_cpp/impl')
+ # actually create the bindings here
+
+ import binding_generator
- # Note: the binding generator should have been built before
- subprocess.call([binding_generator_executable, json_api_file, 'godot_cpp/'])
+
+ binding_generator.generate_bindings(json_api_file)
+
if platform == "linux":
if env["CXX"] == "clang++":
@@ -80,20 +79,20 @@ elif target == "bindings":
env.Append(CCFLAGS = ['-g','-O3', '-std=c++14'])
env.Append(LINKFLAGS = ['-Wl,-R,\'$$ORIGIN\''])
- env.Append(CPPPATH=['.', godot_headers_path, './godot_cpp'])
+ env.Append(CPPPATH=['.', godot_headers_path, 'include', 'include/core'])
if platform == "windows":
env.Append(LIBS=[godot_name])
env.Append(LIBPATH=[godot_lib_path])
env.Append(LIBS=['godot_cpp_core'])
- env.Append(LIBPATH=['.'])
+ env.Append(LIBPATH=['bin'])
env.Append(CPPFLAGS=['-D_GD_CPP_BINDING_IMPL'])
sources = []
- add_sources(sources, "godot_cpp/impl/")
+ add_sources(sources, "src")
- library = env.SharedLibrary(target='godot_cpp_bindings', source=sources)
+ library = env.SharedLibrary(target='bin/godot_cpp_bindings', source=sources)
Default(library)
diff --git a/binding_generator.py b/binding_generator.py
new file mode 100644
index 0000000..c84625d
--- /dev/null
+++ b/binding_generator.py
@@ -0,0 +1,623 @@
+#!python
+
+import json
+
+# comment.
+
+def generate_bindings(path):
+
+ classes = json.load(open(path))
+
+ icalls = set()
+
+ for c in classes:
+ # print c['name']
+ used_classes = get_used_classes(c)
+
+ header = generate_class_header(used_classes, c)
+
+ impl = generate_class_implementation(icalls, used_classes, c)
+
+ header_file = open("include/" + strip_name(c["name"]) + ".hpp", "w+")
+ header_file.write(header)
+
+ source_file = open("src/" + strip_name(c["name"]) + ".cpp", "w+")
+ source_file.write(impl)
+
+
+ icall_header_file = open("src/__icalls.hpp", "w+")
+ icall_header_file.write(generate_icall_header(icalls))
+
+ icall_source_file = open("src/__icalls.cpp", "w+")
+ icall_source_file.write(generate_icall_implementation(icalls))
+
+
+
+
+def generate_class_header(used_classes, c):
+
+ source = []
+ source.append("#ifndef GODOT_CPP_" + strip_name(c["name"]).upper() + "_HPP")
+ source.append("#define GODOT_CPP_" + strip_name(c["name"]).upper() + "_HPP")
+ source.append("")
+
+
+ source.append("#if defined(_WIN32) && defined(_GD_CPP_BINDING_IMPL)")
+ source.append("# define GD_CPP_BINDING_API __declspec(dllexport)")
+ source.append("#elif defined(_WIN32)")
+ source.append("# define GD_CPP_BINDING_API __declspec(dllimport)")
+ source.append("#else")
+ source.append("# define GD_CPP_BINDING_API")
+ source.append("#endif");
+ source.append("")
+ source.append("")
+ source.append("")
+ source.append("")
+
+ source.append("#include <godot.h>")
+ source.append("")
+
+
+ source.append("#include <CoreTypes.hpp>")
+
+ if c["base_class"] != "":
+ source.append("#include <" + strip_name(c["base_class"]) + ".hpp>")
+
+
+
+ source.append("namespace godot {")
+ source.append("")
+
+
+ for used_type in used_classes:
+ source.append("class " + strip_name(used_type) + ";")
+
+
+ source.append("")
+
+
+ # generate the class definition here
+ source.append("class GD_CPP_BINDING_API " + strip_name(c["name"]) + ("" if c["base_class"] == "" else (" : public " + strip_name(c["base_class"])) ) + " {")
+
+ source.append("public:")
+ source.append("")
+
+ # ___get_class_name
+ source.append("\tstatic inline char *___get_class_name() { return (char *) \"" + strip_name(c["name"]) + "\"; }")
+
+ source.append("\t// constants")
+
+ for name in c["constants"]:
+ source.append("\tconst static int " + name + " = " + str(c["constants"][name]) + ";")
+
+
+ source.append("")
+ source.append("\n\t// methods")
+
+ for method in c["methods"]:
+
+ method_signature = ""
+
+ method_signature += "static " if c["singleton"] else ""
+ method_signature += strip_name(method["return_type"])
+ method_signature += " *" if is_class_type(method["return_type"]) else " "
+ method_signature += escape_cpp(method["name"]) + "("
+
+
+ has_default_argument = False
+
+ for i, argument in enumerate(method["arguments"]):
+ method_signature += "const " + argument["type"] + (" *" if is_class_type(argument["type"]) else " ")
+ method_signature += escape_cpp(argument["name"])
+
+
+ # default arguments
+ def escape_default_arg(_type, default_value):
+ if _type == "Color":
+ return "Color(" + default_value + ")"
+ if _type == "bool" or _type == "int":
+ return default_value.lower()
+ if _type == "Array":
+ return "Array()"
+ if _type in ["PoolVector2Array", "PoolStringArray", "PoolVector3Array", "PoolColorArray"]:
+ return _type + "()"
+ if _type == "Vector2":
+ return "Vector2" + default_value
+ if _type == "Vector3":
+ return "Vector3" + default_value
+ if _type == "Transform":
+ return "Transform()"
+ if _type == "Transform2D":
+ return "Transform2D()"
+ if _type == "Rect2":
+ return "Rect2" + default_value
+ if _type == "Variant":
+ return "Variant()" if default_value == "Null" else default_value
+ if _type == "String":
+ return "\"" + default_value + "\""
+ if _type == "RID":
+ return "RID()"
+
+ if default_value == "Null" or default_value == "[Object:null]":
+ return "nullptr"
+
+ return default_value
+
+
+
+
+ if argument["has_default_value"] or has_default_argument:
+ method_signature += " = " + escape_default_arg(argument["type"], argument["default_value"])
+ has_default_argument = True
+
+
+
+ if i != len(method["arguments"]) - 1:
+ method_signature += ", "
+
+ if method["has_varargs"]:
+ if len(method["arguments"]) > 0:
+ method_signature += ", "
+ method_signature += "const Array& __var_args = Array()"
+
+ method_signature += ")" + (" const" if method["is_const"] and not c["singleton"] else "")
+
+
+ source.append("\t" + method_signature + ";")
+
+
+ source.append("};")
+ source.append("")
+
+
+ source.append("}")
+ source.append("")
+
+
+
+ source.append("#endif")
+
+
+ return "\n".join(source)
+
+
+
+
+
+def generate_class_implementation(icalls, used_classes, c):
+ source = []
+ source.append("#include <" + strip_name(c["name"]) + ".hpp>")
+ source.append("")
+ source.append("")
+
+ source.append("#include <CoreTypes.hpp>")
+
+ source.append("#include <Godot.hpp>")
+ source.append("")
+
+
+ source.append("#include \"__icalls.hpp\"")
+ source.append("")
+ source.append("")
+
+ for used_class in used_classes:
+ source.append("#include <" + strip_name(used_class) + ".hpp>")
+
+ source.append("")
+ source.append("")
+
+ source.append("namespace godot {")
+
+
+ core_object_name = ("___static_object_" + strip_name(c["name"])) if c["singleton"] else "this"
+
+
+ source.append("")
+ source.append("")
+
+ if c["singleton"]:
+ source.append("static godot_object *" + core_object_name + ";")
+ source.append("")
+ source.append("")
+
+ # FIXME Test if inlining has a huge impact on binary size
+ source.append("static inline void ___singleton_init()")
+ source.append("{")
+ source.append("\tif (" + core_object_name + " == nullptr) {")
+ source.append("\t\t" + core_object_name + " = godot_global_get_singleton(\"" + c["name"] + "\");")
+ source.append("\t}")
+ source.append("}")
+
+ source.append("")
+ source.append("")
+
+
+
+
+
+ for method in c["methods"]:
+ method_signature = ""
+
+ method_signature += strip_name(method["return_type"])
+ method_signature += " *" if is_class_type(method["return_type"]) else " "
+ method_signature += strip_name(c["name"]) + "::" + escape_cpp(method["name"]) + "("
+
+ for i, argument in enumerate(method["arguments"]):
+ method_signature += "const " + argument["type"] + (" *" if is_class_type(argument["type"]) else " ")
+ method_signature += escape_cpp(argument["name"])
+
+ if i != len(method["arguments"]) - 1:
+ method_signature += ", "
+
+ if method["has_varargs"]:
+ if len(method["arguments"]) > 0:
+ method_signature += ", "
+ method_signature += "const Array& __var_args"
+
+ method_signature += ")" + (" const" if method["is_const"] and not c["singleton"] else "")
+
+ source.append(method_signature + " {")
+
+
+
+ if c["singleton"]:
+ source.append("\t___singleton_init();")
+
+
+ source.append("\tstatic godot_method_bind *mb = NULL;")
+ source.append("\tif (mb == NULL) {")
+ source.append("\t\tmb = godot_method_bind_get_method(\"" + c["name"] +"\", \"" + method["name"] + "\");")
+ source.append("\t}")
+
+ return_statement = ""
+
+ if method["return_type"] != "void":
+ return_statement += "return " + ("(" + strip_name(method["return_type"]) + " *) " if is_class_type(method["return_type"]) else "")
+
+ def get_icall_type_name(name):
+ if is_class_type(name):
+ return "Object"
+ return name
+
+
+
+ if method["is_virtual"] or method["has_varargs"]:
+
+ source.append("\tVariant __given_args[" + str(len(method["arguments"])) + "];")
+
+ for i, argument in enumerate(method["arguments"]):
+ source.append("\tgodot_variant_new_nil((godot_variant *) &__given_args[" + str(i) + "]);")
+
+ source.append("")
+
+
+ for i, argument in enumerate(method["arguments"]):
+ source.append("\t__given_args[" + str(i) + "] = " + escape_cpp(argument["name"]) + ";")
+
+ source.append("")
+
+ size = ""
+ if method["has_varargs"]:
+ size = "(__var_args.size() + " + str(len(method["arguments"])) + ")"
+ else:
+ size = "(" + str(len(method["arguments"])) + ")"
+
+ source.append("\tgodot_variant **__args = (godot_variant **) alloca(sizeof(godot_variant *) * " + size + ");")
+
+ source.append("")
+
+ for i, argument in enumerate(method["arguments"]):
+ source.append("\t__args[" + str(i) + "] = (godot_variant *) &__given_args[" + str(i) + "];")
+
+ source.append("")
+
+ if method["has_varargs"]:
+ source.append("\tfor (int i = 0; i < __var_args.size(); i++) {")
+ source.append("\t\t__args[i + " + str(len(method["arguments"])) + "] = (godot_variant *) &((Array &) __var_args)[i];")
+ source.append("\t}")
+
+ source.append("")
+
+ source.append("\tVariant __result;")
+ source.append("\t*(godot_variant *) &__result = godot_method_bind_call(mb, (godot_object *) " + core_object_name + ", (const godot_variant **) __args, " + size + ", nullptr);")
+
+ source.append("")
+
+
+ for i, argument in enumerate(method["arguments"]):
+ source.append("\tgodot_variant_destroy((godot_variant *) &__given_args[" + str(i) + "]);")
+
+ source.append("")
+
+ if method["return_type"] != "void":
+ cast = ""
+ if is_class_type(method["return_type"]):
+ cast += "(" + strip_name(method["return_type"]) + " *) (Object *) "
+ source.append("\treturn " + cast + "__result;")
+
+
+
+ else:
+
+ args = []
+ for arg in method["arguments"]:
+ args.append(get_icall_type_name(arg["type"]))
+
+ icall_ret_type = get_icall_type_name(method["return_type"])
+
+ icall_sig = tuple((icall_ret_type, tuple(args)))
+
+ icalls.add(icall_sig)
+
+ icall_name = get_icall_name(icall_sig)
+
+ return_statement += icall_name + "(mb, (godot_object *) " + core_object_name
+
+ for arg in method["arguments"]:
+ return_statement += ", " + escape_cpp(arg["name"])
+
+ return_statement += ")"
+
+ source.append("\t" + return_statement + ";")
+
+ source.append("}")
+ source.append("")
+
+
+
+ source.append("}")
+
+
+ return "\n".join(source)
+
+
+
+
+
+def generate_icall_header(icalls):
+
+ source = []
+ source.append("#ifndef GODOT_CPP__ICALLS_HPP")
+ source.append("#define GODOT_CPP__ICALLS_HPP")
+
+ source.append("")
+
+ source.append("#include <godot.h>")
+ source.append("")
+ source.append("")
+
+ source.append("#include <CoreTypes.hpp>")
+ source.append("#include <Object.hpp>")
+ source.append("")
+ source.append("")
+
+ source.append("namespace godot {")
+ source.append("")
+
+ for icall in icalls:
+ ret_type = icall[0]
+ args = icall[1]
+
+ method_signature = ""
+
+ method_signature += return_type(ret_type) + get_icall_name(icall) + "(godot_method_bind *mb, godot_object *inst"
+
+ for arg in args:
+ method_signature += ", const "
+
+ if is_core_type(arg):
+ method_signature += arg + "&"
+ elif is_primitive(arg):
+ method_signature += arg
+ else:
+ method_signature += "Object *"
+
+ method_signature += ");"
+
+ source.append(method_signature)
+
+ source.append("")
+
+ source.append("}")
+ source.append("")
+
+ source.append("#endif")
+
+ return "\n".join(source)
+
+
+def generate_icall_implementation(icalls):
+ source = []
+ source.append("#include \"__icalls.hpp\"")
+
+ source.append("")
+
+ source.append("#include <godot.h>")
+ source.append("")
+ source.append("")
+
+ source.append("#include <CoreTypes.hpp>")
+ source.append("#include <Object.hpp>")
+ source.append("")
+ source.append("")
+
+ source.append("using namespace godot;")
+ source.append("")
+
+ for icall in icalls:
+ ret_type = icall[0]
+ args = icall[1]
+
+ method_signature = ""
+
+ method_signature += return_type(ret_type) + get_icall_name(icall) + "(godot_method_bind *mb, godot_object *inst"
+
+ for i, arg in enumerate(args):
+ method_signature += ", const "
+
+ if is_core_type(arg):
+ method_signature += arg + "& "
+ elif is_primitive(arg):
+ method_signature += arg + " "
+ else:
+ method_signature += "Object *"
+
+ method_signature += "arg" + str(i)
+
+ method_signature += ")"
+
+ source.append(method_signature + " {")
+
+ if ret_type != "void":
+ source.append("\t" + strip_name(ret_type) + (" *" if is_class_type(ret_type) else " ") + "ret;")
+ if is_class_type(ret_type):
+ source.append("\tret = nullptr;")
+
+
+ source.append("\tconst void *args[" + ("1" if len(args) == 0 else "") + "] = {")
+
+ for i, arg in enumerate(args):
+
+ wrapped_argument = "\t\t"
+ if is_primitive(arg) or is_core_type(arg):
+ wrapped_argument += "(void *) &arg" + str(i)
+ else:
+ wrapped_argument += "(void *) arg" + str(i)
+
+ wrapped_argument += ","
+ source.append(wrapped_argument)
+
+ source.append("\t};")
+ source.append("")
+
+ source.append("\tgodot_method_bind_ptrcall(mb, inst, args, " + ("nullptr" if ret_type == "void" else "&ret") + ");")
+
+ if ret_type != "void":
+ source.append("\treturn ret;")
+
+ source.append("}")
+
+ source.append("")
+
+ return "\n".join(source)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+def return_type(t):
+ if is_class_type(t):
+ return "Object *"
+ return t + " "
+
+
+def get_icall_name(sig):
+ ret_type = sig[0]
+ args = sig[1]
+
+ name = "___godot_icall_"
+ name += strip_name(ret_type)
+ for arg in args:
+ name += "_" + strip_name(arg)
+
+ return name
+
+
+
+
+
+
+def get_used_classes(c):
+ classes = []
+ for method in c["methods"]:
+ if is_class_type(method["return_type"]) and not (method["return_type"] in classes):
+ classes.append(method["return_type"])
+
+ for arg in method["arguments"]:
+ if is_class_type(arg["type"]) and not (arg["type"] in classes):
+ classes.append(arg["type"])
+ return classes
+
+
+
+
+
+
+
+
+def strip_name(name):
+ if name[0] == '_':
+ return name[1:]
+ return name
+
+
+def is_class_type(name):
+ return not is_core_type(name) and not is_primitive(name)
+
+def is_core_type(name):
+ core_types = ["Array",
+ "Basis",
+ "Color",
+ "Dictionary",
+ "Error",
+ "Image",
+ "InputEvent",
+ "NodePath",
+ "Plane",
+ "PoolByteArray",
+ "PoolIntArray",
+ "PoolRealArray",
+ "PoolStringArray",
+ "PoolVector2Array",
+ "PoolVector3Array",
+ "PoolColorArray",
+ "Quat",
+ "Rect2",
+ "Rect3",
+ "RID",
+ "String",
+ "Transform",
+ "Transform2D",
+ "Variant",
+ "Vector2",
+ "Vector3"]
+ return name in core_types
+
+
+
+
+def is_primitive(name):
+ core_types = ["int", "bool", "real", "float", "void"]
+ return name in core_types
+
+def escape_cpp(name):
+ escapes = {
+ "class": "_class",
+ "char": "_char",
+ "short": "_short",
+ "bool": "_bool",
+ "int": "_int",
+ "default": "_default",
+ "case": "_case",
+ "switch": "_switch",
+ "export": "_export",
+ "template": "_template",
+ "new": "new_"
+ }
+ if name in escapes:
+ return escapes[name]
+ return name
diff --git a/binding_generator/.gitignore b/binding_generator/.gitignore
deleted file mode 100644
index 6678b89..0000000
--- a/binding_generator/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-target
-.idea/
-*.iml
-Cargo.lock
diff --git a/binding_generator/Cargo.toml b/binding_generator/Cargo.toml
deleted file mode 100644
index 9c6a407..0000000
--- a/binding_generator/Cargo.toml
+++ /dev/null
@@ -1,9 +0,0 @@
-[package]
-name = "binding_generator"
-version = "0.1.0"
-authors = ["karroffel"]
-
-[dependencies]
-serde = "*"
-serde_json = "*"
-serde_derive = "*"
diff --git a/binding_generator/src/main.rs b/binding_generator/src/main.rs
deleted file mode 100644
index 6d25386..0000000
--- a/binding_generator/src/main.rs
+++ /dev/null
@@ -1,772 +0,0 @@
-extern crate serde_json;
-#[macro_use]
-extern crate serde_derive;
-
-
-use serde_json::*;
-use std::fs::File;
-use std::iter::Iterator;
-use std::io::prelude::*;
-
-use std::collections::HashSet;
-
-use std::env;
-
-// use std::ascii::AsciiExt;
-
-#[derive(Deserialize)]
-struct GodotClass {
- name: String,
- base_class: String,
- api_type: String,
- singleton: bool,
- instanciable: bool,
- is_reference: bool,
- constants: Map<String, Value>,
- methods: Vec<GodotMethod>
-}
-
-#[derive(Deserialize)]
-struct GodotMethod {
- name: String,
- return_type: String,
- is_editor: bool,
- is_noscript: bool,
- is_const: bool,
- is_virtual: bool,
- has_varargs: bool,
- is_from_script: bool,
- arguments: Vec<GodotArgument>
-}
-
-#[derive(Deserialize)]
-struct GodotArgument {
- name: String,
- #[serde(rename = "type")]
- _type: String,
- has_default_value: bool,
- default_value: String
-}
-
-fn strip_name(s: &String) -> &str {
- if s.starts_with("_") {
- unsafe { s.slice_unchecked(1, s.len()) }
- } else {
- s.as_str()
- }
-}
-
-fn main() {
- let base_dir = match env::args().nth(2) {
- Some(x) => x,
- None => return
- };
-
- let mut file = match env::args().nth(1) {
- Some(x) => File::open(x).unwrap(),
- None => return
- };
-
- let mut file_contents = String::new();
-
- file.read_to_string(&mut file_contents);
-
- let json: Vec<GodotClass> = serde_json::from_str::<Vec<GodotClass>>(&file_contents).unwrap();
-
- let mut icalls: HashSet<(String, Vec<String>)> = HashSet::new();
-
- for class in &json {
- // make this toggleable with a command line switch
- // if class.api_type == "tools" {
- // println!("{}", class.name);
- // continue
- // }
- let used_classes = get_used_classes(&class);
-
- let mut header = File::create((base_dir.to_string() + strip_name(&class.name) + ".hpp").as_str()).unwrap();
-
- header.write_all(generate_class_header(&used_classes, &class).as_bytes());
-
- let mut implementation = File::create((base_dir.to_string() + "impl/" + strip_name(&class.name) + ".cpp").as_str()).unwrap();
- implementation.write_all(generate_class_implementation(&mut icalls, &used_classes, &class).as_bytes());
- }
-
- // generate icall files
- let mut icall_header = File::create((base_dir.to_string() + "__icalls.hpp").as_str()).unwrap();
-
- icall_header.write_all(generate_icall_header(&icalls).as_bytes());
-
- let mut icall_implmentation = File::create((base_dir.to_string() + "impl/__icalls.cpp").as_str()).unwrap();
-
- icall_implmentation.write_all(generate_icall_implementation(&json, &icalls).as_bytes());
-}
-
-fn get_used_classes(class: &GodotClass) -> HashSet<&String> {
-
- let mut classes = HashSet::new();
-
- // classes.insert(&class.base_class);
-
- for method in &class.methods {
- if !is_primitive(&method.return_type) &&!is_core_type(&method.return_type) && !classes.contains(&method.return_type) {
- classes.insert(&method.return_type);
- }
-
- for argument in &method.arguments {
- if !is_primitive(&argument._type) &&!is_core_type(&argument._type) && !classes.contains(&argument._type) {
- classes.insert(&argument._type);
- }
- }
- }
-
- return classes;
-}
-
-fn generate_class_header(used_classes: &HashSet<&String>, class: &GodotClass) -> String {
- let mut contents = String::new();
-
- contents = contents + "#ifndef ";
- contents = contents + strip_name(&class.name).to_string().to_uppercase().as_str() + "_H\n";
-
- contents = contents + "#define ";
- contents = contents + strip_name(&class.name).to_string().to_uppercase().as_str() + "_H\n\n";
-
- contents = contents + "#if defined(_WIN32) && defined(_GD_CPP_BINDING_IMPL)\n";
- contents = contents + "# define GD_CPP_BINDING_API __declspec(dllexport)\n";
- contents = contents + "#elif defined(_WIN32)\n";
- contents = contents + "# define GD_CPP_BINDING_API __declspec(dllimport)\n";
- contents = contents + "#else\n";
- contents = contents + "# define GD_CPP_BINDING_API\n";
- contents = contents + "#endif\n\n";
-
-
- contents = contents + "\n#include \"core/CoreTypes.hpp\"\n";
-
- contents = contents + "\n#include <godot.h>\n\n\n";
-
- if class.base_class != "" {
- contents = contents + "\n#include \"" + strip_name(&class.base_class) + ".hpp\"\n\n\n";
- }
-
- contents = contents + "namespace godot {\n\n";
-
- // contents += forward_declares;
-
- for used_type in used_classes {
- contents = contents + "class " + strip_name(used_type) + ";\n"
- }
-
- contents = contents + "\n\n";
-
- let core_obj_name = {
- let mut name = String::new();
- if class.singleton {
- name = name + "___static_object_" + strip_name(&class.name);
- } else {
- name = name + "this";
- };
- name
- };
-
- contents = contents + "class GD_CPP_BINDING_API " + strip_name(&class.name);
-
- if class.base_class != "" {
- contents = contents + " : public " + strip_name(&class.base_class);
- }
-
- contents = contents + " {\n";
-
- // if class.base_class == "" {
- // contents = contents + "public:\n\tgodot_object *__core_object = 0;\n\n";
- // }
-
- if class.singleton {
- contents = contents + "private:\n";
- contents = contents + "\tstatic void ___singleton_init();\n";
- }
-
- contents = contents + "public:\n\n";
-
- // default constructor
-
- {
- contents = contents + "\tstatic " + strip_name(&class.name) + "* _new();\n\n";
- }
-
-
- // pointer constructor
- // {
- // contents = contents + "\t" + strip_name(&class.name) + "(godot_object *ptr);\n\n";
- // }
-
- // object constructor
- // if !class.singleton {
- // contents = contents + "\t" + strip_name(&class.name) + "(const Object *ptr);\n\n";
- // contents = contents + "\t" + strip_name(&class.name) + "(const Variant& obj);\n\n";
- // }
-
- if class.name != "Object" {
- contents = contents + "\tvoid _init();\n\n";
- }
-
- // if class.instanciable {
- // contents = contents + "\tstatic " + strip_name(&class.name) + " __new();\n";
- // contents = contents + "\tvoid __destroy();\n\n";
- // }
-
- for (name, value) in &class.constants {
- contents = contents + "\tconst static int " + name.as_str() + " = " + value.as_i64().unwrap().to_string().as_str() + ";\n";
- }
-
- contents += "\n\n";
-
- fn escape_default_arg(type_: &String, arg: &String) -> String {
- match type_.as_str() {
- "Color" => {
- String::from("Color(") + arg.as_str() + ")"
- },
- "bool" | "int" => {
- String::from(arg.as_str()).as_str().to_lowercase()
- },
- "Array" => {
- String::from("Array()")
- },
- "PoolVector2Array" | "PoolStringArray" | "PoolColorArray" | "PoolVector3Array" => {
- type_.clone() + "()" // String::from("PoolVector2Array()")
- }
- "Vector2" => {
- String::from("Vector2") + arg.as_str()
- }
- "Vector3" => {
- String::from("Vector3") + arg.as_str()
- }
- "Transform" => {
- String::from("Transform()")// + arg.as_str() + ")"
- }
- "Transform2D" => {
- String::from("Transform2D()")
- }
- "Rect2" => {
- String::from("Rect2") + arg.as_str()
- }
- "Variant" => {
- if arg == "Null" {
- String::from("Variant()")
- } else {
- arg.clone()
- }
- }
- "String" => {
- String::from("\"") + arg.as_str() + "\""
- }
- "RID" => {
- String::from("RID()")
- }
- _ => {
- match arg.as_str() {
- "Null" => String::from("nullptr"),
- "[Object:null]" => String::from("nullptr"),
- a => String::from(a)
- }
- }
- }
- }
-
- for method in &class.methods {
- contents = contents + "\t" + (if class.singleton { "static " } else { "" }) + strip_name(&method.return_type) + (if !is_core_type(&method.return_type) && !is_primitive(&method.return_type) { " *" } else { " " }) + escape_cpp(&method.name) + "(";
-
- let mut has_default = false;
-
- for (i, argument) in (&method.arguments).iter().enumerate() {
- if !is_primitive(&argument._type) && !is_core_type(&argument._type) {
- contents = contents + "const " + argument._type.as_str() + " *";
- } else {
- contents = contents + "const " + argument._type.as_str() + " ";
- }
-
- contents = contents + escape_cpp(&argument.name);
-
- if argument.has_default_value || has_default {
- contents = contents + " = " + escape_default_arg(&argument._type, &argument.default_value).as_str();
- has_default = true;
- }// else if has_default {
- // contents = contents + " = \"\"";
- //}
-
- if i != method.arguments.len() - 1 {
- contents += ", ";
- }
- }
-
- if method.has_varargs {
- if method.arguments.len() > 0 {
- contents += ", ";
- }
- contents = contents + "const Array& __var_args = Array()";
- }
-
- contents = contents + ")" + if method.is_const && !class.singleton { " const" } else { "" } + ";\n";
- // contents = contents + ")" + if method.is_const { " const" } else { "" } + ";\n";
- }
-
- contents = contents + "};\n\n";
-
- // if class.base_class == "" {
- // // Object
- // contents = contents + "\ninline\n#if defined(_WIN32)\n# ifdef _GD_CPP_BINDING_IMPL\n __declspec(dllexport)\n# else\n __declspec(dllimport)\n# endif\n#endif\nVariant::operator Object() const\n{\n\n";
-
- // contents = contents + "\treturn Object(godot_variant_as_object(&_godot_variant));\n\n";
-
- // contents = contents + "\n}\n\n";
- // }
-
- contents = contents + "}\n";
-
- contents = contents + "#endif\n";
-
- contents
-}
-
-
-fn generate_class_implementation(icalls: &mut HashSet<(String, Vec<String>)>, used_classes: &HashSet<&String>, class: &GodotClass) -> String {
- let mut contents = String::new();
-
- contents = contents + "#include \"" + strip_name(&class.name) + ".hpp" + "\"\n";
-
- contents = contents + "\n#include \"core/CoreTypes.hpp\"\n";
-
- contents = contents + "\n#include \"Godot.hpp\"\n\n";
-
- if class.instanciable {
- contents = contents + "#include \"ClassDB.hpp\"\n";
- }
-
- contents = contents + "\n#include \"__icalls.hpp\"\n\n\n";
-
- for used_class in used_classes {
- contents = contents + "#include \"" + strip_name(used_class) + ".hpp\"\n";
- }
-
- contents = contents + "\n\n";
-
- contents = contents + "namespace godot {\n\n";
-
- let core_obj_name = {
- let mut name = String::new();
- if class.singleton {
- name = name + "___static_object_" + strip_name(&class.name);
- } else {
- name = name + "this";
- };
- name
- };
-
- contents = contents + "\n\n\n";
-
- if class.singleton {
- contents = contents + "static godot_object *" + core_obj_name.as_str() + ";\n\n\n\n\n";
- }
-
-
- if class.singleton {
- contents = contents + "void " + strip_name(&class.name) + "::___singleton_init()\n{\n\t"
- + core_obj_name.as_str() + " = godot_global_get_singleton(\"" + strip_name(&class.name) + "\");\n}\n\n";
- }
-
-
- // default constructor
-
- {
- contents = contents + strip_name(&class.name) + " *" + strip_name(&class.name) + "::_new()\n{\n";
- contents = contents + "\tgodot_class_constructor constructor = godot_get_class_constructor(\"" + class.name.as_str() + "\");\n";
- contents = contents + "\tif (!constructor) { return nullptr; }\n";
- contents = contents + "\treturn (" + strip_name(&class.name) + " *) constructor();\n";
- contents = contents + "}\n\n";
- }
-
-
- // pointer constructor
- // {
- // contents = contents + "" + strip_name(&class.name) + "::" + strip_name(&class.name) + "(godot_object *ptr)\n{\n";
- // contents = contents + "\t__core_object = ptr;\n";
- // contents = contents + "}\n\n\n";
- // }
-
- // Object constructor
- // if !class.singleton {
- // contents = contents + "" + strip_name(&class.name) + "::" + strip_name(&class.name) + "(const Object *ptr)\n{\n";
- // contents = contents + "\t__core_object = ?;\n";
- // contents = contents + "}\n\n\n";
- //
- // contents = contents + "" + strip_name(&class.name) + "::" + strip_name(&class.name) + "(const Variant& obj)\n{\n";
- // contents = contents + "\t__core_object = ((Object) obj).__core_object;\n";
- // contents = contents + "}\n\n\n";
- // }
-
- if class.name != "Object" {
- contents = contents + "void " + strip_name(&class.name) + "::" + "_init()\n{\n";
- contents = contents + "\t\n";
- contents = contents + "}\n\n";
- }
-
-
- contents += "\n\n";
-
- for method in &class.methods {
- contents = contents + strip_name(&method.return_type) + (if !is_core_type(&method.return_type) && !is_primitive(&method.return_type) { " *" } else { " " }) + strip_name(&class.name) + "::" + escape_cpp(&method.name) + "(";
-
- for (i, argument) in (&method.arguments).iter().enumerate() {
- if !is_primitive(&argument._type) && !is_core_type(&argument._type) {
- contents = contents + "const " + argument._type.as_str() + " *";
- } else {
- contents = contents + "const " + argument._type.as_str() + " ";
- }
-
- contents = contents + escape_cpp(&argument.name);
- if i != method.arguments.len() - 1 {
- contents += ", ";
- }
- }
-
- if method.has_varargs {
- if method.arguments.len() > 0 {
- contents += ", ";
- }
- contents = contents + "const Array& __var_args";
- }
-
- contents = contents + ")" + if method.is_const && !class.singleton { " const" } else { "" } + "\n{\n";
-
-
- if class.singleton {
- contents = contents + "\tif (" + core_obj_name.as_str() + " == 0) {\n";
- contents = contents + "\t\t___singleton_init();\n";
- contents = contents + "\t}\n\n";
- }
-
- if method.is_virtual || method.has_varargs {
-
- contents = contents + "\tArray __args;\n";
-
- // fill in the args
- for arg in &method.arguments {
- contents = contents + "\t__args.append(" + escape_cpp(&arg.name) + ");\n";
- }
-
- if method.has_varargs {
- contents = contents + "\tfor (int i = 0; i < __var_args.size(); i++) {\n";
- contents = contents + "\t\t__args.append(__var_args[i]);\n";
- contents = contents + "\t}\n";
- }
-
- contents = contents + "\t";
-
- if method.return_type != "void" {
- contents = contents + "return ";
-
- if !is_primitive(&method.return_type) && !is_core_type(&method.return_type) {
- contents = contents + "(" + strip_name(&method.return_type) + " *) (Object *) ";
- }
- }
-
- contents = contents + "((Object *) " + core_obj_name.as_str() + ")->callv(\"" + method.name.as_str() + "\", __args);\n";
- } else {
- contents = contents + "\tstatic godot_method_bind *mb = NULL;\n"
- + "\tif (mb == NULL) {\n"
- + "\t\tmb = godot_method_bind_get_method(\"" + class.name.as_str() + "\", \"" + method.name.as_str() + "\");\n"
- + "\t}\n\t";
-
-
- if method.return_type != "void" {
- contents = contents + "return ";
- if !is_primitive(&method.return_type) && !is_core_type(&method.return_type) {
- contents = contents + "(" + strip_name(&method.return_type) + " *) ";
- }
- }
-
- let mut args = Vec::new();
-
- fn get_icall_type_name(t: &String) -> String {
- if is_core_type(t) || is_primitive(t) {
- t.clone()
- } else {
- String::from("Object")
- }
- }
-
- for arg in &method.arguments {
- args.push(get_icall_type_name(&arg._type));
- }
-
- let icallsig = (get_icall_type_name(&method.return_type), args);
-
- let name = get_icall_name(&icallsig);
-
- icalls.insert(icallsig);
-
-
- contents = contents + name.as_str() + "(mb, (godot_object *) " + core_obj_name.as_str();
-
- for arg in &method.arguments {
- contents = contents + ", " + escape_cpp(&arg.name);
- }
-
- // if !is_primitive(&method.return_type) && !is_core_type(&method.return_type) {
- // contents = contents + ")";
- // }
- contents = contents + ");\n";
- }
-
- contents = contents + "}\n\n";
- }
-
- // if class.instanciable {
-
- // contents = contents + strip_name(&class.name) + " " + strip_name(&class.name) + "::__new() {\n";
- // contents = contents + "\tObject ptr = ClassDB::instance(\"" + class.name.as_str() + "\");\n";
- // contents = contents + "\treturn ptr;\n";
- // contents = contents + "}\n\n";
-
- // contents = contents + "void " + strip_name(&class.name) + "::__destroy() {\n";
- // contents = contents + "\tgodot_object_destroy(__core_object);\n";
- // contents = contents + "}\n\n\n";
-
- /* if class.base_class == "" {
- // Object
- contents = contents + "Variant::operator Object()const {\n\n";
-
- contents = contents + "\treturn Object(godot_variant_as_object(&_godot_variant));\n\n";
-
- contents = contents + "}\n\n";
- } */
- // }
-
- contents = contents + "}\n";
-
- contents
-}
-
-fn get_icall_name(sig: &(String, Vec<String>)) -> String {
-
- let &(ref ret, ref args) = sig;
-
- let mut name = String::new();
-
- name = name + "___godot_icall_";
-
- name = name + strip_name(&ret);
-
- for arg in args {
- name = name + "_" + strip_name(&arg);
- }
-
- name
-}
-
-fn get_icall_name_ref(sig: (&String, &Vec<String>)) -> String {
-
- let (ref ret, args) = sig;
-
- let mut name = String::new();
-
- name = name + "___godot_icall_";
-
- name = name + strip_name(&ret);
-
- for arg in args {
- name = name + "_" + strip_name(&arg);
- }
-
- name
-}
-
-fn generate_icall_header(icalls: &HashSet<(String, Vec<String>)>) -> String {
-
- fn return_type(t: &String) -> String {
- if is_primitive(t) || is_core_type(t) {
- t.clone()
- } else {
- String::from("Object *")
- }
- }
-
-
- let mut contents = String::new();
-
- contents = contents + "#ifndef __ICALLS_H\n";
- contents = contents + "#define __ICALLS_H\n\n\n";
-
- contents = contents + "#include <godot.h>\n\n\n";
-
- contents = contents + "#include \"core/CoreTypes.hpp\"\n";
- contents = contents + "#include \"Object.hpp\"\n\n\n";
-
-
-
- contents = contents + "using namespace godot;\n\n\n";
-
- for &(ref ret, ref args) in icalls {
- contents = contents + return_type(ret).as_str() + " " + get_icall_name_ref((ret, args)).as_str() + "(godot_method_bind *mb, godot_object *inst";
- for arg in args {
- contents = contents + ", ";
- if is_core_type(&arg) {
- // if !is_primitive(&arg) {
- contents = contents + "const " + arg.as_str() + "& ";
- } else if is_primitive(&arg) {
- contents = contents + "const " + arg.as_str() + " ";
- } else {
- contents = contents + "const Object *";
- }
- }
- contents = contents + ");\n";
- }
-
- contents = contents + "#endif";
-
- contents
-}
-
-fn generate_icall_implementation(class_api: &Vec<GodotClass>, icalls: &HashSet<(String, Vec<String>)>) -> String {
-
- fn return_type(t: &String) -> String {
- if is_primitive(t) || is_core_type(t) {
- t.clone()
- } else {
- let s = String::new() + t.as_str() + " *";
- s
- }
- }
-
- let is_reference = |name: &String| {
- for class in class_api {
- if class.name.as_str() == name.as_str() {
- return class.is_reference;
- }
- }
- false
- };
-
- let mut contents = String::new();
-
- contents = contents + "#include \"__icalls.hpp\"\n";
-
- contents = contents + "#include <godot.h>\n\n\n";
-
- contents = contents + "#include \"core/CoreTypes.hpp\"\n";
- contents = contents + "#include \"Object.hpp\"\n\n\n";
-
- contents = contents + "using namespace godot;\n\n\n";
-
- for &(ref ret, ref args) in icalls {
- contents = contents + return_type(ret).as_str() + " " + get_icall_name_ref((ret, args)).as_str() + "(godot_method_bind *mb, godot_object *inst";
- let mut i = 0;
- for arg in args {
- contents = contents + ", ";
- if is_core_type(&arg) {
- // if !is_primitive(&arg) {
- contents = contents + "const " + arg.as_str() + "& ";
- } else if is_primitive(&arg) {
- contents = contents + "const " + arg.as_str() + " ";
- } else {
- contents = contents + "const " + arg.as_str() + " *";
- }
- contents = contents + "arg" + i.to_string().as_str();
- i = i + 1;
- }
- contents = contents + ")\n";
-
- contents = contents + "{\n";
-
- if ret != "void" {
- contents = contents + "\t" + strip_name(ret) + if !is_core_type(ret) && !is_primitive(ret) { " *" } else { "" } + " ret;\n";
- if !is_core_type(ret) && !is_primitive(ret) {
- contents = contents + "\t" + "ret = nullptr;\n";
- }
- }
-
- contents = contents + "\tconst void *args[" + if args.len() == 0 { "1" } else { "" } + "] = {\n";
-
- let mut j = 0;
- for arg in args {
- contents = contents + "\t\t";
- if is_primitive(arg) {
- contents = contents + "&arg" + j.to_string().as_str();
- } else if is_core_type(arg) {
- contents = contents + "(void *) &arg" + j.to_string().as_str();
- } else {
- contents = contents + "(void *) arg" + j.to_string().as_str();
- }
- contents = contents + ",\n";
- j = j + 1;
- }
-
- contents = contents + "\t};\n";
-
- contents = contents + "\tgodot_method_bind_ptrcall(mb, inst, args, " + if ret == "void" { "NULL" } else { "&ret" } + ");\n";
-
- if !is_primitive(ret) && !is_core_type(ret) {
- contents = contents + "\treturn ret;\n";
- } else if ret != "void" {
- contents = contents + "\treturn ret;\n";
- }
-
- contents = contents + "}\n\n";
- }
-
- // contents = contents + "#endif";
-
- contents
-}
-
-
-fn is_core_type(name: &String) -> bool {
- let core_types = vec!["Array",
- "Basis",
- "Color",
- "Dictionary",
- "Error",
- "Image",
- "InputEvent",
- "NodePath",
- "Plane",
- "PoolByteArray",
- "PoolIntArray",
- "PoolRealArray",
- "PoolStringArray",
- "PoolVector2Array",
- "PoolVector3Array",
- "PoolColorArray",
- "Quat",
- "Rect2",
- "Rect3",
- "RID",
- "String",
- "Transform",
- "Transform2D",
- "Variant",
- "Vector2",
- "Vector3"];
- core_types.contains(&name.as_str())
-}
-
-fn is_primitive(name: &String) -> bool {
- let core_types = vec!["int", "bool", "real", "float", "void"];
- core_types.contains(&name.as_str())
-}
-
-fn escape_cpp(name: &String) -> &str {
- match name.as_str() {
- "class" => "_class",
- "char" => "_char",
- "short" => "_short",
- "bool" => "_bool",
- "int" => "_int",
- "default" => "_default",
- "case" => "_case",
- "switch" => "_switch",
- "export" => "_export",
- "template" => "_template",
- "new" => "new_",
- x => x
- }
-}
diff --git a/include/godot_cpp/core/Array.hpp b/include/core/Array.hpp
index 9a39b35..9a39b35 100644
--- a/include/godot_cpp/core/Array.hpp
+++ b/include/core/Array.hpp
diff --git a/include/godot_cpp/core/Basis.hpp b/include/core/Basis.hpp
index eda3d09..eda3d09 100644
--- a/include/godot_cpp/core/Basis.hpp
+++ b/include/core/Basis.hpp
diff --git a/include/godot_cpp/core/Color.hpp b/include/core/Color.hpp
index dbaf7aa..dbaf7aa 100644
--- a/include/godot_cpp/core/Color.hpp
+++ b/include/core/Color.hpp
diff --git a/include/godot_cpp/core/CoreTypes.hpp b/include/core/CoreTypes.hpp
index c82243a..c82243a 100644
--- a/include/godot_cpp/core/CoreTypes.hpp
+++ b/include/core/CoreTypes.hpp
diff --git a/include/godot_cpp/core/Defs.hpp b/include/core/Defs.hpp
index b2da2cc..b2da2cc 100644
--- a/include/godot_cpp/core/Defs.hpp
+++ b/include/core/Defs.hpp
diff --git a/include/godot_cpp/core/Dictionary.hpp b/include/core/Dictionary.hpp
index 139e3ff..139e3ff 100644
--- a/include/godot_cpp/core/Dictionary.hpp
+++ b/include/core/Dictionary.hpp
diff --git a/include/godot_cpp/Godot.hpp b/include/core/Godot.hpp
index 43d97ac..0069b63 100644
--- a/include/godot_cpp/Godot.hpp
+++ b/include/core/Godot.hpp
@@ -6,10 +6,10 @@
#include <godot.h>
-#include <godot_cpp/core/CoreTypes.hpp>
-#include <godot_cpp/core/Variant.hpp>
+#include <CoreTypes.hpp>
+#include <Variant.hpp>
-#include <godot_cpp/Object.hpp>
+#include <Object.hpp>
namespace godot {
diff --git a/include/godot_cpp/core/Image.hpp b/include/core/Image.hpp
index cbe3c72..cbe3c72 100644
--- a/include/godot_cpp/core/Image.hpp
+++ b/include/core/Image.hpp
diff --git a/include/godot_cpp/core/InputEvent.hpp b/include/core/InputEvent.hpp
index f4fb33d..f4fb33d 100644
--- a/include/godot_cpp/core/InputEvent.hpp
+++ b/include/core/InputEvent.hpp
diff --git a/include/godot_cpp/core/NodePath.hpp b/include/core/NodePath.hpp
index 3f75ca1..3f75ca1 100644
--- a/include/godot_cpp/core/NodePath.hpp
+++ b/include/core/NodePath.hpp
diff --git a/include/godot_cpp/core/Plane.hpp b/include/core/Plane.hpp
index dbcf448..dbcf448 100644
--- a/include/godot_cpp/core/Plane.hpp
+++ b/include/core/Plane.hpp
diff --git a/include/godot_cpp/core/PoolArrays.hpp b/include/core/PoolArrays.hpp
index ebbd61d..ebbd61d 100644
--- a/include/godot_cpp/core/PoolArrays.hpp
+++ b/include/core/PoolArrays.hpp
diff --git a/include/godot_cpp/core/Quat.hpp b/include/core/Quat.hpp
index 03bb015..03bb015 100644
--- a/include/godot_cpp/core/Quat.hpp
+++ b/include/core/Quat.hpp
diff --git a/include/godot_cpp/core/RID.hpp b/include/core/RID.hpp
index 634b7f0..634b7f0 100644
--- a/include/godot_cpp/core/RID.hpp
+++ b/include/core/RID.hpp
diff --git a/include/godot_cpp/core/Rect2.hpp b/include/core/Rect2.hpp
index 849fa68..849fa68 100644
--- a/include/godot_cpp/core/Rect2.hpp
+++ b/include/core/Rect2.hpp
diff --git a/include/godot_cpp/core/Rect3.hpp b/include/core/Rect3.hpp
index b04195c..b04195c 100644
--- a/include/godot_cpp/core/Rect3.hpp
+++ b/include/core/Rect3.hpp
diff --git a/include/godot_cpp/core/String.hpp b/include/core/String.hpp
index ee6532e..ee6532e 100644
--- a/include/godot_cpp/core/String.hpp
+++ b/include/core/String.hpp
diff --git a/include/godot_cpp/core/Transform.hpp b/include/core/Transform.hpp
index f6f5143..f6f5143 100644
--- a/include/godot_cpp/core/Transform.hpp
+++ b/include/core/Transform.hpp
diff --git a/include/godot_cpp/core/Transform2D.hpp b/include/core/Transform2D.hpp
index 553c324..553c324 100644
--- a/include/godot_cpp/core/Transform2D.hpp
+++ b/include/core/Transform2D.hpp
diff --git a/include/godot_cpp/core/Variant.hpp b/include/core/Variant.hpp
index baa1498..baa1498 100644
--- a/include/godot_cpp/core/Variant.hpp
+++ b/include/core/Variant.hpp
diff --git a/include/godot_cpp/core/Vector2.hpp b/include/core/Vector2.hpp
index 73dd562..73dd562 100644
--- a/include/godot_cpp/core/Vector2.hpp
+++ b/include/core/Vector2.hpp
diff --git a/include/godot_cpp/core/Vector3.hpp b/include/core/Vector3.hpp
index 52a5d73..52a5d73 100644
--- a/include/godot_cpp/core/Vector3.hpp
+++ b/include/core/Vector3.hpp
diff --git a/include/godot_cpp/core/Array.cpp b/src/core/Array.cpp
index e610e1b..e610e1b 100644
--- a/include/godot_cpp/core/Array.cpp
+++ b/src/core/Array.cpp
diff --git a/include/godot_cpp/core/Basis.cpp b/src/core/Basis.cpp
index dff6e4f..dff6e4f 100644
--- a/include/godot_cpp/core/Basis.cpp
+++ b/src/core/Basis.cpp
diff --git a/include/godot_cpp/core/Color.cpp b/src/core/Color.cpp
index 985e04e..985e04e 100644
--- a/include/godot_cpp/core/Color.cpp
+++ b/src/core/Color.cpp
diff --git a/include/godot_cpp/core/Dictionary.cpp b/src/core/Dictionary.cpp
index 7ac6312..7ac6312 100644
--- a/include/godot_cpp/core/Dictionary.cpp
+++ b/src/core/Dictionary.cpp
diff --git a/include/godot_cpp/core/Image.cpp b/src/core/Image.cpp
index 4206115..4206115 100644
--- a/include/godot_cpp/core/Image.cpp
+++ b/src/core/Image.cpp
diff --git a/include/godot_cpp/core/InputEvent.cpp b/src/core/InputEvent.cpp
index b0080c4..b0080c4 100644
--- a/include/godot_cpp/core/InputEvent.cpp
+++ b/src/core/InputEvent.cpp
diff --git a/include/godot_cpp/core/NodePath.cpp b/src/core/NodePath.cpp
index e5e784b..e5e784b 100644
--- a/include/godot_cpp/core/NodePath.cpp
+++ b/src/core/NodePath.cpp
diff --git a/include/godot_cpp/core/Plane.cpp b/src/core/Plane.cpp
index 40e0ef6..40e0ef6 100644
--- a/include/godot_cpp/core/Plane.cpp
+++ b/src/core/Plane.cpp
diff --git a/include/godot_cpp/core/PoolArrays.cpp b/src/core/PoolArrays.cpp
index 27c4a58..27c4a58 100644
--- a/include/godot_cpp/core/PoolArrays.cpp
+++ b/src/core/PoolArrays.cpp
diff --git a/include/godot_cpp/core/Quat.cpp b/src/core/Quat.cpp
index 866de2b..866de2b 100644
--- a/include/godot_cpp/core/Quat.cpp
+++ b/src/core/Quat.cpp
diff --git a/include/godot_cpp/core/RID.cpp b/src/core/RID.cpp
index 2343475..2343475 100644
--- a/include/godot_cpp/core/RID.cpp
+++ b/src/core/RID.cpp
diff --git a/include/godot_cpp/core/Rect2.cpp b/src/core/Rect2.cpp
index 6d13cff..6d13cff 100644
--- a/include/godot_cpp/core/Rect2.cpp
+++ b/src/core/Rect2.cpp
diff --git a/include/godot_cpp/core/Rect3.cpp b/src/core/Rect3.cpp
index be3cf8f..be3cf8f 100644
--- a/include/godot_cpp/core/Rect3.cpp
+++ b/src/core/Rect3.cpp
diff --git a/include/godot_cpp/core/String.cpp b/src/core/String.cpp
index da0ca9e..da0ca9e 100644
--- a/include/godot_cpp/core/String.cpp
+++ b/src/core/String.cpp
diff --git a/include/godot_cpp/core/Transform.cpp b/src/core/Transform.cpp
index b8a05df..b8a05df 100644
--- a/include/godot_cpp/core/Transform.cpp
+++ b/src/core/Transform.cpp
diff --git a/include/godot_cpp/core/Transform2D.cpp b/src/core/Transform2D.cpp
index 1f4b5ca..1f4b5ca 100644
--- a/include/godot_cpp/core/Transform2D.cpp
+++ b/src/core/Transform2D.cpp
diff --git a/include/godot_cpp/core/Variant.cpp b/src/core/Variant.cpp
index 6442bc2..6442bc2 100644
--- a/include/godot_cpp/core/Variant.cpp
+++ b/src/core/Variant.cpp
diff --git a/include/godot_cpp/core/Vector2.cpp b/src/core/Vector2.cpp
index d17f828..d17f828 100644
--- a/include/godot_cpp/core/Vector2.cpp
+++ b/src/core/Vector2.cpp
diff --git a/include/godot_cpp/core/Vector3.cpp b/src/core/Vector3.cpp
index b73362d..b73362d 100644
--- a/include/godot_cpp/core/Vector3.cpp
+++ b/src/core/Vector3.cpp