Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | capt_sms |
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::_bind_methods():
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.