Skip to main content
Inspiring
November 16, 2022
Answered

SDK error: UpdateParamUI passed ParamDef of wrong type

  • November 16, 2022
  • 1 reply
  • 1342 views

Hi

 

I'm working on a plugin and using the Supervisor examble as base. I have a dropdown (SUPER_DROPDOWN_CYCLE) and a float slider (SUPER_SLIDER_CYCLE_SEED). The dorpdown have two values. Iterate and random. When I select iterate I want to disable the slider and when selecting random I want to disable the slider.

I have the code below, but I get this error: "After Effetcs Error: Internal verification failure, sorry! {UpdateParamUI() passed ParamDef of wrong type.}"

 

Any help?

Thanks,

Jakob

 

static PF_Err
UserChangedParam(
	PF_InData						*in_data,
	PF_OutData						*out_data,
	PF_ParamDef						*params[],
	PF_LayerDef						*outputP,
	const PF_UserChangedParamExtra	*which_hitP)
{
	PF_Err	err	= PF_Err_NONE;

	return err;
}

static PF_Err
UpdateParameterUI(
	PF_InData				*in_data,
	PF_OutData				*out_data,
	PF_ParamDef				*params[],
	PF_LayerDef				*outputP)
{
	PF_Err		err		= PF_Err_NONE,
			err2		= PF_Err_NONE;
	my_global_dataP			globP				= reinterpret_cast<my_global_dataP>(DH(out_data->global_data));
	my_sequence_dataP		seqP				= reinterpret_cast<my_sequence_dataP>(DH(out_data->sequence_data));
	AEGP_StreamRefH			flavor_streamH		= NULL,
							color_streamH		= NULL,
							slider_streamH		= NULL,
							checkbox_streamH	= NULL;
	PF_ParamType			param_type;
	PF_ParamDefUnion		param_union;
	
	A_Boolean				hide_themB			= FALSE;
						
	AEGP_EffectRefH			meH				= NULL;					
	AEGP_SuiteHandler		suites(in_data->pica_basicP);

	//	Before we can change the enabled/disabled state of parameters,
	//	we need to make a copy (remember, parts of those passed into us
	//	are read-only).

	PF_ParamDef		param_copy[SUPER_NUM_PARAMS];
	ERR(MakeParamCopy(params, param_copy));

	// Toggle enable/disabled state of Cycle Seed
// IF I LEAVE THIS NEXT PART OUT THERE WILL BE NO ERROR
	if (!err &&
		(CYCLE_ITERATE == params[SUPER_DROPDOWN_CYCLE]->u.pd.value)) {

		param_copy[SUPER_SLIDER_CYCLE_SEED].param_type = PF_Param_FLOAT_SLIDER;
		param_copy[SUPER_SLIDER_CYCLE_SEED].ui_flags &= ~PF_PUI_DISABLED;

		ERR(suites.ParamUtilsSuite3()->PF_UpdateParamUI(in_data->effect_ref,
			SUPER_SLIDER_CYCLE_SEED,
			&param_copy[SUPER_SLIDER_CYCLE_SEED]));
	}
	else if (!err &&
		(CYCLE_RANDOM == params[SUPER_DROPDOWN_CYCLE]->u.pd.value) &&
		(!(param_copy[SUPER_SLIDER_CYCLE_SEED].ui_flags & PF_PUI_DISABLED))) {

		param_copy[SUPER_SLIDER_CYCLE_SEED].param_type = PF_Param_FLOAT_SLIDER;
		param_copy[SUPER_SLIDER_CYCLE_SEED].ui_flags |= PF_PUI_DISABLED;

		ERR(suites.ParamUtilsSuite3()->PF_UpdateParamUI(in_data->effect_ref,
			SUPER_SLIDER_CYCLE_SEED,
			&param_copy[SUPER_SLIDER_CYCLE_SEED]));
	}

	return err;
}
This topic has been closed for replies.
Correct answer James Whiffin

You should be able to remove this line and have it work:

