Copy link to clipboard
Copied
Dear AE fellows,
I create hidden parameters and want them to be unhidden when the user changes the parameters in the UI.
(Specifically, for reference, I want a N parameters SKELETON_ANGLE to appear when the input text has N letters. The user input text is introduced via the PF_Param_BUTTON with the help of javascript text input window and AEGP_ExecuteScript )
From the supervisor example I deduce that one needs to handle PF_Cmd_UPDATE_PARAMS_UI event.
Now the question.
How to trigger PF_Cmd_UPDATE_PARAMS_UI when the user changes the text input in my plugin?
I store user text input in sequence_data and implement all the functions: sequence_setup, resetup and flatten. Therefore the plugin actually knows that the input changes. And I see with my naked eyes that the plugin prints my input onscreen)
But PF_Cmd_UPDATE_PARAMS_UI is not triggered.
1.
I thought of adding PF_STATE to my sequence_data struct and then added
ERR(suites.ParamUtilsSuite3()->PF_GetCurrentState(in_data->effect_ref,
SKELETON_BUTTON,
NULL,
NULL,
&unflatSequenceDataP->state));
at the end of sequence_data_setup (and resetup)
in hope that the changed state of button parameter will trigger the PF_Cmd_UPDATE_PARAMS_UI event.
But alas, this didn't work.
2. I also tried to add the relevant code into PF_Cmd_USER_CHANGED_PARAM handling, like this:
PF_ParamDef param_copy[17];
ERR(MakeParamCopy(params, param_copy));
if (text_input.length() != 0) {
param_copy[SKELETON_ANGLE].param_type = PF_Param_ANGLE;
param_copy[SKELETON_ANGLE].ui_flags &= ~PF_PUI_INVISIBLE;
ERR(suites.ParamUtilsSuite3()->PF_UpdateParamUI(in_data->effect_ref,
SKELETON_ANGLE, ¶m_copy[SKELETON_ANGLE]));
// Changing visibility of params in AE is handled through stream suites
ERR(suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(globP->my_id, in_data->effect_ref, &meH));
ERR(suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(globP->my_id, meH, SKELETON_ANGLE, &angle_streamH));
// Toggle visibility of parameters
ERR(suites.DynamicStreamSuite2()->AEGP_SetDynamicStreamFlag(angle_streamH, AEGP_DynStreamFlag_HIDDEN, FALSE, hide_themB));
// Change popup menu items
ERR(suites.EffectSuite3()->AEGP_GetEffectParamUnionByIndex(globP->my_id, meH, ANGLE_ID, ¶m_type, ¶m_union));
if (meH) {
ERR(suites.EffectSuite2()->AEGP_DisposeEffect(meH));
}
if (angle_streamH) {
ERR(suites.StreamSuite2()->AEGP_DisposeStream(angle_streamH));
}
}
else {
hide_themB = TRUE;
param_copy[SKELETON_ANGLE].param_type = PF_Param_ANGLE;
param_copy[SKELETON_ANGLE].ui_flags |= PF_PUI_INVISIBLE;
ERR(suites.ParamUtilsSuite3()->PF_UpdateParamUI(in_data->effect_ref,
SKELETON_ANGLE, ¶m_copy[SKELETON_ANGLE]));
// Changing visibility of params in AE is handled through stream suites
ERR(suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(globP->my_id, in_data->effect_ref, &meH));
ERR(suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(globP->my_id, meH, SKELETON_ANGLE, &angle_streamH));
// Toggle visibility of parameters
ERR(suites.DynamicStreamSuite2()->AEGP_SetDynamicStreamFlag(angle_streamH, AEGP_DynStreamFlag_HIDDEN, FALSE, hide_themB));
// Change popup menu items
//ERR(suites.EffectSuite3()->AEGP_GetEffectParamUnionByIndex(globP->my_id, meH, ANGLE_ID, ¶m_type, ¶m_union));
if (meH) {
ERR(suites.EffectSuite2()->AEGP_DisposeEffect(meH));
}
if (angle_streamH) {
ERR(suites.StreamSuite2()->AEGP_DisposeStream(angle_streamH));
}
}
And then I added the additional outfalg PF_OutFlag_REFRESH_UI at the end of my parameter changing function:
out_data->out_flags = out_data->out_flags | PF_OutFlag_FORCE_RERENDER | PF_OutFlag_REFRESH_UI;
It worked (but I suppose this is not the regular way to implement such things).
However I have an unusual behavior. My parameter SKELETON_ANGLE is introduced inside some PARAM_TOPIC in the paramsSetup function with the flag:
def.flags = PF_ParamFlag_START_COLLAPSED;
However, when this parameter becomes unhidden, the whole PARAM_TOPIC is switched into uncollapsed state. How can I force the parameter to become unhidden but to keep it inside collapsed topic?
Yaroslav.
let's go theough the basics first.
did you set PF_OutFlag_SEND_UPDATE_PARAMS_UI on global setup?
did you set PF_ParamFlag_SUPERVISE on the param you wish to supervise?
Copy link to clipboard
Copied
let's go theough the basics first.
did you set PF_OutFlag_SEND_UPDATE_PARAMS_UI on global setup?
did you set PF_ParamFlag_SUPERVISE on the param you wish to supervise?
Copy link to clipboard
Copied
Genius lives in simple things.
Thanks, Shachar!
I added PF_OutFlag_SEND_UPDATE_PARAMS_UI and all things started to work like a charm!