Skip navigation
afxjordan
Currently Being Moderated

Disabling and or hiding parameter controls depending on the value of a popup

Jul 20, 2012 3:03 PM

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;

 

PF_ADD_POPUP(

     "Mode",

   6,

   1,

     "Option 1|Option 2|...",

   POPUP_MODE_ID

);

 

And I'm capturing the PF_Cmd_USER_CHANGED_PARAM command like so

 

case PF_Cmd_USER_CHANGED_PARAM:

     ERR(UserChangedParam(in_data, out_data, params, output, reinterpret_cast<PF_UserChangedParamExtra *>(extra));

     break;

 

...

 

static PF_Err UserChangedParam(

    PF_InData* in_data,

    PF_OutData* out_data,

    PF_ParamDef* params[],

    PF_LayerDef* outputP,

    PF_UserChangedParamExtra* extra)

{

    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

        }

        else

        {

             //Cose to disable or hide the controls

        }

    }

 

    return err;

}

 

 

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.

 
Replies
  • Currently Being Moderated
    Jul 21, 2012 7:59 AM   in reply to afxjordan

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 23, 2012 8:18 AM   in reply to afxjordan

    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));


     
    |
    Mark as:
  • Currently Being Moderated
    Jul 23, 2012 9:55 AM   in reply to afxjordan

    the code seems correct.

    i use the same method with no problem.

     

    after what line does the crash occur?

    during what call are you executing these lines?

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 23, 2012 10:35 AM   in reply to afxjordan

    hmmm....

    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)

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 23, 2012 12:31 PM   in reply to afxjordan

    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...

    :-)

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2012 10:38 PM   in reply to shachar carmi

    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.

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 13, 2012 11:28 PM   in reply to david van brink

    AEGP_SetStreamName()

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 14, 2012 8:01 AM   in reply to shachar carmi

    Thanks! AEGP_SetStreamName() worked. But also, this variation worked, too:

     

            PF_ParamDef p = *c->params[paramID];  // my id-to-index param ptr map

            PF_STRCPY(p.name, newName);

            PF_ParamUtilsSuite1 *pus;

            ACQUIRE_SUITE(kPFParamUtilsSuite,kPFParamUtilsSuiteVersion1,&pus);

            int index = c->global->paramIdToIndex[paramID]; // another thing'o'mine

            pus->PF_UpdateParamUI(in_data->effect_ref,index,p);

     

    Any reason to prefer one to the other?

     
    |
    Mark as:
  • Currently Being Moderated
    Sep 14, 2012 8:10 AM   in reply to david van brink

    first of all, i was not aware of the method you suggested, so thanks for

    the info!

    as for the differences...

    the SetStreamName thingie can be called at any time, including to and by

    other plug-ins.

    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

    time).

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points