Identifying a specific effect instance via AEGP_EffectCallGeneric() / PF_Cmd_COMPLETELY_GENERAL
Hi,
The objective is to identify and select a certain effect instance among all instanciated effects. I'm using the following code segment to iterate and scan all the effects currently applied:
// Data structure used for identification
typedef struct
{
uint64_t uniqueID;
bool isKeyEffect;
}
t_struct;
...
AEGP_ItemH itemH2 = 0;
AEGP_CompH compH = 0;
err = suites.ItemSuite8()->AEGP_GetActiveItem(&itemH2);
if(itemH2 == 0)
return err;
err = suites.CompSuite9()->AEGP_GetCompFromItem(itemH2, &compH);
if(compH == 0)
return err;
AEGP_Collection2H collectionH = 0;
AEGP_LayerH layerH = 0;
A_long numLayers = 0;
t_struct key =
{
getEffectID(),
false
};
bool found = false;
if(AEGP_GetCompNumLayers(compH, &numLayers) == PF_Err_NONE)
{
// Scan comp layers
for(A_long i = 0; i<numLayers; i++)
{
suites.LayerSuite7()->AEGP_GetCompLayerByIndex(compH, i, &layerH);
AEGP_EffectRefH layerEffH;
A_Time t = {};
A_long numEffects;
if(suites.EffectSuite3()->AEGP_GetLayerNumEffects(layerH, &numEffects) == PF_Err_NONE)
{
// Scan all instanciated effects
for(A_long j = 0; j<numEffects; j++)
{
suites.EffectSuite3()->AEGP_GetLayerEffectByIndex(0, layerH, j, &layerEffH);
AEGP_InstalledEffectKey keyH;
suites.EffectSuite3()->AEGP_GetInstalledKeyFromLayerEffect(layerEffH, &keyH);
//// This one is the problem: It never triggers any PF_Cmd_COMPLETELY_GENERAL event.
//// It returns PF_Err_NONE, however.
err = suites.EffectSuite3()->AEGP_EffectCallGeneric(0, layerEffH, &t, PF_Cmd_COMPLETELY_GENERAL, (void*) &key);
////
if(key.isKeyEffect)
{
// Select effect
...
found = true;
}
suites.EffectSuite1()->AEGP_DisposeEffect(layerEffH);
if(found)
break;
}
}
}
}
getEffectID() returns a unique 64 bits identifier generated when my effect is instanciated.
Now in my event handler I try to do the following to identify my "key" instance:
switch(cmd)
{
case PF_Cmd_COMPLETELY_GENERAL:
{
// Identify effect
t_struct *ptr = (t_struct*) extra;
ptr->isKeyEffect = (ptr->uniqueID == getEffectID());
}
break;
...
}
The problem is that on Mac AEGP_EffectCallGeneric() doesn't trigger any PF_Cmd_COMPLETELY_GENERAL event, while it does on Windows. Any hint on what I am doing wrong here?
Thanks!
Best,
Reimund
