Skip to main content
françois leroy
Inspiring
January 25, 2013
Question

Effect's index

  • January 25, 2013
  • 1 reply
  • 8458 views

Hi!

I have a problem to get an Effect's index. I tried to solve my problem by getting the Effect's name, and it works fine, except if user gives that name twice, so I'm still stucked...

How can you return the Effect's index, usable by Script? For example, my effect is the second effect applied on my layer, how can I get this "2" index?

I figured out how to get layer's index, comp's unique_ID, but see no reference for effect's index into the SDK documentation...

I also tried to iterate with AEGP_GetLayerNumEffects and compare effect_refH, but it doesn't work...

Does anyone know a way?

Thanx,

François

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

I found a work around, by changing the name of my effect, calling it by script with the new name, then re-give the old name, but there must be something more simple...

Any idea?

Thanx

This topic has been closed for replies.

1 reply

Community Expert
January 26, 2013
françois leroy
Inspiring
January 27, 2013

Hi Shachar!

Thanx for the reply...

Well, it seems I did "not so bad", as i don't have to loop through the whole project, but it's still a bit surprising not to be able to access the index.

So, for those who need it, here's the process:

AEGP_RegisterWithAEGP -> get the plugin's ID

AEGP_GetNewEffectStreamByIndex -> get the stream of 1 parameter (no matter which one)

AEGP_GetNewParentStreamRef -> get the Effect's stream

AEGP_GetStreamName -> get the name (not the matchName)

AEGP_LockMemHandle -> store the OldName somewhere

AEGP_SetStreamName -> give a new Name

Then, you can access your effect by its name with Scripts... And your script can re-send you the Index if you need.

Rename your effect with the OldName, and dispose the streams.

By the way, I have a few more questions:

I've been testing some actions (changing a MaskShape) with Scripting, and directly from AEGP, and it seems scripting is faster. Do Script's engine and Effect's engine run at the same time?

And it leads to my 2nd question: is it possible to call ActionScript from an AEGP? Cos' it would be great to have 3 engines running at the same time to get a fast result...

And is it possible to call GPU calculations without switching to openGL?

That's a lot of questions, but you seem to have a lot of answers! :-)

Thanx!

François

françois leroy
Inspiring
February 14, 2013

hhmmm... in earlier versions of AE,

mask("Mask 1").maskPath.value.toSource();

would give you some number, that doens't imply the shpae, but would change when the shape changed...

it now seems to be gone. :-(

no dispair!

it can get a bit messier, but still solvable!

add a mask to your own layer, connect it to that other mask you want to track,

and add a hidden mask param to your effect reading your own local mask.

when the user changes your target mask, it changes your local mask, and the mask param triggers a re-render.

perhaps there's also a way to make that local mask invisible by making it's stream hidden...


Thanx again!

This is great help!

Cheers,

François