Commit Graph

704 Commits (7adc5360d79d06f296347e2247a115f60bc7ece4)

Author SHA1 Message Date
Bastiaan Olij d5e0fc8e7c Temporary fix for issue in JSON export with NIL in operators 2021-09-27 23:08:12 +10:00
Bastiaan Olij 92d25bcda6 Update readme to include new info 2021-09-27 23:08:12 +10:00
Bastiaan Olij 68ebc9b2a8 Changed over to proper godot-headers 2021-09-27 23:08:12 +10:00
Bastiaan Olij cbf52c2764 Removed init.cpp that I overlooked in rebase 2021-09-27 23:08:12 +10:00
Bastiaan Olij 0e3bc393d5 Fully register class on register_class call 2021-09-27 23:08:12 +10:00
Bastiaan Olij fad6329699 Implement Ref copy constructor 2021-09-27 23:08:12 +10:00
Fabio Alessandrelli ea7324afe8 Fix encoding/decoding of null objects. 2021-09-27 23:08:12 +10:00
Fabio Alessandrelli 59d38a4119 Add test for extended object creation/deletion. 2021-09-27 23:08:12 +10:00
Fabio Alessandrelli 42dd64f22f Fix binding of function that takes Object * parameters. 2021-09-27 23:08:11 +10:00
Fabio Alessandrelli b4632e317d Fix creation (and godot-side deletion) of extended objects.
Proper initialization for godot-cpp classes with memnew.

Extension classes (i.e. the `GDCLASS` macro) behave differently from
regular wrapped classes, and requires Godot to initialize them during
object construction.

This commit update the GDCLASS macro to not create/destroy the instance
during the bindings callback, but during the extension callbacks.

When setting the object instance, the bindings instance is set to the
pointer of the extension instance so that it can later be retrieved
normally via `object_get_instance_bindings`.
2021-09-27 23:08:11 +10:00
Fabio Alessandrelli cc88df05e7 Fix PtrToArg encoding for `Object *`.
It didn't set the return value at all, changing the local value instead.
Now instead correctly sets it as a generic pointer type from `_owner`.
2021-09-27 23:08:11 +10:00
Hennadii Chernyshchyk 2b1100c878 Use default initialization
{ 0 } initializes only first element with zero explicitly and other
elements with their default value (zeros too). Technically it will work
the same, but will be more correct.
2021-09-27 23:08:11 +10:00
Bastiaan Olij 7a2a7ea9e4 Add virtual destructor to Object class 2021-09-27 23:08:11 +10:00
Bastiaan Olij b21069c573 _err_print_error only output p_message so swapped parameters around 2021-09-27 23:08:11 +10:00
Bastiaan Olij fab017c91a Fix some clang format things 2021-09-27 23:08:11 +10:00
George Marques 38ee8bfcf7 Change constructor/destructor management of extension classes
This makes sure custom constructors are always called on extension
classes. However, note that constructors should not take any parameters,
since Godot doesn't support that. Parameters are ignore in memnew macro.

Use memnew(MyClass()) instead of memnew(MyClass) since it now needs a
value instead of a class name. This macro calls MyClass::_new() (define
in GDCLASS macro) which ultimately calls Godot to create the object,
ensuring that both the Godot and the extension instances are created.

