Offset Numbering of Rendered Frames

Hello. I have a situation - I have to render 2 sequences starting and ending on different frames. It's for animation for a game. On the same scene the character is doing the same animation for 2 sides. For example: drinking_R and drinking_L. From frame 0 to frame 15 he is turned to right and from frame 16 to frame 31 he is turned to left and doing the same animation - drinking (biped). I've previously made a script for this to automate rendering and naming based for a name of animation (which is changing). My problem is when rendering a ..png sequence from f0 to f15 the suffix is, by default, 0000 to 0015 and from f16 to f31 the suffix is 0016 to 0031. Is there a way to offset numbering of rendered frames for the sequence starting from f16 to f31 to be the same as the first one - 0000 to 0015? In that case my animation would be like it has to be, for example: drinking_R.0000.png to drinking_R.0015.png and drinking_L.0000.png to drinking_R.0015.png. Right now I'm renaming the numbering after rendered animation using other tools, so I wanted to ask you, guys, If someone know a solution to make that setup in maxscript. I've tried to make this work by callback but I'm still stuck :/ This postrender frame callback should rename file instantly after rendering it and just before saving it or it renames rendered frame that is just saved in the folder?
here's the code - no errors but it doesn't work:

global right = "C:\Users\Freak\Desktop\TestFolder\Right\drinking_R  ..png"
global left = "C:\Users\Freak\Desktop\TestFolder\Left\drinking_L.  .png"
global newLeft = "C:\Users\Freak\Desktop\TestFolder\Left\drinking_L.  0000.png"
callbacks.removeScripts #postRenderFrame id:#RenameSuffix
 
fn callRenderR =
(
viewport.setCamera $CAM_2
rendUseActiveView = true
renderWidth = 256
renderHeight = 512
rendTimeType = 3
rendSaveFile = true
rendOutputFilename = right
rendStart = 0
rendEnd = 15
max quick render
!REG3XP1!>
)
 
fn callRenderL =
(
viewport.setCamera $CAM_2
rendUseActiveView = true
renderWidth = 256
renderHeight = 512
rendTimeType = 3
rendSaveFile = true
rendOutputFilename = left
rendStart = 16
rendEnd = 31
max quick render
callbacks.addScript #postRenderFrame "renameFile Left newLeft" id:#RenameSuffix	
)
 
callRenderR()
callRenderL()
<mxs>

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vusta's picture

hacky way...

in your Render Setup, Common,

set range to 16 to 31, then File Number Base as -16, yes Minus 16
so that they are renamed starting as 16 - 16 = 0, voila

(of course, you'll have to come up with a script, I only provide the logic.....I can't script)

(i can cut&paste tho:
rendFileNumberBase -- integer

Get/set the File Number Base in the 'Common Parameters' rollup of the Render Scene dialog.)

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.