Skip to main content
tashi_maya
Participant
January 29, 2015
Answered

Detecting when user clicked Reset Parameter

  • January 29, 2015
  • 3 replies
  • 1243 views

I am setting the PF_ParamFlag_SUPERVISE flag for my slider like this:

PF_ADD_FLOAT_SLIDERX("MySlider", 0, 256, 0, 256, 123, PF_Precision_INTEGER, PF_ValueDisplayFlag_NONE, PF_ParamFlag_SUPERVISE, MY_SLIDER_DISK_ID);


I am receiving the PF_Cmd_USER_CHANGED_PARAM command when I change the slider value (Case 1). I also receive the command when I hit the "Reset Parameter" button on the right (Case 2) in the Effect Controls panel.

Is there any way I can distinguish Case 2 from Case 1? I need to perform extra steps for Case 2 but PF_UserChangedParamExtra only contains param_index.


Many thanks

This topic has been closed for replies.
Correct answer Zac Lam

Hi tashi.maya,

Unfortunately, there's no specific API that distinguishes a reset from a parameter change.

3 replies

Richard Rosenman
Inspiring
January 11, 2022

Looks like I figured it out.

 

It seems for PF_ADD_FLOAT_SLIDERX I need to add the flags in the actual parameter statement. Not sure why it differs from the others.

 

I had it like this:

 

AEFX_CLR_STRUCT(def);
def.flags = PF_ParamFlag_SUPERVISE |
PF_ParamFlag_CANNOT_TIME_VARY |
PF_ParamFlag_CANNOT_INTERP;

PF_ADD_FLOAT_SLIDERX("Slider", 0.0, 100.0, 0.0, 100.0, 25.0, PF_Precision_TENTHS, 0, LAYER_ID);

 

 

But it needs to be like this:

 

AEFX_CLR_STRUCT(def);

PF_ADD_FLOAT_SLIDERX("Slider", 0.0, 100.0, 0.0, 100.0, 33.3333, PF_Precision_TENTHS, PF_ValueDisplayFlag_PERCENT, PF_ParamFlag_SUPERVISE | PF_ParamFlag_CANNOT_TIME_VARY |
PF_ParamFlag_CANNOT_INTERP, LAYER_ID);

 

If someone can confirm this, I can mark this as the correct answer for someone else in the future.

 

-Richard

Richard Rosenman
Inspiring
January 11, 2022

Sorry, wrong thread!

gabgren
Inspiring
March 20, 2018

It seems the reset button gets an ID which I would call the "clickable parameter count".

Let's say you have 2 sliders and 1 button, the reset button will get the ID of 4 (3 parameters +1)

BUT if one of your parameters can't be clicked, like an arbitrary data parameter, the reset button ID will not take this parameter in count, so 1 arbdata + 1 slider + 1 button would give the reset button a value of 3 (2 clickable parameters +1)

This is not roughly tested and theoretical, but that's one solution I found is to catch the reset button press.

Hope that helps

Inspiring
March 23, 2018

Here's how I did it in my qpGradeAssistant plugin, where I needed to check whether the plugin had first been applied, or reset had been hit:

- In ParamsSetup I add a hidden checkbox parameter, with supervise on, defaulting to TRUE

- I have a PF_Boolean params_at_defaultB in my sequence data, which is set to FALSE in SequenceSetup

- I check for the (seq data) params_at_defaultB in UpdateParameterUI - if it's FALSE then I

    - set the reset parameter to FALSE

            AEGP_StreamValue2 reset_val = {};

            reset_val.val.one_d = static_cast<PF_FpLong>(FALSE);

            ERR(suites.StreamSuite3()->AEGP_SetStreamValue(NULL, resetH, &reset_val));

            params[PARAM_RESET]->uu.change_flags = PF_ChangeFlag_CHANGED_VALUE;

    - do what I need to do with my parameters

    - set the (seq data) params_at_defaultB to TRUE.

- In UserChangedParam:

    // Special case to begin with - reset has been hit, so we need to force a few things...

    if(extra->param_index == PARAM_RESET) {

        if(!params[PARAM_RESET]->u.bd.value) {

            // Value is false, so don't bother (shouldn't ever trigger as the user can't access this, but for completeness...)

            return err;

        }

       

        // Force Sequence Data to be rebuilt, and the UI to be reset

        ERR(SequenceSetup(in_data, out_data, FALSE));

        ERR(UpdateParameterUI(in_data, out_data, params));

        return err;

    }

Zac LamCorrect answer
Inspiring
January 29, 2015

Hi tashi.maya,

Unfortunately, there's no specific API that distinguishes a reset from a parameter change.