Skip to main content
Bram Hoekstra
Inspiring
July 16, 2021
Answered

Create Null Object with custom dimensions with script?

  • July 16, 2021
  • 2 replies
  • 1235 views

Is there any possibility to create a Null Object with a custom dimensions via a script?

 

I don't mean that it has been scaled down, but that the actual layer gets created with custom dimensions, like 62.5, 62.5

 

I hope this is possible.

This topic has been closed for replies.
Correct answer Rick Gerard

Dimensions on a null are meaningless. The anchor point is at 0, 0, 0 and nulls don't render. Their size does not translate to other layers unless you add an expression that reads the height and width of the layer. I'm not sure what purpose setting a custom size for a null would have.

2 replies

Dan Ebberts
Community Expert
Community Expert
July 16, 2021

You can do it with a script, but you need to modify the null's source, and the width and height have to be integers. So you could do something like this:

 

var myComp = app.project.activeItem;
var myNull = myComp.layers.addNull(myComp.duration);
myNull.source.width = 63;
myNull.source.height = 63;
Rick GerardCommunity ExpertCorrect answer
Community Expert
July 16, 2021

Dimensions on a null are meaningless. The anchor point is at 0, 0, 0 and nulls don't render. Their size does not translate to other layers unless you add an expression that reads the height and width of the layer. I'm not sure what purpose setting a custom size for a null would have.

Bram Hoekstra
Inspiring
July 16, 2021

I actually wanted to use it as a spacer for a grid like layout.

But I just discoverd I can also do this with slider expression controls.

But thank you for your awnser anyway.