param_copy[SUPER_SLIDER_CYCLE_SEED].param_type = PF_Param_FLOAT_SLIDER;

The confusion is because the disk enums in supervisor don't include the input, as it's order never changes. They then start from mode (the first user defined param):

enum {

SUPER_MODE_DISK_ID = 1,

...

The param enum contains the input and must start at 0, and then mode ends up as 1

enum {

SUPER_INPUT = 0,

SUPER_MODE,

...

 

 

 

 

1 reply

James Whiffin
Legend
November 18, 2022

Hi Jakob

The MakeParamCopy func copies the info so the param_copy array should already know which type of param it is. I would comment out those lines and see if that works. I usually use a legacy slider (rather than a float slider) for seeds since they are integer only. You can set a float sliders display precision to integer, but it's not ideal as you can still input float values which will then be rounded to integers in the display. 

 

Inspiring
November 18, 2022

Hi James

Thank you for answering and the tip about the legacy slider. I'll stick with the float slider for now until I get this working, but may change it later.

 

Did you mean to comment out this line?

ERR(suites.ParamUtilsSuite3()->PF_UpdateParamUI(in_data->effect_ref,
			SUPER_SLIDER_CYCLE_SEED,
			&param_copy[SUPER_SLIDER_CYCLE_SEED]));

I tried that and that did get rid of the error message. But also the SUPER_SLIDER_CYCLE_SEED slider didn't get disabled either. So the script still doesn't work.

I have added this line, which I left out at first since I didn't understand why it was neccessary.

strcpy(param_copy[SUPER_SLIDER_CYCLE_SEED].name, STR(StrID_SliderCycleSeedName));

So the script part now looks like this, but doesn't work:

PF_ParamDef		param_copy[SUPER_NUM_PARAMS];
	ERR(MakeParamCopy(params, param_copy));

	// Toggle enable/disabled state of Cycle Seed
	if (!err &&
		(CYCLE_ITERATE == params[SUPER_DROPDOWN_CYCLE]->u.pd.value)) {

		param_copy[SUPER_SLIDER_CYCLE_SEED].param_type = PF_Param_FLOAT_SLIDER;
		param_copy[SUPER_SLIDER_CYCLE_SEED].ui_flags &= ~PF_PUI_DISABLED;
		strcpy(param_copy[SUPER_SLIDER_CYCLE_SEED].name, STR(StrID_SliderCycleSeedName));

		ERR(suites.ParamUtilsSuite3()->PF_UpdateParamUI(in_data->effect_ref,
			SUPER_SLIDER_CYCLE_SEED,
			&param_copy[SUPER_SLIDER_CYCLE_SEED]));
	}
	else if (!err &&
		(CYCLE_RANDOM == params[SUPER_DROPDOWN_CYCLE]->u.pd.value) &&
		(!(param_copy[SUPER_SLIDER_CYCLE_SEED].ui_flags & PF_PUI_DISABLED))) {

		param_copy[SUPER_SLIDER_CYCLE_SEED].param_type = PF_Param_FLOAT_SLIDER;
		param_copy[SUPER_SLIDER_CYCLE_SEED].ui_flags |= PF_PUI_DISABLED;
		strcpy(param_copy[SUPER_SLIDER_CYCLE_SEED].name, STR(StrID_SliderCycleSeedName));

		ERR(suites.ParamUtilsSuite3()->PF_UpdateParamUI(in_data->effect_ref,
			SUPER_SLIDER_CYCLE_SEED,
			&param_copy[SUPER_SLIDER_CYCLE_SEED]));
	}

I wonder if there could be anything wrong with my setup of the slider?

AEFX_CLR_STRUCT(def);

	PF_ADD_FLOAT_SLIDER(STR(StrID_SliderCycleSeedName),
		-100000000,
		100000000,
		0,
		100,
		0,
		0,
		0,
		0,
		FALSE,
		SUPER_SLIDER_CYCLE_SEED_DISK_ID);

Any suggestions for what could be wrong are greatly appreciated.

 

Thanks,

Jakob