Skip to content

Commit

Permalink
Updates to callables after merge of godotengine/godot#79005
Browse files Browse the repository at this point in the history
  • Loading branch information
maiself committed Sep 20, 2023
1 parent 71c7f4e commit 642c87d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
6 changes: 0 additions & 6 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@ This project can be thought as having three layers:

## Building

> **Note**
>
> This extension depends on the following currently unmerged pull request to Godot:
>
> - [Allow CallableCustom objects to be created from GDExtensions (extended) godotengine/godot#79005](https://github.com/godotengine/godot/pull/79005)
To clone and initialize the repository:
```sh
git clone https://github.com/maiself/godot-python-extension.git
Expand Down
5 changes: 4 additions & 1 deletion src/variant/callable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ void func_to_callable(GDExtensionUninitializedTypePtr ptr, py::function func) {
static GDExtensionObjectPtr object = nullptr; // XXX

if(!object) {
object = extension_interface::classdb_construct_object(StringName("Object")); // XXX: godot is currently requiring an object for callables
// XXX: godot is currently requiring an object for callables
// see: https://github.com/godotengine/godot/issues/81887
object = extension_interface::classdb_construct_object(StringName("Object"));

register_cleanup_func([]() {
extension_interface::object_destroy(object);
Expand All @@ -18,6 +20,7 @@ void func_to_callable(GDExtensionUninitializedTypePtr ptr, py::function func) {

GDExtensionCallableCustomInfo info = {
.callable_userdata = func.ptr(),
.token = extension_interface::token,
.object = object, // XXX

.call_func = [](void* userdata, const GDExtensionConstVariantPtr* args,
Expand Down

0 comments on commit 642c87d

Please sign in to comment.