Skip to main content
Inspiring
May 11, 2022
Question

Problem storing data in Sequence_data

  • May 11, 2022
  • 1 reply
  • 241 views

Dear AE fellows, I have the following problem.

I'm trying to save some test integer parameter in sequence_data during PF_Cmd_UPDATE_PARAMS_UI call.

 

However,  when I read my sequence_data in the Render function, this parameter doesn't update (from its default zero value).

Here is how I try to implement it:

As a starting point I use supervisor sample plugin.

I introduced additional parameter test_int into Sequence Data structure:

typedef struct {
PF_State state;
PF_Boolean advanced_modeB;
int test_int; // my int test parameter
} my_sequence_data, *my_sequence_dataP, **my_sequence_dataH;

Next, I slightly modify my SequenceSetup function:

static PF_Err 
SequenceSetup (	
	PF_InData		*in_data,
	PF_OutData		*out_data, int init_num = 0)
{
	PF_Err err = PF_Err_NONE;
	AEGP_SuiteHandler suites(in_data->pica_basicP);
	
	err = SequenceSetdown(in_data, out_data);
	
	if (!err){
		PF_Handle	seq_dataH =	suites.HandleSuite1()->host_new_handle(sizeof(my_sequence_data));
		
		if (seq_dataH){
			my_sequence_dataP seqP = static_cast<my_sequence_dataP>(suites.HandleSuite1()->host_lock_handle(seq_dataH));
			if (seqP){
				if (in_data->appl_id != 'PrMr')
				{
					ERR(suites.ParamUtilsSuite3()->PF_GetCurrentState(	in_data->effect_ref, SUPER_SLIDER, NULL, NULL, &seqP->state));
					seqP->test_int = init_num; // I set my parameter here!
				}
				seqP->advanced_modeB = FALSE;

				out_data->sequence_data = seq_dataH;
				suites.HandleSuite1()->host_unlock_handle(seq_dataH);
			}
		} else {	// whoa, we couldn't allocate sequence data; bail!
			err = PF_Err_OUT_OF_MEMORY;
		}
	}
	return err;
}

Then I call SequenceSetup in the UpdateParameterUI

   function:

 

SequenceSetup(in_data, out_data, 57);

57 is my  test number.

Finally, I read sequence data with

my_sequence_dataP	seqP	= reinterpret_cast<my_sequence_dataP>(DH(in_data->sequence_data));

command in SmartRender function. 

 

Unfortunately, seqP->test_int is always zero inside Render function. What do I miss?

Yaroslav.

 

P.S. The flag

PF_OutFlag_REFRESH_UI | PF_OutFlag_FORCE_RERENDER   is set inside UpdateParameterUI function   (as well as the flag PF_OutFlag_SEND_UPDATE_PARAMS_UI in GlobalSetup function)

P.P.S. I also tried to store this number via 

 

	my_sequence_dataP	seqP = reinterpret_cast<my_sequence_dataP>(DH(out_data->sequence_data));
	seqP->test_int = 57;

inside UpdateParameterUI function.  This doesn't help either.

 

This topic has been closed for replies.

1 reply

Inspiring
May 11, 2022

Oh, I figured it out. 

It happened that my sequenceResetup function was not configured properly. Now it works.

Sorry for bothering, guys.