Skip navigation
Currently Being Moderated

effect_index?

Oct 16, 2009 1:52 PM

I know this must be simple, but I'm not finding it. How does an effect get its own effect_index?

 

Dan

 
Replies
  • Currently Being Moderated
    Oct 17, 2009 12:18 PM   in reply to Dan Ebberts

    Mr. Ebberts, you'd better sit down...

     

    i struggled with this seemingly simple question over a year ago, and could not find a simple answer.

    i could absolutely not find an api for finding the effect's index.

    eventually i did a work around that supplied me with the index but it's a bit messy.

     

    try the following:

    get your plug-in's install key (a nightmare on it's own merit),

    run though all effects on the layer until you hit an effect with the same install key.

     

    this will give you the index of your effect, given you have only one copy of it on each layer.

    in case of multiple copies on each layer, it gets more complicated.

    add an invisible checkbox param to your effect, and make it UI only (not attached to a stream, and not affecting the render).

    again, you should run through all effects on your layer, and when you stumble upon an effect with the same install key,

    turn the check box on.

    now check the checkbox on the current effect (using getNewEffectForEffect).

    if it's on, then you've spotted your index.

    if it's off, the re-set the last checked index back to off and move on to the next index.

     

    hey! i never said it would be fun!

     

    i hope these suggestions help you,

    and incase you find the correct way (or any simpler way),

    PLEASE post it back here, as it would really help me.

    thanks,

    shachar.

    :-)

     

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2009 12:53 PM   in reply to shachar carmi

    get your plug-in's install key (a nightmare on it's own merit),

     

    Wow, two calls is a nightmare? AEGP_GetNewEffectForEffect(), then AEGP_GetInstalledKeyFromLayerEffect().

     

    Shorter solution to what you proposed, though, is that there are easier ways to seed a random number. I'm sure there must be at least one good reason, but I can't see why an effect would need to get it's own effect_index; if it's manipulating things at the AEGP level, then the effect is going outside the bounds of expected effect behavior. For example, users would quickly get paranoid if applying an effect changed other instances of that effect, or (worse) silently manipulated the project...

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2009 1:20 PM   in reply to bbb_999

    Wow, two calls is a nightmare? AEGP_GetNewEffectForEffect(), then AEGP_GetInstalledKeyFromLayerEffect().

     

    getting an effect's own install key is indeed simple.

    getting another effect's install key, for which you only have the match name and is not the one making the query, now that's another story.

    in such a case i used a loop running through all installed effects until i come across the effect with the correct match name.

    AEPGs can't do that upon loading, because it's not guaranteed that the effect it's looking for has already been loaded.

    i know my nightmares... (or at least finding a way to accomplish that was nightmarish)

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2009 1:32 PM   in reply to shachar carmi

    You're right Shachar, the process you described 1) is pretty nightmarish, and 2) is appropriate for the task described.

     

    If you find yourself getting into nightmare territory, maybe you're going outside the boundaries of what the API was intended to support.

     
    |
    Mark as:
  • Currently Being Moderated
    May 9, 2013 2:23 AM   in reply to bbb_999

    Hi guys!

     

    This problem is pretty old, but I think you might be interested anyway :

     

      ERR(suites.StreamSuite4()->AEGP_GetNewEffectStreamByIndex( pluginID, effect_refH, (any parameter's index), &streamA));    //Gives parameter's stream

                        ERR(suites.DynamicStreamSuite4()->AEGP_GetNewParentStreamRe f( pluginID, streamA, &parentStream));                               //Gives effect's stream

                        ERR(suites.DynamicStreamSuite4()->AEGP_GetStreamIndexInPare nt( parentStream, &fxIndex));                                               //Gives effect's stream index in Effect's propertyGroup

     

    So this index is your effect's index!

     

    I haven't tried it in many situations yet, but for the moment, it seems to work...

     

    Cheers,

    François

     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2013 2:22 AM   in reply to françois leroy

    this is... FREAKIN' BRILLIANT!!!

    wow!!!

    nice job françois leroy!!!

    that would have saved me a TON of work!

     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2013 2:56 AM   in reply to shachar carmi

    Thanx!

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Incoming Links

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points