Skip to main content
Legend
February 4, 2016
Answered

How to disable some params when a checkbox is checked?

  • February 4, 2016
  • 2 replies
  • 1670 views

Hi All,

I'm trying to disable a set of parameters in the effect I'm building when another parameter—a checkbox—is checked.  Then, when the checkbox is unchecked, I'd like those same parameters to be enabled.  Is this possible by using AEGP_SetDynamicStreamFlag and AEGP_GetDynamicStreamFlag?  If so, how would I go about doing that?

Thanks!


—Arie

This topic has been closed for replies.
Correct answer

Okay, I'm now trying to set the disable flag on the params that I want disabled, but I read this in the SDK for AEGP_SetDynamicStreamFlag.  If I cannot set the _DISABLED flag with this method, how do I do it?

—Arie

This call may be used to dynamically show or hide parameters, by setting and clearing AEGP_DynStreamFlag_HIDDEN. However, AEGP_DynStreamFlag_DISABLED may not be set.


I am not sure if that part of the documentation still is true, at least I set it using the stream flags, I think.

But maybe you should then look into the PF_UpdateParamUI(), like in the Supervisor example.

2 replies

Community Expert
February 4, 2016

here are the notes from the source code file:

/* true if you want this to be an undoable change */

/* if false, the only legal flag is AEGP_DynStreamFlag_HIDDEN */

so unless you want the operation to enter the undo list, you'll have

to use PF_UpdateParamUI

instead.

i remember i ended up resorting to PF_UpdateParamUI for that. i don't

recall if it was because i didn't want the undo thingie, or it failed for

some other reason.

Legend
February 4, 2016

Shachar and Toby,

Many thanks for your guidance.  I know how to get a reference to the instance of the effect as such (as in the PF_Cmd_UpdateParametersUI call):

suites.StreamSuite4()->AEGP_GetNewEffectStreamByIndex(NULL, effectH, MY_CHECKBOX_PARAM, &streamRefH);


But how do I get the value (state) of the checkbox itself so I can store?  I see that in the Supervise example it does something like:


if (params[SUPER_MODE]->u.pd.value == HARD){

  seqP->hard_modeB = TRUE;

  } else {

  seqP->hard_modeB = FALSE;

  hide_themB = TRUE;

  }


I imagine that u.pd.value is where the code is grabbing the state of the param.  What is u.pd.value?


—Arie

Community Expert
February 4, 2016

AEGP_GetNewStreamValue()

February 4, 2016

Yes, that can easily be done.

Check out the Examples\UI\Supervisor project from the SDK for something similar to what you want to do.

Don't forget to set the Supervise flag on the checkbox parameter, then set the disabled/hidden flags of the other parameters using the stream functions you mentioned.