Copy link to clipboard
Copied
Hi
I need my effects to have a unique ID. So I have created an AEGP and a custom suite. The custom suite have a function which returns an unique effect ID.
In the very end of the ParamSetup function I want to do this:
Call GetUniqueEffectID function
Use AEGP_GetNewEffectForEffect to get effect
Use AEGP_GetNewEffectStreamByIndex to get parameter stream
Use AEGP_SetStreamValue to set value of a hidden ID parameter to the uniqueID
The problem is I don't get far. If I call this line at the end of paramSetup I get a runtime error:
ERR(suites.PFInterfaceSuite1()->AEGP_GetNewEffectForEffect(globP->my_id, in_data->effect_ref, &effectRef));
What would be the correct way to do this? Is there a better time to set the parameter value?
Thanks,
Jakob
If you need each instance of your effect to have a unique id, then there's a conceptual problem here.
Param setup is called once per session per effect type, and not once per instance. So all your instances will end up with the same id for that session.
The way to go is to setup sequence data with a unique ud, as the sequence setup call is triggered only once per instace, when it is created.
There are some complications with this method, so look it up in this forum ad it has been duscussed thr
...Copy link to clipboard
Copied
Simply set the default value during the PF_ADD_FLOAT_SLIDER call, of course!
Sorry, friday afternoon here.
Copy link to clipboard
Copied
If you need each instance of your effect to have a unique id, then there's a conceptual problem here.
Param setup is called once per session per effect type, and not once per instance. So all your instances will end up with the same id for that session.
The way to go is to setup sequence data with a unique ud, as the sequence setup call is triggered only once per instace, when it is created.
There are some complications with this method, so look it up in this forum ad it has been duscussed throughly in the past.
Copy link to clipboard
Copied
Is there a way to set a parameters value during the PF_Cmd_SEQUENCE_RESETUP? Can I reset a specific parameter during PF_Cmd_SEQUENCE_RESETUP?
Copy link to clipboard
Copied
in short: no.
in long:
sequence setup (and ususally all other sequence data calls) usually happen without the call having a specific instance associated to the call. that means the passed params array contains junk data, and trying to aquire an AEGP_EffectRef will result in a crash.
so although is seems logical to change params during the sequence data call, it's technically not possible.
the way to go is to set a flag in the new squence data saying "this is a brand new instance, and it should be treated", then then checking this flag during idle_hook or during UPDATE_PARAMS_UI, and making the change accordingly (and not to forget to set that flag off...).
Copy link to clipboard
Copied
Thank you. I now got the sequence data flag to work and at the same time trigger the UPDATE_PARAMS_UI.
But, I can't set the value of a parameter during the UPDATE_PARAMS_UI. I can do it during the PF_Cmd_UPDATE_PARAMS_UI call, but is there a way to trigger that instead?
I'll rather avoid IDLE_HOOK if possible.
Another question is, can I in any way tell the difference if the PF_Cmd_SEQUENCE_RESETUP is called because of a project being opened or because the effect have been added/duplicated?
Copy link to clipboard
Copied
Indeed update parame ui is not the ideal call during which to set the default param value, but that cal is triggered when the effect is applied while user chaged param is not. So... I won't tell anyone if you won't.
Use AEGP_SetStreamValue to set the param value. It will work during update params ui.
As for telling a resetup for a duplicate from a reload, that's part of the complication... Lookup previus discussions in the forum for how to tackle that.
Copy link to clipboard
Copied
I see, thanks. I wont tell anyone. Honestly don't think I will meet anyone who'll ask me either. 🙂
I think I have read through everything related. I can't really find any good advice other than checking if two effects ends up with the same ID. I'm not sure that will do it for me. Maybe.
But at least I understand how it's working and the limitations now and will figure it out. Thank you. Really appreciated.