diff options
author | Marc Gilleron <marc.gilleron@gmail.com> | 2020-09-12 17:38:46 +0100 |
---|---|---|
committer | Marc Gilleron <marc.gilleron@gmail.com> | 2020-09-12 17:38:46 +0100 |
commit | 67976ee47d1067c67c848b2968c9b9f21dc4c5f1 (patch) | |
tree | e9f35e7c49550a15442f348aabff26103bc2cf5a /binding_generator.py | |
parent | c9a740be34438ce999402b7b76304a38daaaa811 (diff) | |
download | redot-cpp-67976ee47d1067c67c848b2968c9b9f21dc4c5f1.tar.gz |
Remove the need to use GODOT_SUBCLASS
Diffstat (limited to 'binding_generator.py')
-rw-r--r-- | binding_generator.py | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/binding_generator.py b/binding_generator.py index 991e25b..410f8ff 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -178,8 +178,11 @@ def generate_class_header(used_classes, c, use_template_get_node): # godot::api->godot_global_get_singleton((char *) \"" + strip_name(c["name"]) + "\");" - # ___get_class_name + # class name: + # Two versions needed needed because when the user implements a custom class, + # we want to override `___get_class_name` while `___get_godot_class_name` can keep returning the base name source.append("\tstatic inline const char *___get_class_name() { return (const char *) \"" + strip_name(c["name"]) + "\"; }") + source.append("\tstatic inline const char *___get_godot_class_name() { return (const char *) \"" + strip_name(c["name"]) + "\"; }") source.append("\tstatic inline Object *___get_from_variant(Variant a) { godot_object *o = (godot_object*) a; return (o) ? (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, o) : nullptr; }") @@ -443,7 +446,7 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node if is_enum(method["return_type"]): return_statement += "return (" + remove_enum_prefix(method["return_type"]) + ") " elif return_type_is_ref: - return_statement += "return Ref<" + strip_name(method["return_type"]) + ">::__internal_constructor("; + return_statement += "return Ref<" + strip_name(method["return_type"]) + ">::__internal_constructor(" else: return_statement += "return " + ("(" + strip_name(method["return_type"]) + " *) " if is_class_type(method["return_type"]) else "") else: @@ -716,8 +719,6 @@ def generate_init_method_bindings(classes): source.append("{") for c in classes: - class_name = strip_name(c["name"]) - source.append("\t" + strip_name(c["name"]) + "::___init_method_bindings();") source.append("}") |