Message 1 of 10
SDK - optional argument
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Ii want to expose a function with optional argument:
#include <maxscript/maxscript.h>
#include <maxscript/maxwrapper/mxsobjects.h>
#include <maxscript/macros/define_instantiation_functions.h>
// ==================================================
#undef def_name
#define def_name(name) Value* n_##name;
// ==================================================
def_name(option)
// ==================================================
def_visible_primitive(TestFunction, "TestFunction");
Value* TestFunction_cf(Value **arg_list, int count)
{
// TestFunction <argA> <argB> [option:false]
Value* tmp;
int option = int_key_arg(option, tmp, 777);
mprintf(L"%i\n", option);
return &ok;
}TestFunction option:55 -- any input will return 777
But it always return default value which means the option is &unsupplied.