Skip to main content
Justin Taylor-Hyper Brew
Community Expert
Community Expert
March 21, 2019
Question

Usage of AEGP_EffectCallGeneric() / PF_Cmd_COMPLETELY_GENERAL

  • March 21, 2019
  • 1 reply
  • 1330 views

Trying to trigger an effect function from outside the effect. I apply both effects to a layer, and then trigger the message, but it's not recieved on the other end.

I believe I'm able to send AEGP_EffectCallGeneric() correctly by targeting the right layer (following the ProjDumper / Shifter examples), but I'm not able to trigger the other effect with PF_Cmd_COMPLETELY_GENERAL.

Am I missing a step here? Thanks!

Effect A (to send command):

[.........]

AEGP_SuiteHandler suites(in_data->pica_basicP);

A_long          num_effectsL, num_paramsL;


A_char          effect_nameAC[AEGP_MAX_ITEM_NAME_SIZE] = { '\0' };


AEGP_LayerH         layerH = NULL;

AEGP_CompH          compH = NULL;


AEGP_EffectRefH     effectH = NULL;

AEGP_ItemH          comp_itemH = NULL,

                    active_itemH = NULL;

AEGP_CompH parent_compH;

AEGP_LayerIDVal id;

AEGP_ItemType       item_type = AEGP_ItemType_NONE;


ERR(suites.ItemSuite8()->AEGP_GetActiveItem(&active_itemH));


if (active_itemH) {

    ERR(suites.ItemSuite8()->AEGP_GetItemType(active_itemH, &item_type));

}


if (!err) {

    if (AEGP_ItemType_COMP == item_type) {

        A_long layer_indexL = 0;

        FILE                *out;

        AEGP_LayerH layerH = NULL;

        AEGP_CompH compH = NULL;


        ERR(suites.CompSuite4()->AEGP_GetCompFromItem(active_itemH, &compH));

        ERR(suites.LayerSuite5()->AEGP_GetCompLayerByIndex(compH, layer_indexL, &layerH));

        //AEGP_GetLayerFromLayerID()

        ERR(suites.EffectSuite2()->AEGP_GetLayerNumEffects(layerH, &num_effectsL));


        for (A_long jL = 0; !err && jL < num_effectsL; jL++) {

            ERR(suites.EffectSuite2()->AEGP_GetLayerEffectByIndex(S_my_id, layerH, jL, &effectH));


            if (!err && effectH) {

                AEGP_InstalledEffectKey key;


                ERR(suites.EffectSuite2()->AEGP_GetInstalledKeyFromLayerEffect(effectH, &key));

                ERR(suites.EffectSuite2()->AEGP_GetEffectName(key, effect_nameAC));

           

                if (!strcmp(effect_nameAC, "Effect B")) {

                    A_Time                  fake_timeT = { 0, 100 };

                    // Message Sending Correctly

                    err = suites.EffectSuite2()->AEGP_EffectCallGeneric(S_my_id, effectH,

                                                            &fake_timeT, (void*)"Message");

                }

            }

        }

    }

}

[.........]

Effect B (to receive command):

[.........]

static PF_Err

RespondtoAEGP (    

    PF_InData       *in_data,

    PF_OutData      *out_data,

    PF_ParamDef     *params[],

    PF_LayerDef     *output,

    void*           extraP)

{

    PF_Err          err = PF_Err_NONE; 

    AEGP_SuiteHandler suites(in_data->pica_basicP);

    suites.ANSICallbacksSuite1()->sprintf(  out_data->return_msg,

                                            "%s",  

                                            reinterpret_cast<A_char*>(extraP));

    PF_STRCPY(  out_data->return_msg,

            STR(1234));

            out_data->out_flags |= PF_OutFlag_DISPLAY_ERROR_MESSAGE;

    return err;

}

[.........]

PF_Err

EffectMain(

    PF_Cmd cmd,

    PF_InData *in_data,

    PF_OutData *out_data,

    PF_ParamDef *params[],

    PF_LayerDef *output,

    void *extra)

{

    PF_Err err = PF_Err_NONE;

    try

    {

        switch (cmd)

        {

        case PF_Cmd_COMPLETELY_GENERAL:

            // This is not getting triggered

            err = RespondtoAEGP(in_data,

                out_data,

                params,

                output,

                extra);

            break;

[.........]

This topic has been closed for replies.

1 reply

Community Expert
March 21, 2019

there's a strange limitation with EffectCallGeneric. you can't call one

instance from another instance of the same effect.

for example, you can't call a blur from a blur. you can call a blur from a

levels.

is that your use case?

On Thu, Mar 21, 2019 at 8:29 PM justintaylor <forums_noreply@adobe.com>

Justin Taylor-Hyper Brew
Community Expert
Community Expert
March 21, 2019

Thanks, I did see that mentioned in another post, but no that's not my use case. I'm sending the message from one effect to an entirely different effect.

Once I get this method working I want to call it from ExtendScript with ExternalObject as a DLL, but for now, I'm just trying to get it to work correctly in C++ space if that makes sense.

Think I'm just missing some step. Do you have to register PF_Cmd_COMPLETELY_GENERAL somehow before using it or should it work as long as it's listening for that option in EffectMain()?

Community Expert
March 22, 2019

no, you don't need to register in any way, but let's check some silly

little detail?

does your plug-ins entry point respond to this selector? not all SDK

samples have that command defined in their call switch in the entry point

function...

On Thu, Mar 21, 2019 at 11:36 PM justintaylor <forums_noreply@adobe.com>