Hi,
I try to create a simple function and expose it to GDscript, the function should take a Node as the parameter.
this is the function declaration:
void my_func(Node* node);
and this is the function binding:
ClassDB::bind_method(D_METHOD("my_func", "node"), &MyClass::my_func);

but when I compile I got a lot of errors like:

godot-cpp\include\godot_cpp/core/binder_common.hpp(89): error C2440: 'return': impossible to convert from 'const godot::Variant' to 'T'
        with
        [
            T=godot::Node*
        ]

and so on.
Is it possible to do what I'm trying to do?

thanks.

    Sox
    Just search the existing code, for example this can be found in node.cpp:
    ClassDB::bind_method(D_METHOD("set_owner", "owner"), &Node::set_owner);
    and method looks something like this:

    void Node::set_owner(Node *p_owner) {
    ...
    } 

    Sox
    I did exactly the same but I got the error that I displayed in my post. I don't know if I'm missing something or is some kind of bug.

    2 months later

    I have exactly the same question (and the same error). Still (4.09 beta) doesn't work.
    The only workaround I found is to declare parameter as Object* and use cast_to<>(param) in a body of a function. Inconvenient.

    Notably, that binding of arbitrary Node-descendant class parameter in 3.x' GDNative works without a problem.

    • Sox replied to this.

      sash maybe is a bug, I don't know I've never worked with the previous versions.

      • sash replied to this.

        Sox

        To me, this looks like "not yet implemented" feature. AFAIK too few people (if any at the moment) work on it.

        18 days later

        Tested newly released 4.0 beta 11. The issue is fixed. Thanks to Godot team.