-
Notifications
You must be signed in to change notification settings - Fork 0
Custom Parameter
Michael Wolf edited this page Nov 15, 2017
·
5 revisions
Have a look at Number.h in the SDK for a simple example.
You'll also want to use a unique ID string to identify the new parameter type, then use that with LINKID_DataType
when calling AddInput()
& AddOutput()
. Inputs can only be connected to an Output of the same DataType, and you can pass your parameters over those connections like any other parameter.
Use the DataType ID in your Parameter's FuRegisterClass call:
FuRegisterClass("MyDataType", CT_Parameter)
TAG_DONE);
If you need to store your custom data in a comp, you can optionally override Save()
to store it in the ScriptVal
table passed to you, and load it from the constructor.
#define CLSID_DataType_MyType "company.MyType"
class MyTypeParameter: public Parameter
{
FuDeclareClass(MyTypeParameter, Parameter); // declare ClassID static member, etc.
public:
void *Value; // whatever the parameter will store
MyTypeParameter(const Registry *reg, const ScriptVal &table, const TagList &tags)
: Parameter(reg, table, tags)
{
// add your own code here
}
MyTypeParameter(MyTypeParameter ¶m);
MyTypeParameter(void *value, bool copy = TRUE);
virtual ~MyTypeParameter();
virtual Parameter *Copy();
};
Then you need to register it
FuRegisterClass(CLSID_DataType_MyType, CT_Parameter)
TAG_DONE);
And now you can create tools with its primary/main input (and/or output) set to
LINKID_DataType, CLSID_DataType_MyType
Code snippets for the BM Fusion SDK