How to work with multiple arbitrary parameters? (SDK)
Hi gang (Shachar) 😉
Over the last while I have (somewhat) blindly stumbled my way across making my own custom parameter using the Arbitrary parameter, with some additional help.
Now that I've got it working, I wanted to duplicate it to be reused by other custom parameters. However, none of the UI SDK samples show how to use more than one and, since I don't fully understand the system yet, I am stuck. I checked the forum for similar posts and couldn't really find much help either. So I'll ask my questions and hopefully someone can help.
When one creates a custom parameter like below, what else needs to be unique for each custom parameter? Obviously the ID which in this case is CUSTOMUI_DISK_ID. But what about ARB_REFCON? I'm not sure what that is used for - does it also need to be unique for each custom parameter? Finally, what about &def.u.arb_d.dephault? Does that also have to be unique for every arbitrary parameter?
AEFX_CLR_STRUCT(def);
def.flags = PF_ParamFlag_SUPERVISE;
def.ui_flags = PF_PUI_CONTROL;
def.ui_width = UI_BOX_WIDTH;
def.ui_height = UI_BOX_HEIGHT;
ERR(CreateDefaultArb(in_data,
out_data,
&def.u.arb_d.dephault));
PF_ADD_ARBITRARY2("Custom UI",
UI_BOX_WIDTH,
UI_BOX_HEIGHT,
0,
PF_PUI_CONTROL | PF_PUI_DONT_ERASE_CONTROL,
def.u.arb_d.dephault,
CUSTOMUI_DISK_ID,
ARB_REFCON);Secondly, I see that in all the examples, each arbitrary parameter is followed by this code which I don't understand what it's for:
if (!err) {
PF_CustomUIInfo ci;
AEFX_CLR_STRUCT(ci);
ci.events = PF_CustomEFlag_EFFECT;
ci.comp_ui_width = 0;
ci.comp_ui_height = 0;
ci.comp_ui_alignment = PF_UIAlignment_NONE;
ci.layer_ui_width = 0;
ci.layer_ui_height = 0;
ci.layer_ui_alignment = PF_UIAlignment_NONE;
ci.preview_ui_width = 0;
ci.preview_ui_height = 0;
ci.layer_ui_alignment = PF_UIAlignment_NONE;
err = (*(in_data->inter.register_ui))(in_data->effect_ref, &ci);
}If I have multiple arbitrary parameters, do I need multiple of the above following each one? Should these be unique for each unique arb?
In the HandleArbitrary function, it calls the arb handling functions using ARB_REFCON so that leads me to believe each arbitrary parameter must have their own unique ARB_REFCON. If that is the case then I need to call each of my custom parameters in the handler function? Something like this?
switch (extra->which_function) {
case PF_Arbitrary_NEW_FUNC:
if (extra->u.new_func_params.refconPV != ARB_REFCON) {
err = PF_Err_INTERNAL_STRUCT_DAMAGED;
}
else {
err = CreateDefaultArb(in_data,
out_data,
extra->u.new_func_params.arbPH);
}
break;
case PF_Arbitrary_NEW_FUNC:
if (extra->u.new_func_params.refconPV != ARB_REFCONTWO) {
err = PF_Err_INTERNAL_STRUCT_DAMAGED;
}
else {
err = CreateDefaultArb(in_data,
out_data,
extra->u.new_func_params.arbPH);
}
break;
...
Anyway, I have more questions but maybe this is enough for now. Basically, any guidance / tips and tricks on how to set up multiple arbitrary parameters is welcome!
Thanks!
