Problem with AEGP_GetLayerNumEffects and AEGP_GetEffectMatchName
Hi
In an AEGP I'm building a function which can loop through all layers and effects in a given composition.
The problem is that my effectsLen (number of effects on a layer) will return a very high number of several thousands even though there are only one effect in my test project.
What is weird is, if I exclude this line:
ERR(suites.EffectSuite4()->AEGP_GetEffectMatchName(installedKey, &effectMatchName));
... it will work and effectsLen will correctly be 1. If I add it, effectLen will be wrong. I fail to see what these have to do with each other? The error message I get is actually a "Plugin ID is invalid".
static PF_Err
LoopThroughEffects
(
AEGP_CompH compH,
AEGP_GlobalRefcon plugin_refconP)
{
PF_Err err = PF_Err_NONE;
AEGP_SuiteHandler suites(sP);
AEGP_PluginID plugin_id;
A_long layersLen;
ERR(suites.UtilitySuite6()->AEGP_RegisterWithAEGP(plugin_refconP, STR(StrID_Name), &plugin_id));
ERR(suites.LayerSuite8()->AEGP_GetCompNumLayers(compH, &layersLen));
for (A_long i = 0; i < layersLen; i++)
{
AEGP_LayerH layer;
A_long effectsLen;
ERR(suites.LayerSuite8()->AEGP_GetCompLayerByIndex(compH, i, &layer));
ERR(suites.EffectSuite4()->AEGP_GetLayerNumEffects(layer, &effectsLen));
for (A_long e = 0; e < effectsLen; e++)
{
AEGP_EffectRefH effectRef;
AEGP_InstalledEffectKey installedKey;
A_char effectMatchName;
ERR(suites.EffectSuite4()->AEGP_GetLayerEffectByIndex(plugin_id, layer, e, &effectRef));
ERR(suites.EffectSuite4()->AEGP_GetInstalledKeyFromLayerEffect(effectRef, &installedKey));
ERR(suites.EffectSuite4()->AEGP_GetEffectMatchName(installedKey, &effectMatchName)); // This is the problem
if (effectRef) ERR(suites.EffectSuite4()->AEGP_DisposeEffect(effectRef));
}
}
return err;
}
Any help will be greatly appreciated.
- Jakob
Update after more tests:
I have tried with AEGP_GetEffectName also. Same result.
I have put in a break point to check the values. Effects name will be "77 'M'" which also is wrong. Maybe a hint?
EffectsLen will change to "1869366048".
When continuing I get the pluginID error. I have also tried with NULL as pluginID.
