Copy link to clipboard
Copied
I know this must be simple, but I'm not finding it. How does an effect get its own effect_index?
Dan
1 Correct answer
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_GetNewParentStreamRef( pluginID, streamA, &parentStream)); //Gives effect's stream
ERR(suites.DynamicStreamSuite4()->AEGP_GetStreamIndexInParent( parentStream, &f
...Copy link to clipboard
Copied
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.
🙂
Copy link to clipboard
Copied
Yikes. I was afraid of that. Thanks for the info though!
I just wanted to use it as a seed (combined with the layer ID) to make sure each instance of my effect on any given layer would generate different random numbers. In my case though, it's unlikely that anyone would apply the effect more than once to the same layer, so I think I'll skip it for now and just use the layer ID. It would be useful in the future though, to have an easy way to do it.
I'm going to leave the topic as "not answered" just in case anyone else has any ideas.
Thanks again.
Dan
Copy link to clipboard
Copied
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...
Copy link to clipboard
Copied
Thanks for chiming in Bruce. My original objective was to have a new set of my effect's perlin noise elements come up if the user applied more than one instance of the effect to the same layer (I already incorporate the layer index so that each layer gets seeded differently). I figured using the effect index would leave the original instance untouched (unless the user moved it around in the effect stack) but additional instances would get a different seed. It seemed like a simple idea. I eventually just gave up on it, figuring that it's unlikely that this particular plugin will get applied more than once to the same layer, but I'd still like to know the best way to do if for future reference.
Dan
Copy link to clipboard
Copied
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)
Copy link to clipboard
Copied
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.
Copy link to clipboard
Copied
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_GetNewParentStreamRef( pluginID, streamA, &parentStream)); //Gives effect's stream
ERR(suites.DynamicStreamSuite4()->AEGP_GetStreamIndexInParent( 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
Copy link to clipboard
Copied
this is... FREAKIN' BRILLIANT!!!
wow!!!
nice job françois leroy!!!
that would have saved me a TON of work!
Copy link to clipboard
Copied
Thanx!

