Notifications
                
            
                Clear all
    
            
        [Closed] SDK Function Publishing with defaults ??
Oct 25, 2016 5:16 pm
                      Hi, I am working on a Object plugin and have got all the function publishing done, but for some odd reason cannot not get optional default values to work.
After looking though the SDK sample I thought it you had to use f_keyArgdefault. Which does seem to allow a default value, but then it doesn’t allow for an opitional value. Does anyone know how to do this ?? Code is below :
//FP Mixin header file
class ISOFP : public FPMixinInterface 
	{
	public:
		//Function Publishing System
		//Function Map For Mixin Interface
		//*************************************************
		BEGIN_FUNCTION_MAP
			VFN_1(sofp_spinner, fnSpinner, TYPE_FLOAT);
			VFN_1(sofp_addnode, fnAddNode, TYPE_INODE);
			VFN_1(sofp_radio, fnRadio, TYPE_INT);
		END_FUNCTION_MAP
		FPInterfaceDesc* GetDesc();    // <-- must implement 
//note functions that start with fn are to be used with maxscript since these expect 1 based indices
		virtual void	fnSpinner(float f = 50.0f)=0;
		virtual void	fnAddNode(INode *node)=0;
		virtual void	fnRadio(int i)=0;
	};
So my default is for the Spinner which is 50.0f.
//Main cpp function
static FPInterfaceDesc sofp_interface(
	SIMPLEOBJFP_INTERFACE, _T("sofpOps"), 0, GetSimpleObjectProjectDesc(), FP_MIXIN,
	sofp_spinner, _T("spinner"), 0, TYPE_VOID, 0, 1,
	_T("float"), 0, TYPE_FLOAT,f_keyArgDefault, 50.0f,
	sofp_addnode, _T("addnode"), 0, TYPE_VOID, 0, 1,
	_T("node"), 0, TYPE_INODE,
	sofp_radio, _T("radio"), 0, TYPE_VOID, 0, 1,
	_T("int"), 0, TYPE_INT,
	p_end
);
void SimpleObjectProject::fnSpinner(float f) {
	pblock2->SetValue(title_spinner, t, f);
}
So here I have used the f_keyArgDefault with a default value next to it.
But as soon as I enter a value into maxscript, it saying its wanted 0 arguments, not 1 ?
Whats going on ?? xD