0 votes

This is my function in my C++ Godot module:

using siz = std::size_t;
bool WallyController::w_init(String path, siz wcnoL, siz wcnoR, bool median = false, bool sgbm = false, siz boardw = 1920, siz boardh = 1080, bool rightcam = false, siz camw = 640, siz camh = 480, siz workw = 640, siz workh = 480);

This is my WallyController::bindmethods():

ClassDB::bind_method(D_METHOD("checkInit"), &WallyController::w_checkInit);
ClassDB::bind_method(D_METHOD("tick"), &WallyController::w_tick);
ClassDB::bind_method(D_METHOD("takeKeypoints", "raw"), &WallyController::w_takeKeypoints, DEFVAL(false));
ClassDB::bind_method(D_METHOD("takeMedian"), &WallyController::w_takeMedian);

ClassDB::bind_method(D_METHOD("init", "path", "wcnoL", "wcnoR", 
    "median", "sgbm", "boardw", "boardh", "rightcam", "camw", "camh", 
    "workw", "workh"), &WallyController::w_init, DEFVAL(480), DEFVAL(640), DEFVAL(false), 
    DEFVAL(480), DEFVAL(640), DEFVAL(1080), DEFVAL(1920));

There are less DEFVALs than C++ default values only because it allows for 8 only. Is there an upper limit of arguments too? Debugger allows for the code, but then I get a build error:

./core/class_db.h: In instantiation of 'static MethodBind* ClassDB::bind_method(N, M) [with N = MethodDefinition; M = bool (WallyController::*)(String, long unsigned int, long unsigned int, bool, bool, long unsigned int, long unsigned int, bool, long unsigned int, long unsigned int, long unsigned int, long unsigned int)]':
/home/sms/Code/WallieController/godot_modules/wallycontroller/wallycontroller.cpp:123:25:   required from here
./core/class_db.h:225:54: error: no matching function for call to 'create_method_bind(bool (WallyController::*&)(String, long unsigned int, long unsigned int, bool, bool, long unsigned int, long unsigned int, bool, long unsigned int, long unsigned int, long unsigned int, long unsigned int))'
  225 |                 MethodBind *bind = create_method_bind(p_method);

I've tried w/o DEFVALs at all, but it's the same error. It's always the "init" method, other functions are working.

Godot version 3.x
in Engine by (21 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.