Skip to main content
Participating Frequently
October 21, 2010
Answered

How to get effect's parameters in AEGP?

  • October 21, 2010
  • 2 replies
  • 3234 views

Hi all,

I have a problem when I want to export the parameters from the effect.

(I have checked the sample project "ProjDumper". )

Yellow: layer

Red: one of the effect (Text)

Green: the params of the effect (I want to export those values).

Following is my code:

        // 1. use a loop to find the "Text" effect
     // 2. get all the params from this effect
     A_long iL = 0;
     A_long jL = 0;
     A_long num_effectsL;
     A_long num_paramsL;
     A_char effect_nameC[30] = {'\0'};
     AEGP_StreamRefH streamH = NULL;
     AEGP_EffectRefH effectH = NULL;
     PF_ParamType            param_type;
     PF_ParamDefUnion        param_union;
     // Get number of effects on this layer
     ERR(Suites.EffectSuite2()->AEGP_GetLayerNumEffects(pLayerHandle, &num_effectsL));

     for (iL = 0; iL < num_effectsL; iL++)
     {
          ERR(Suites.EffectSuite2()->AEGP_GetLayerEffectByIndex(g_PluginID, pLayerHandle, iL, &effectH));
          
          if (effectH)
          {
               AEGP_InstalledEffectKey     key;

               ERR(Suites.EffectSuite2()->AEGP_GetInstalledKeyFromLayerEffect(effectH, &key));
               ERR(Suites.EffectSuite2()->AEGP_GetEffectName(key, effect_nameC));

               if (!strcmp(effect_nameC, "Text"))
               {
                    // Get number of effect parameters from Text effect
                    ERR(Suites.StreamSuite2()->AEGP_GetEffectNumParamStreams(effectH, &num_paramsL));

                    for (jL = 1; jL < num_paramsL; ++jL) // start at 1 to skip initial layer param
                    {          
                         ERR(Suites.EffectSuite3()->AEGP_GetEffectParamUnionByIndex(g_PluginID, effectH, jL, &param_type, &param_union));
                         switch (param_type)
                         {
                         case PF_Param_POPUP:
                              break;
                         case PF_Param_SLIDER:
                              break;
                         case PF_Param_COLOR:
                              break;
                         case PF_Param_CHECKBOX:
                              break;
                         default:
                              break;
                         }
                    }
                    ERR2(Suites.EffectSuite2()->AEGP_DisposeEffect(effectH));

                    break;
               }
          }
     }

In the SDK document, it says the value of PF_ParamDefUnion should not be used.

So, how can I obtain those params in the effect I set (the green line in the picture)?

And, If there is any wrong of my logic, please let me know.

Thanks.

This topic has been closed for replies.
Correct answer softy123___

>>How can I know which param is pop-menu, checkbox, or fix slider? (You can see the green line of the picture.)

I now only how to get parameter stream type (AEGP_StreamVal type: AEGP_OneDVal, AEGP_ColorVal etc.). Pop-menu, checkbox, or fix slider parameter streams have the same stream type: AEGP_OneDVal.

How to get parameter control type you already posted in your code).

>>Shouldn't I use a loop to obtain all the params??

I use such loop too..

>>Could you please tell more detail how to use it?

I don't know what you want to do.. I can't say more than written in SDK.

2 replies

Inspiring
October 22, 2010

Where did you find PF_ParamDefUnion is not allowed to be used? It is supposed to be used! and you have PF_ParamDef *params[] passed into your hook function.

There is a whole section in the SDK warning about using AEGP suites, "CHEATING: EFFECT USAGE OF AEGP SUITES"; use it only when you absolutely have to (i.e. you cannot achieve it with effect callbacks in PF_InData).

greets

m

ZuzuWuAuthor
Participating Frequently
October 22, 2010

Hi Mike Basil,

Thank you for your opinion.

I use AEGP_GetEffectParamUnionByIndex now, and it works.

When I study SDK document (cs4 version), page 218, the prupose of GetEffectParamUnionByIndex says:

Returns description of effect parameter. Do not use the value(s) in the ParamDef returned by this function (Use AEGP_GetNewStreamValue() instead)

That the reason why I choose AEGP_GetNewStreamValue() instead.

And, your question is why I use AEGP suites.

Because I can't obtain PF_InData indeed.

The purpose of my program is to output all the information of Text object.

I use  A_Err EntryPointFunc(

                               struct SPBasicSuite        *pica_basicP,

                               A_long   major_versionL,   
                               A_long                    minor_versionL,        
                               const A_char                 *file_pathZ,          
                               const A_char                 *res_pathZ,       
                               AEGP_PluginID            aegp_plugin_id,  
                               void                        *global_refconPV)

and insert a item in the menu to let user export the infomation.

So, I have to use AEGP suites to achieve my goal.

I am really grateful to you.

Thanks again.

Inspiring
October 22, 2010

Zuzuwu, looks like I have misinterpreted that you are developming an Effect instead of an AEGP. Please please diregard my post!

greets

Inspiring
October 21, 2010

Use AEGP_StreamSuite4::AEGP_GetNewStreamValue(..)

ZuzuWuAuthor
Participating Frequently
October 21, 2010

Thank you for the opinion.

But, when I study the document, the output  of AEGP_GetNewStreamValue is AEGP_StreamVal.

It's a union:

typedef union {
    AEGP_FourDVal                        four_d;
    AEGP_ThreeDVal                      three_d;
    AEGP_TwoDVal                         two_d;
    AEGP_OneDVal                         one_d;
    AEGP_ColorVal                          color;
    AEGP_ArbBlockVal                    arbH;
    AEGP_MarkerValH                     markerH;
    AEGP_LayerIDVal                      layer_id;
    AEGP_MaskIDVal                      mask_id;
    AEGP_MaskOutlineValH            mask;
    AEGP_TextDocumentH             text_documentH;
} AEGP_StreamVal;

How can I know which param is pop-menu, checkbox, or fix slider? (You can see the green line of the picture.)

Shouldn't I use a loop to obtain all the params??

Could you please tell more detail how to use it?

Thanks again.

softy123___Correct answer
Inspiring
October 21, 2010

>>How can I know which param is pop-menu, checkbox, or fix slider? (You can see the green line of the picture.)

I now only how to get parameter stream type (AEGP_StreamVal type: AEGP_OneDVal, AEGP_ColorVal etc.). Pop-menu, checkbox, or fix slider parameter streams have the same stream type: AEGP_OneDVal.

How to get parameter control type you already posted in your code).

>>Shouldn't I use a loop to obtain all the params??

I use such loop too..

>>Could you please tell more detail how to use it?

I don't know what you want to do.. I can't say more than written in SDK.