You can get the AEGP_LayerH of the layer to which effect is applied using AEGP_GetEffectLayer in PFInterfaceSuite. After that, use the StreamSuite to get the Anchor Point.
Hope that helps.
This is getting close!
Any idea about doing the same for layer params?
For example, to do a particle effect, with a layer param for The Particle, I'd like to draw each instance properly centered on its anchor point.
Not sure I understand well, but if you want to access anchor Point from a layer selected in the Layer Params, here is the way.
Get the effect layer, as described above. Then get the parent comp using AEGP_GetLayerParentComp in Layer Suite. Then get the AEGP_LayerH of that layer param using AEGP_GetCompLayerByIndex. That'll give you access to all the streams.
Ok Satya inch by inch I get there! Thanks so much for helping. Strangely, this is almost my first use of the AEGP's.
Am now able to get the layerH, and the compH, and the list of layerH's in the comp, and even print out their names...
But now the mystery is, How to match up the PF_LayerDef from the effect parameter, to the appropriate layerH indexed out of the compH?
(Also, wondering if this will all be kind-of bad: My Effect probably won't get updated due to a change in the source layer's Anchor point. Not sure yet. The SDK reference warns against non-param dependencies. I really wish Anchor Point was part of PF_LayerDef!)
Oh, I understand now. To do that, you have to get the AEGP_StreamVal2 of that parameter using StreamSuite. It is a union which contains the AEGP_LayerIDVal, for a layer parameter. Then use the AEGP_GetLayerFromLayerID in the LayerSuite to get the AEGP_LayerH.
Not sure if it will be bad, since AE smartly updates many things on the AEGP side even during rendering. A few things like Layer Names, AEGP_MaskRefs don't get updated so frequently, but Layer Parameter Streams are usually well up-to-date. I haven't tried this out yet, so I really can't tell.
here's a dirty way of making AE re-render your effect when some other layer's anchor point changes:
create an invisible param (there's a ui flag for that when creating the pram),
and then put an expression on it linking it to the value of the anchor (or whatever you like) of the layer in your layerParam.
your param's value will now change whenever the anchor of the other layer changes, and that will trigger a re-render of you effect.
Thanks... I read your similar response in another thread. And at first, I thought, "Dirty!"
But the more I think about it the more I like it. It makes the working model very clear: "Effect depends on parameters", full stop. (And leverages After Effects' expression dependency tracking machinery.)
(And to cinch the deal: My day job recently was working on a parameter-driven plugin-based EDA tool, and we came to the same conclusion. You could mark a parameter as, "NEEDS_SYSTEM_CLOCK_RATE" and so on, but couldn't otherwise poke around outside your own plugin.)
So, um, Yeah! But: Still have the problem of discovering the Name or Index of the layer param, in order to build the expression text. Hmmm mysteries still.
elementary my dear watson.
//on the hidden param:
//myEffect("name of layerParam").index;//this is the index of the layer if you need it.
myEffect("name of layerParam").anchorPoint;//or just go for the data and get it over with