Showing posts with label pad. Show all posts
Showing posts with label pad. Show all posts

Monday, 29 April 2024

padding zeroes in vex

 s@frameNum= sprintf('%04d',clamp((@Frame-1000),0,68));

//s@name = sprintf('%04d',@Frame);

s@textureFile=chs("part1")+@frameNum+chs("end");


slight update on zero padding in vex...

use sprintf to reformat numbers..

Wednesday, 14 September 2022

filename using digits of the node

 use case - you have many texture nodes, eg. Texture1, Texture2,Texture3.....

You want to automate the filename being loaded & use the number contained within the node name.

To do this we can use a combo of expressions -

//server/jobs/build/ion/textures/flooring/tile_`padzero(2,opdigits("$OS"))`.jpg

where the texture node is Texture5 becomes

//server/jobs/build/ion/textures/flooring/tile_05.jpg

So if we copy and paste this many times, it will update to tile_06, tile_99 etc...


padzero(2, SOMETHING) - pads the value SOMETHING with up to TWO zeroes. 5 becomes 05, 99 stays as 99.

opdigits("whatever") - returns the numbers of "whatever". In the example above, I use the $OS expression to get the name of the node itself-  ie; Texture5, so we get back 5. The padzero makes it 05.

these bits are enclosed with backticks  ` `, to execute the expressions.

Friday, 9 August 2019

padzero to do file names!

/tba/CLIENT_JOBS/GREY_LDN_Zalando_Dont_Change_100713/vfx/shots/sh0033/houdini/sourceimages/backplate/backplate_guide.`padzero(3,$F3-1000)`.jpg


padzero(number of zeros, thing you want to pad) turns _guide.2.jpg into _guide.002.jpg