SDK: Detecting when a effect is removed
Hi
I have setup where I need the effect I have created to send a message to a script. It have to do that when the effect is removed from the layer or when the layer on which the effect is, is deleted.
I tried this:
In the EffectMain:
case PF_Cmd_SEQUENCE_SETDOWN:
err = SequenceSetdown(in_data,out_data);
err = SequenceSetdown2(in_data, out_data);
break;And then:
static PF_Err
SequenceSetdown(
PF_InData* in_data,
PF_OutData* out_data)
{
PF_Err err = PF_Err_NONE;
if (in_data->sequence_data) {
AEGP_SuiteHandler suites(in_data->pica_basicP);
suites.HandleSuite1()->host_dispose_handle(in_data->sequence_data);
}
return err;
}
static PF_Err
SequenceSetdown2(
PF_InData* in_data,
PF_OutData* out_data)
{
AEGP_SuiteHandler suites(in_data->pica_basicP);
PF_Err err = PF_Err_NONE;
AEGP_MemHandle resultMemH = NULL;
AEGP_MemHandle errorMemH = NULL;
AEGP_GlobalRefcon globalRef = NULL;
const A_char* pluginName = STR(StrID_Name);
AEGP_PluginID pluginID;
ERR(suites.UtilitySuite6()->AEGP_RegisterWithAEGP(globalRef, pluginName, &pluginID));
ERR(suites.UtilitySuite5()->AEGP_ExecuteScript(pluginID, "callScriptFuntion", TRUE, &resultMemH, &errorMemH));
if (resultMemH) ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(resultMemH));
if (errorMemH) ERR(suites.MemorySuite1()->AEGP_FreeMemHandle(errorMemH));
return err;
}That does not call the function when the effect is removed or the layer is removed. But it is called when the project is closed (which I actually don't want).
Any help on how to do this is greatly appriciated.
- Jakob