• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

SDK error: UpdateParamUI passed ParamDef of wrong type

Engaged ,
Nov 16, 2022 Nov 16, 2022

Copy link to clipboard

Copied

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;
}
TOPICS
SDK

Views

678

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 2 Correct answers

Engaged , Nov 18, 2022 Nov 18, 2022

Sorry for all the responses. I figured it out now. If I don't add one to the num_params and instead start the enum with one, not zero. It works.

enum {
	SUPER_DROPDOWN_CLONER_TYPE = 1,
	SUPER_DROPDOWN_CYCLE,
	SUPER_SLIDER_CYCLE_SEED,
	SUPER_SLIDER_COUNT,
	SUPER_CHECKBOX_VISIBLE,
	SUPER_CHECKBOX_MOTION_BLUR,
	SUPER_CHECKBOX_3D,
	SUPER_SLIDER_POSITION_X,
	SUPER_SLIDER_POSITION_Y,
	SUPER_SLIDER_POSITION_Z,
	SUPER_NUM_PARAMS
};

 What I do not understand is. In the Supervisor example, it works with zer

...

Votes

Translate

Translate
Engaged , Nov 18, 2022 Nov 18, 2022

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,

...

 

 

 

 

Votes

Translate

Translate
Engaged ,
Nov 17, 2022 Nov 17, 2022

Copy link to clipboard

Copied

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. 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 18, 2022 Nov 18, 2022

Copy link to clipboard

Copied

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 18, 2022 Nov 18, 2022

Copy link to clipboard

Copied

Not sure if this is a clue. In the end of the paramsSetup function I had to add one to num_params.

out_data->num_params = SUPER_NUM_PARAMS + 1;

Or i would get a parameter count mismatch error. But I have checked and rechecked that everything is in the right order. As far as I can see everything is as it should be.

enum {
	SUPER_DROPDOWN_CLONER_TYPE = 0,
	SUPER_DROPDOWN_CYCLE,
	SUPER_SLIDER_CYCLE_SEED,
	SUPER_SLIDER_COUNT,
	SUPER_CHECKBOX_VISIBLE,
	SUPER_CHECKBOX_MOTION_BLUR,
	SUPER_CHECKBOX_3D,
	SUPER_SLIDER_POSITION_X,
	SUPER_SLIDER_POSITION_Y,
	SUPER_SLIDER_POSITION_Z,
	SUPER_NUM_PARAMS
};

enum {
	SUPER_DROPDOWN_CLONER_TYPE_DISK_ID = 1,
	SUPER_DROPDOWN_CYCLE_DISK_ID,
	SUPER_SLIDER_CYCLE_SEED_DISK_ID,
	SUPER_SLIDER_COUNT_DISK_ID,
	SUPER_CHECKBOX_VISIBLE_DISK_ID,
	SUPER_CHECKBOX_MOTION_BLUR_DISK_ID,
	SUPER_CHECKBOX_3D_DISK_ID,
	SUPER_SLIDER_POSITION_X_DISK_ID,
	SUPER_SLIDER_POSITION_Y_DISK_ID,
	SUPER_SLIDER_POSITION_Z_DISK_ID
};

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 18, 2022 Nov 18, 2022

Copy link to clipboard

Copied

Sorry for all the responses. I figured it out now. If I don't add one to the num_params and instead start the enum with one, not zero. It works.

enum {
	SUPER_DROPDOWN_CLONER_TYPE = 1,
	SUPER_DROPDOWN_CYCLE,
	SUPER_SLIDER_CYCLE_SEED,
	SUPER_SLIDER_COUNT,
	SUPER_CHECKBOX_VISIBLE,
	SUPER_CHECKBOX_MOTION_BLUR,
	SUPER_CHECKBOX_3D,
	SUPER_SLIDER_POSITION_X,
	SUPER_SLIDER_POSITION_Y,
	SUPER_SLIDER_POSITION_Z,
	SUPER_NUM_PARAMS
};

 What I do not understand is. In the Supervisor example, it works with zero? Why would mine need to be one?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 18, 2022 Nov 18, 2022

Copy link to clipboard

Copied

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,

...

 

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Nov 24, 2022 Nov 24, 2022

Copy link to clipboard

Copied

LATEST

Right. I see that now. Thank you very much for explaining that.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines