Copy link to clipboard
Copied
I am understanding how Setup/Flatten/Resetup/Setdown is working regarding the content of sequence_data.
However, I could not differentiate sequence_data being "copied" for the same instance, and be copy/pasted for a new instance.
In Premiere, I could call PF_UtilitySuite4 GetFilterInstanceID to get the InstanceID to know to which instance the current "call" refer to.
Is there a way in AfterEffetcs to know for which instance I am being called ? Should I use something like the StreamSuite ?
Thanks in avance
Copy link to clipboard
Copied
nope. no way of telling. it's an absolute nightmare. welcome to hell.
for one of my plug-ins, where i needed to tell if an instant's sequence data belonged to it originally or if it's a copy, i'd scan the layer on the first non-seuqnece_data call (because in AE sequence data calls aren't always associated to a certain instance, and sometimes the original instance is called for handling the new instance's business...), and compare instances. if two have the same id in the sequence data, i know the latter of the two must be a new copy and then i create some new data for it.
Copy link to clipboard
Copied
Thanks @shachar carmi for your insights.
How do you do "compare instances. if two have the same id in the sequence data, i know the latter of the two must be a new copy and then i create some new data for it.". Where do you get this ID from ?
Copy link to clipboard
Copied
the id is stored in the seuqnce data of each instance. it's read via AEGP_EffectCallGeneric, which the effect can receive and send back anything you set it up to.
note that you ABSOLUTELY can't call this from one instance to check out another instance of the same effect. it will call itself instead of the other instance... only an AEGP can call instances using this callback.
Copy link to clipboard
Copied
Hello @shachar carmi
I don't understand how you differentiate the original instance and its copy ?
Do you have a code example or at least a pseudo code to show how you do this ?
- we could enumerate the compositions using AEGP_GetFirstProjItem/AEGP_GetFirstProjItem
- we could get all layers using AEGP_GetCompNumLayers/AEGP_GetCompLayerByIndex
- we could get the effect on each layer using AEGP_GetLayerNumEffects/AEGP_GetLayerEffectByIndex
- we could test if it is our effect by name using AEGP_GetInstalledKeyFromLayerEffect/AEGP_GetEffectName
In my case, in PF_Cmd_SEQUENCE_SETUP, I create a new instance of my OFX plugin and stores its pointer in sequence_data.
During flatten (PF_Cmd_GET_FLATTENED_SEQUENCE_DATA / PF_Cmd_SEQUENCE_FLATTEN), I store an ID in the flat data.
During PF_Cmd_SEQUENCE_RESETUP, I use this ID to get back the instance corresponding to this ID. The problem is that if SequenceResetup is used to create a copy... this new AE plugin instance points to the same OFX instance (as I do not know how to get an InstanceID in AE).
I wanted to avoid to create a new OFX instance for each Setup/Resetup (as they are called quite often). My current solution is to have one OFX instance by plugin InstanceID and share the same instance in the multiple sequence_data as long as they share the same InstanceID.
On Premiere, it is easy to get this InstanceID but on AE, I don't know how to implement your solution ?!
As a workaround, a solution is to create a new OFX instance at EACH call to Setup or Resetup.