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

AE SDK how to get size of the composition?

Community Beginner ,
Jul 15, 2025 Jul 15, 2025

Hello, 

I have a compostion of 3480x1920. I add a layer of an image(sequence) with 2000x800. 
I add my pliugin on this layer. 
It sees only width and height 2000x800. But I want to know the comp size 3480x1920. 
My plugin wants to scale and distort this 2000x800 input image to 3480x1920. 
e.g. by scale factor of 2. 
To do this I need to loop over all 3480x1920 output pixels and get their value by inverse transformation an looking into my input. 

At the moment I try this in Smart Pre Render event. To get the size. But i am open for other suggestions. 

How can I archieve this? 

Thomas

TOPICS
SDK
220
Translate
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 ,
Jul 19, 2025 Jul 19, 2025

Hi Thomas

Here's one method:

AEGP_SuiteHandler suites(in_data->pica_basicP); 
PF_Rect compSizeRect; AEFX_CLR_STRUCT(compSizeRect); 
AEGP_LayerH layerH = NULL; 
AEGP_CompH compH = NULL; 
AEGP_ItemH compItemH = NULL; 
ERR(suites.PFInterfaceSuite1()->AEGP_GetEffectLayer(in_data->effect_ref, &layerH)); // get the layer reference 
ERR(suites.LayerSuite5()->AEGP_GetLayerParentComp(layerH, &compH)); 
ERR(suites.CompSuite4()->AEGP_GetItemFromComp(compH, &compItemH)); 
ERR(suites.ItemSuite6()->AEGP_GetItemDimensions(compItemH, &compSizeRect.right, &compSizeRect.bottom)); 
compSizeRect.right   = ceil(adaptiveXF * PF_FpShort(compSizeRect.right)); 
compSizeRect.bottom  = ceil(adaptiveXF * PF_FpShort(compSizeRect.bottom));

If your layer is continuously rasterised you can simply get it from in_data, but the user may not always apply the plugin to a cont raster layer.

Translate
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 Beginner ,
Jul 20, 2025 Jul 20, 2025

Hi, 
thank you. So theres no direct call but going throuh all the elements. 

I have an additional question. Don't know if to create a new thread. 

My plug in uses smart render. The compostion (and background layers) have a size of 3480x1920. 
But the layer i apply the plugin to only have a size of 2000x800 (indeed its a tif for testing). 
all works fine so but I didn't manage to render my output to complete size 3480x1920. 
The origin of the output always starts where the origin of the layer is. So my plugin cannot fill the 3480x1920. 
I tried iterate, direct setting and setting to a tempworld an copy it to output. 

I want my plugin to fill the whole layer. For testing only setting orange pixels (255, 127, 10). But later it should transform the input of the layer - the 2000x800 image - to the whole size. 

Any idea? 


 

Translate
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 ,
Jul 20, 2025 Jul 20, 2025

If the layer you apply your plugin to is not the size of the entire composition, and you want to expand it to the size of the composition, you can do that inside pre_render by increasing the output rect. 

But then you have to account for what happens if the layers position moves, should it still fill the entire output buffer? In that case, it's much easier if your layer is continuously rasterised. That way you will receive new pre_render calls whenever the position and size changes so you can adjust your expansion rectangles and origins. 

Translate
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 Beginner ,
Jul 23, 2025 Jul 23, 2025
LATEST
quote

If the layer you apply your plugin to is not the size of the entire composition, and you want to expand it to the size of the composition, you can do that inside pre_render by increasing the output rect. 

But then you have to account for what happens if the layers position moves, should it still fill the entire output buffer? In that case, it's much easier if your layer is continuously rasterised. That way you will receive new pre_render calls whenever the position and size changes so you can adjust your expansion rectangles and origins. 


By @James Whiffin

Hi James, 

I dont know exactly what you mean. How to do that. 

I want the layer not moveable. It should take the content of the layer (the rect around the action content) and project it to the compostion. On this layer of couse. And I want to transform some images/videos that appear in the 360° video on specific places. 

I expanded the layer but corrently i struggle with the offset layer to compositon. 
I get the trans maxtrix by 
A_Matrix4 matrix;
ERR(layerSuite->AEGP_GetLayerToWorldXform(layerH, &currentTime, &matrix));
but the matrix looks not like a normal trans matrix. The x and y offsets are in the bottom line. 
And scaling (50%, 25%) seems to be an issue. 

 

Translate
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