diff --git a/README.md b/README.md index 1ac3c39..5d974de 100644 --- a/README.md +++ b/README.md @@ -2,17 +2,12 @@ GDExtension template that automatically builds into a self-contained addon for the Godot Asset Library. - - -# Compatibility warning: - -This template is only intended to work with the latest `master` on GitHub, _not the latest point release, such as `beta1`_. Before reporting an issue, make sure you are on the latest `master` and the submodule `godot-cpp` is up-to-date by running the command `git submodule update --remote`. - ### Getting started: 1. Clone this repository (or a new repository with this template) with submodules. - `git clone --recurse-submodules https://github.com/nathanfranke/gdextension.git` \ - `cd gdextension` +2. Update to the latest `godot-cpp`. + - `git submodule update --remote` 2. Build a debug binary for the current platform. - `scons` 3. Import, edit, and play `project/` using Godot Engine 4+. @@ -37,11 +32,11 @@ This template is only intended to work with the latest `master` on GitHub, _not ¹ Before distributing as an addon, all binaries for all platforms must be built and copied to the `bin/` directory. This is done automatically by GitHub Actions. ### Make it your own: -1. Rename `project/addons/example/` and `project/addons/example/example.gdextension`. The library name is automatically changed to the gdextension file name. +1. Rename `project/addons/example/` and `project/addons/example/example.gdextension`. 2. Replace `LICENSE`, `README.md`, and your code in `src/`. 3. Not required, but consider leaving a note about this template if you found it helpful! -### Distributing your extension on the Godot Asset Library: +### Distributing your extension on the Godot Asset Library with GitHub Actions: 1. Go to Repository→Actions and download the latest artifact. 2. Test the artifact by extracting the addon into a project. 3. Create a new release on GitHub, uploading the artifact as an asset. diff --git a/godot-cpp b/godot-cpp index adf4802..9d1c396 160000 --- a/godot-cpp +++ b/godot-cpp @@ -1 +1 @@ -Subproject commit adf4802f4bd7fb7cafc1e94882df3f105d7f7afd +Subproject commit 9d1c396c54fc3bdfcc7da4f3abcb52b14f6cce8f diff --git a/project/.gitattributes b/project/.gitattributes index 8a45b9c..1fc59eb 100644 --- a/project/.gitattributes +++ b/project/.gitattributes @@ -1,4 +1,4 @@ -# Ignore everything outside of the addons folder when exporting. +# Ignore everything outside of the addons folder when exporting, including Godot Asset Library. /** export-ignore /addons !export-ignore /addons/** !export-ignore diff --git a/project/demo/demo.tscn b/project/demo/demo.tscn deleted file mode 100644 index 544ac60..0000000 --- a/project/demo/demo.tscn +++ /dev/null @@ -1,8 +0,0 @@ -[gd_scene load_steps=2 format=3 uid="uid://p4prpbgep4um"] - -[ext_resource type="Script" path="res://demo/demo.gd" id="1_6gvlp"] - -[node name="Demo" type="Node"] -script = ExtResource("1_6gvlp") - -[node name="MyNode" type="MyNode" parent="."] diff --git a/project/demo/demo.gd b/project/demo/scene.gd similarity index 100% rename from project/demo/demo.gd rename to project/demo/scene.gd diff --git a/project/demo/scene.tscn b/project/demo/scene.tscn new file mode 100644 index 0000000..e5622f0 --- /dev/null +++ b/project/demo/scene.tscn @@ -0,0 +1,8 @@ +[gd_scene load_steps=2 format=3 uid="uid://c7u64tpv6byvb"] + +[ext_resource type="Script" path="res://demo/scene.gd" id="1_lih0m"] + +[node name="Scene" type="Node"] +script = ExtResource("1_lih0m") + +[node name="MyNode" type="MyNode" parent="."] diff --git a/project/project.godot b/project/project.godot index d985627..bdd0603 100644 --- a/project/project.godot +++ b/project/project.godot @@ -10,6 +10,6 @@ config_version=5 [application] -config/name="example" -run/main_scene="res://demo/demo.tscn" -config/features=PackedStringArray("4.0") +config/name="project" +run/main_scene="res://demo/scene.tscn" +config/features=PackedStringArray("4.0", "Forward Plus") diff --git a/src/my_node.cpp b/src/my_node.cpp index 58a9656..ce88dd7 100644 --- a/src/my_node.cpp +++ b/src/my_node.cpp @@ -7,7 +7,7 @@ using namespace godot; void MyNode::_bind_methods() { - ClassDB::bind_method("hello_node", &MyNode::hello_node); + ClassDB::bind_method(D_METHOD("hello_node"), &MyNode::hello_node); } MyNode::MyNode() diff --git a/src/my_singleton.cpp b/src/my_singleton.cpp index b64a7ab..1760461 100644 --- a/src/my_singleton.cpp +++ b/src/my_singleton.cpp @@ -9,7 +9,7 @@ MySingleton *MySingleton::singleton = nullptr; void MySingleton::_bind_methods() { - ClassDB::bind_method("hello_singleton", &MySingleton::hello_singleton); + ClassDB::bind_method(D_METHOD("hello_singleton"), &MySingleton::hello_singleton); } MySingleton *MySingleton::get_singleton() diff --git a/src/register_types.cpp b/src/register_types.cpp index 3eaa8d3..65d60a2 100644 --- a/src/register_types.cpp +++ b/src/register_types.cpp @@ -1,7 +1,6 @@ #include "register_types.h" -#include - +#include #include #include #include @@ -37,7 +36,7 @@ void gdextension_terminate(ModuleInitializationLevel p_level) extern "C" { - GDNativeBool GDN_EXPORT gdextension_init(const GDNativeInterface *p_interface, const GDNativeExtensionClassLibraryPtr p_library, GDNativeInitialization *r_initialization) + GDExtensionBool GDE_EXPORT gdextension_init(const GDExtensionInterface *p_interface, GDExtensionClassLibraryPtr p_library, GDExtensionInitialization *r_initialization) { godot::GDExtensionBinding::InitObject init_obj(p_interface, p_library, r_initialization);