• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to get the bounds of text or shape layer?

Participant ,
Mar 26, 2021 Mar 26, 2021

Copy link to clipboard

Copied

Hey Folks. I'm writing an AE Effect Plugin that will draw a border inside the edges of the layer that it's applied to. This works great for Solid layers. However, when I apply the effect to a text or shape layer, my effect draws a border around the entire composition. The PF_EffectWorld passed into my render function has the same dimensions as the entire composition.

 

How can I determine the bounds of the text or shape layer that the effect is applied to? I basically want to draw a rectangle that has the same bounds as the selection box drawn by AE. I attached a photo that shows what I'd like to do.

 

Thanks for your help.

TOPICS
Error or problem , SDK

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 26, 2021 Mar 26, 2021

Copy link to clipboard

Copied

collapsed layers don't have a size and are actaully the same size as the comp. text and shape layers are such layers by default.

you can scan the input buffer for non 0 alpha pixels and get the image's bounding box.

but i think you'll get the input buffer post-transform (again, collapsed layers), so you'll need to manually take the layer's tansform into account if you wish the frame to follow layer transformation. that, however, is counter to the AE logix as effects on colapsed layers are generally expected to apply in comp coordinates and not layer coordinates.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Valorous Hero ,
Mar 27, 2021 Mar 27, 2021

Copy link to clipboard

Copied

Use the sourceRectAtTime Expression Method. This works for scripts and I assume they should work for plugins as well. HTH

Motion Graphics Brand Guidelines & Motion Graphics Responsive Design Toolkits

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Apr 04, 2021 Apr 04, 2021

Copy link to clipboard

Copied

LATEST

I had this same question and Shachar had a good idea to use the vertices to find the bounds:

PF_PATHDATASUITEPF_PathVertexInfo

 

Not sure if this would also work on text, but would be more convenient if it does work:

AEGP_GetLayerMaskedBounds

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines