My gdnative script is not doing anything when attached to a Path2D node.

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Ryan Peach

So I’m writing my first GDNative module and have created a single Path2D class. It has several parameters and methods I have exposed:

void OrbitPath2D::_register_methods() {
    register_method("_draw", &OrbitPath2D::_draw);
    register_method("_init", &OrbitPath2D::_init);
    register_property<OrbitPath2D, float>("semi_major_axis", &OrbitPath2D::set_semi_major_axis, &OrbitPath2D::get_semi_major_axis, 10.0);
    register_property<OrbitPath2D, float>("eccentricity", &OrbitPath2D::set_eccentricity, &OrbitPath2D::get_eccentricity, 0.0);
    register_property<OrbitPath2D, float>("argument_of_periapsis", &OrbitPath2D::set_argument_of_periapsis, &OrbitPath2D::get_argument_of_periapsis, 0.0);
    register_property<OrbitPath2D, int>("draw_resolution", &OrbitPath2D::set_draw_resolution, &OrbitPath2D::get_draw_resolution, 100);
    register_property<OrbitPath2D, Color>("draw_color", &OrbitPath2D::set_draw_color, &OrbitPath2D::get_draw_color, godot::Color(0,0,0));
}

But when I attach it to a node, I don’t see any exported parameters.

Please see:

src/OrbitalPath2D.hpp
src/gdlibrary.cpp
demo/bin/Orbit2D.gdnlib
demo/bin/OrbitPath2D.gdns

Code Location:

Note I’m working in Godot 4.0 as a contributor on a custom branch. Nothing too drastic.

Output when working in project:

Godot Engine v4.0.dev.custom_build.f4d24d3e8 - https://godotengine.org

Registered camera USB Camera with id 1 position 0 at index 0
Registered camera FaceTime HD Camera (Built-in) with id 2 position 0 at index 1
Editing project: /Users/ryapeach/Documents/GameDev/Orbits2D/demo (::Users::ryapeach::Documents::GameDev::Orbits2D::demo)
arguments
0: /Users/ryapeach/Documents/GameDev/godot/bin/godot.osx.tools.64
1: --path
2: /Users/ryapeach/Documents/GameDev/Orbits2D/demo
3: --editor
Current path: /Users/ryapeach/Documents/GameDev/Orbits2D
Godot Engine v4.0.dev.custom_build.f4d24d3e8 - https://godotengine.org
ERROR: 1 shaders of type VolumetricFogShaderRD were never freed
   at: ~ShaderRD (servers/rendering/rasterizer_rd/shader_rd.cpp:470)
ERROR: Some texture bindings were not properly freed (leaked CanvasItems?)
   at: ~RasterizerCanvasRD (servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp:2500)
 (anaconda3)  ryapeach@C02D574YMD6R  ~/Documents/GameDev/Orbits2D   main                                      ✔  1005  00:30:12
Registered camera USB Camera with id 1 position 0 at index 0
Registered camera FaceTime HD Camera (Built-in) with id 2 position 0 at index 1
ERROR:  does not have a library for the current platform.
   at: init_library (modules/gdnative/nativescript/nativescript.cpp:1680)
ERROR: Condition "!script_data" is true.
   at: _update_placeholder (modules/gdnative/nativescript/nativescript.cpp:94)
ERROR:  does not have a library for the current platform.
   at: init_library (modules/gdnative/nativescript/nativescript.cpp:1680)
ERROR: 1 shaders of type VolumetricFogShaderRD were never freed
   at: ~ShaderRD (servers/rendering/rasterizer_rd/shader_rd.cpp:470)
ERROR: Some texture bindings were not properly freed (leaked CanvasItems?)
   at: ~RasterizerCanvasRD (servers/rendering/rasterizer_rd/rasterizer_canvas_rd.cpp:2500)
:bust_in_silhouette: Reply From: Akien

Your .gdns has an entry for X11.64: https://github.com/ryanpeach/GodotOrbit2D/blob/main/demo/bin/Orbit2D.gdnlib

But you’re using the master branch, in which the Linux platform is now named LinuxBSD, so it should likely be LinuxBSD.64.

Edit: As pointed out by bruvzg, you’re running macOS, but it’s the same problem there: it’s OSX in 3.2, but renamed to macOS in master.

Note that the master branch is under heavy refactoring, and there’s definitely no guarantee that GDNative would work (in particular, the godot-cpp bindings are likely not in sync with the current API either).

I’d suggest using the 3.2 to get familiar with GDNative first, before digging into GDNative development for master.

Judging by the log it’s actually on macOS, but issue is the same OSX was renamed to macOS.

bruvzg | 2020-10-15 06:33