Copy link to clipboard
Copied
Tldr; how can I update my parameters when the plugin is first applied to a layer?
Hi. I allocate some global data inside global setup, but because the params haven’t been initiated I can’t do it here. So I do it during update_params_UI. This is the code I use, but it doesn’t update the parameter for some reason:
params[EM_TOPLEFT]->u.td.x_value = FLOAT2FIX(globP->x0);
params[EM_TOPLEFT]->uu.change_flags = PF_ChangeFlag_CHANGED_VALUE;
I call that exact same code on a supervised button during PF_Cmd_USER_CHANGED_PARAM and it works so I’m not sure why it’s not working when called from update params UI. I don’t want the users to have to press the button manually each time the effect is applied to a new layer. Thanks!
1 Correct answer
yeah, param value changes during UPDATE_PARAMS_UI are ignored by AE. you
can however do the same changes using SetStreamValue and it would stick.
not that doing so is the best practice, but hey, you gotta do what you
gotta do...
On Mon, Feb 12, 2018 at 12:54 AM, JamesWhiffin555 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
yeah, param value changes during UPDATE_PARAMS_UI are ignored by AE. you
can however do the same changes using SetStreamValue and it would stick.
not that doing so is the best practice, but hey, you gotta do what you
gotta do...
On Mon, Feb 12, 2018 at 12:54 AM, JamesWhiffin555 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
Thanks Shachar, it works! I think this happens after the render call, is it possible to call a re-render somehow?
To call PF_Cmd_SMART_PRE_RENDER I need (PF_PreRenderExtra*)extra), but I don't have that in UPDATE_PARAMS_UI
Copy link to clipboard
Copied
if you change any param that isn't PUI_ONLY, then a re-render should
happen. does it not?
On Mon, Feb 12, 2018 at 1:56 AM, JamesWhiffin555 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
Thanks, you're right it does. In the render function I draw a shape based on the param slider, however it doesn't seen to honour the change I made to the slider in update_params_UI. I'm accessing it this way:
coords.xLowest = FIX_2_FLOAT(paramsP[EM_TOPLEFT]->u.td.x_value);
I'll try accessing the value using getStreamVal and see if it's the updated one.
Copy link to clipboard
Copied
i'm going to suggest a different approach. i don't know if it suites you
needs, but here goes:
either set a default value to the slider that has no other meaning than "no
value set yet", or set a flag in the sequence data telling this effect has
not yet been "initiated".
during the render call, check for these conditions. if true, let the
decision making happen inside the render call without changing the param.
if the condition check is false, go with what's set in the param.
On Mon, Feb 12, 2018 at 2:19 AM, JamesWhiffin555 <forums_noreply@adobe.com>
Copy link to clipboard
Copied
Thanks Shachar that does sound like a better idea! And yeah, I was mistakenly using global data instead of sequence data as I'm not very experienced with those.
Copy link to clipboard
Copied
This is funny, I was trying to change x and y point params on application of effect. Similar problem.