Non Godot classes (that don't derive godot::Object) are constructed as
usual an can have parameters.

memdelete is also changed for the same reason, as it needs to destroy
the Godot object as well, and that automatically frees the bound
extension instance.
2021-09-27 23:08:11 +10:00
Bastiaan Olij e839199848 Add support for property groups 2021-09-27 23:08:11 +10:00
Bastiaan Olij 02802b1d0e Add in driver types and rejig code to make it easier to extend 2021-09-27 23:08:11 +10:00
George Marques aef0f1e248 Change initialization to allow custom level callbacks
Now it needs a callback for each level so custom logic (like loading
singletons) can be performed.
2021-09-27 23:08:10 +10:00
George Marques dfa526ce16 Fix formatting of files 2021-09-27 23:08:10 +10:00
George Marques f5858ef6c6 Fix calling of native functions that return object types 2021-09-27 23:08:10 +10:00
Bastiaan Olij 46c63af715 Re-introduce build-in type code for core types 2021-09-27 23:08:10 +10:00
Bastiaan Olij 3a5bd21092 Always convert float to double 2021-09-27 23:08:10 +10:00
Hennadii Chernyshchyk 50774cf0fb Add alias 2021-09-27 23:08:10 +10:00
Hennadii Chernyshchyk f24dcf4ff9 Specify project languages 2021-09-27 23:08:10 +10:00
Hennadii Chernyshchyk 3b40a38c66 Remove Generating Bindings message
Bindings are generated using `generate_bindings` and the command contains the `COMMENT` parameter, which will display a message about the generation.
2021-09-27 23:08:10 +10:00
George Marques 8eb6f129f8 Set initialization level to CORE
This should eventually be configurable with user callbacks, but for now
assume the lowest level to ensure the initialization is called.
2021-09-27 23:08:10 +10:00
Hennadii Chernyshchyk e8030ed1cf Fix print file list 2021-09-27 23:08:10 +10:00
Hennadii Chernyshchyk b7f03837a2 Fix return type check for variadic functions 2021-09-27 23:08:09 +10:00
Hennadii Chernyshchyk 6daaeb6dba Do not override build path 2021-09-27 23:08:09 +10:00
Hennadii Chernyshchyk a904518075 Fix OUTPUT for add_custom_command 2021-09-27 23:08:09 +10:00
Bastiaan Olij b07559882c Silence delete compile warning in memory.h/cpp on Windows 2021-09-27 23:08:09 +10:00
Bastiaan Olij dd72ce151a Remove unused import that breaks on windows 2021-09-27 23:08:09 +10:00
George Marques 9d4e51011a Properly encode numeric POD types 2021-09-27 23:08:09 +10:00
George Marques f19bb9f57c Add copy/move constructors and assignment op to builtin types 2021-09-27 23:08:09 +10:00
George Marques 3a9ff8de7a Add support for engine singletons
Use, e.g. Engine::get_singleton() to get the singleton object();
2021-09-27 23:08:09 +10:00
George Marques feafe0da36 Fix build with native structs 2021-09-27 23:08:09 +10:00
Bastiaan Olij df9164b9bd Added TYPED_METHOD_BIND and c++17 flags to windows build and moved test project files 2021-09-27 23:08:09 +10:00
George Marques f3dea4b752 Add readme file (stub) 2021-09-27 23:08:08 +10:00
George Marques 5615c92173 Define the {de,}initialization functions in the bindings
The extension creators then don't need to create those just to redirect
to the bindings.
2021-09-27 23:08:08 +10:00
George Marques a0634cca3f Auto-bind virtual method overrides 2021-09-27 23:08:08 +10:00
George Marques b3a4a2cf93 Add sample test project 2021-09-27 23:08:08 +10:00
George Marques 8bcf32a619 Fix issues with method calls 2021-09-27 23:08:08 +10:00
George Marques e4ed48976a Replace bindgins to work with extensions 2021-09-27 23:08:08 +10:00
Rémi Verschelde ee70866894
Merge pull request #622 from akien-mga/ci-disable-tests-4.0 2021-09-27 14:43:28 +02:00
Rémi Verschelde bd82460780
CI: Disable test build to prepare for 4.0 extensions merge
It can't pass and fixing it in the heavily WIP extensions implementation
would be a hassle, it's better to readd tests once things are working.
2021-09-27 14:37:36 +02:00
Rémi Verschelde bfdf55afd9
Merge pull request #620 from akien-mga/bindgen-fix-NodePath-escape 2021-09-27 12:51:07 +02:00
Rémi Verschelde b8658d3733
Merge pull request #619 from BastiaanOlij/update_godot_3_info 2021-09-27 12:43:50 +02:00
Rémi Verschelde 83ef64079b
bindgen: Properly escape NodePath in default args 2021-09-27 12:41:46 +02:00
Bastiaan Olij 74cee6e6b7 Updating readme for new branch info 2021-09-27 20:28:16 +10:00