Assign Surface Texture Size via Scripting

8/31/2023

Hello!
I'm trying to assign a Surface Texture Size via Scripting
If I use something like 
Surface1.Settings.TextureSize.Value = 1920, 1080 it works
but if I try something like
Eval width = 960 + 960        // or any other variables
Eval height = 1080
Surface1.Settings.TextureSize.Value = width, height
it does not work and sends an error
Invalid value '1920' for 1. parameter 'TextureSize' method.
Am I missing something here?

9/1/2023

Hi!

Syntax for assigning a texture size would be
Surface1.Settings.TextureSize.Value = 1920 1080 (with space in between, not a comma).

To assign the values with local variables, please combine both values width and height first:

Eval width = 960 + 960
Eval height = 1080
Eval size = '' + width + ' ' + height
Surface1.Settings.TextureSize.Value = size

Jan Huewel 9/1/2023

Hi right now it is not possible or intended to set this value via script. We can look into adding a specific function. Is there an urgent need for this?

9/1/2023

I was trying to make a script to calculate the surface size and offset given the "crops" of an image (left, right, bottom and top). 
If I want for example to adjust the "crop" on the right side of the image I need to make the texture bigger but that also moves the left side so I need to readjust everything

9/1/2023

Maybe the easier approach is to play with the Perspective Projection Points, Or do you recommend another technique?

Jan Huewel 9/1/2023

There are a couple of ways to do this, one could be to add a mask, another could be to use the UV Offset and scaling


Back