How should I go about doing this? I've set the flags for the popup param to PF_ParamFlag_SUPERVISE like so
def.flags = PF_ParamFlag_SUPERVISE;
"Option 1|Option 2|...",
And I'm capturing the PF_Cmd_USER_CHANGED_PARAM command like so
ERR(UserChangedParam(in_data, out_data, params, output, reinterpret_cast<PF_UserChangedParamExtra *>(extra));
static PF_Err UserChangedParam(
PF_Err err = PF_Err_NONE;
if (extra->param_index == POPUP_MODE_ID)
if (params[POPUP_MODE_ID]->u.cd.value == 2)
//Code to enable and show the controls
//Cose to disable or hide the controls
Am I doing everything right so far? What code do I need to put in the "if (params[POPUP_MODE_ID]->u.cd.value == 2)" block to disable a parameter? How different would the code be to hide the parameter completely? Can I hid entire topics like I can hide parameters? I'd have a use for all three things, I just can't figure out how to do them.
so far so good. :-)
take a look at the "supervisor" sample project.
it shows the code to hide/shows params.
as for hiding topics, you need to hide both the topic param, and all the params in it.
if you hide only the topic, the params might still show up under certain circumstances. (such as the user pressing 'U' when a hidden param has keyframes)
you don't need to hide/show the "topic end" param. just leave that one be.
I took a look at the Supervisor sample project. I've managed to figure out how to disable controls, which I've done like so:
params[CONTROL_ID]->ui_flags |= PF_PUI_DISABLED;
params[CONTROL_ID]->flags |= PF_ParamFlag_COLLAPSE_TWIRLY;
Enabling should be something this instead:
params[CONTROL_ID]->ui_flags &= ~PF_PUI_DISABLED;
What I can't figure out, still, is how to hide a control. I've tried to set the PF_PUI_INVISIBLE flag but that did not seem to change anything. It looks like the Supervisor plugin is setting the exact same flag to hide controls but it must have something else that I'm missing.
taken from the supervisor sample:
ERR(suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(globP->my_id, in_data->effect_ref, &meH));
ERR(suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(globP->my_id, meH, SUPER_FLAVOR, &flavor_streamH));
// Toggle visibility of parameters
ERR(suites.DynamicStreamSuite2()->AEGP_SetDynamicStreamFlag(flavor_streamH, AEGP_DynStreamFlag_HIDDEN, FALSE, hide_themB));
I suppose I should have mentioned that I tried that code but it caused After Effects to crash. This is what I'm doing. I thought at first that it might have been because I forgot to dispose of the stream, but after fixing that it was still crashing. I'm at a loss for figuring out how to solve this.
AEGP_StreamRefH streamH = NULL;
AEGP_EffectRefH meH = NULL;
my_global_dataP globP = reinterpret_cast<my_global_dataP>(DH(out_data->global_data));
ERR(suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(globP->my_i d, in_data->effect_ref, &meH));
ERR(suites.StreamSuite2()->AEGP_GetNewEffectStreamByIndex(globP->my_id , meH, CONTROL_ID, &streamH));
ERR(suites.DynamicStreamSuite2()->AEGP_SetDynamicStreamFlag(streamH, AEGP_DynStreamFlag_HIDDEN, FALSE, TRUE));
if (meH) ERR(suites.EffectSuite2()->AEGP_DisposeEffect(meH));
if (streamH) ERR(suites.StreamSuite2()->AEGP_DisposeStream(streamH));
all seems ok...
a couple of things:
1. use a NULL instead of globP->my_id
2. who owns &meH? how was it created?
3. do previous calls to suites in the same scope work? (i.e. is it this specific line, or is it simply the first to be called)
Using NULL instead of globP->my_id fixed it. My parameters have vanished now, as desired :-)
meH was created as shown in reply 4 and the line that crashed was the first call to a suite in the scope.
Can you shed some insight into why it wasn't working with globP->my_id and worked with NULL instead? I'm unsure what the Supervisor plugin was doing different that allowed it to work.
Thank you for the help.
well, if i'm not mistaking, my_id is not a parameter passed by AE to you.
the global data is a structure you create according to your plug-in's needs.
so most probably, you have it just because it was there in a sample project you're based on. (my apologies if otherwise...)
if memory serves, my_id is usually populated by the call to registerWithAegp() (or something similar, usually in the global_setup() function).
historically, the AEGP suites were used exclusively by AEGPs and not effects.
so to use the suites, an effect had to register as an aegp, and get it's id.
some suites do require the use of an ID, but most suffice with a NULL.
so why the crash?
if my_id is just a variable in the global data structure, and it was never assigned a value via the registry operation, then you're telling AE to go look for you at some random - non existing place.
crash, burn, screams, horror.
all that is true only if you indeed did not register with AEGP and gotten your id properly...
This worked great, thanks all-above!
Had to drag out the stream suite... but ok, it worked to hide & show a parameter.
Now my related question is:
Is it possible to *rename* a parameter on the fly? I tried SetStreamName, but saw no effect.
Thanks! AEGP_SetStreamName() worked. But also, this variation worked, too:
PF_ParamDef p = *c->params[paramID]; // my id-to-index param ptr map
int index = c->global->paramIdToIndex[paramID]; // another thing'o'mine
Any reason to prefer one to the other?
first of all, i was not aware of the method you suggested, so thanks for
as for the differences...
the SetStreamName thingie can be called at any time, including to and by
you can change the name of any stream you can get your hands on, and not
only for self.
i have no idea if the same applies to your method. (though intuitively i'd
think it doesn't)
there also has to be some difference in performance times.
i would imagine that difference being neglegible, though in large number it
might be noticeable. (in my plug-in i change hundreds of param names at a