0
votes

I'm making a batch submitter script that renders a series of cameras in my 3d scene. These cameras have their own single frame number that they need to render. I want to be able to save the file based on the name I supply my script but omit the frame number at the end. (ex: fileName0004.tif to fileName.tif, instead) Using 3dsmax 2018 and vray 3.0.

It seems to be an automatic function, but I can't seem to find anywhere talks about disabling it. The only mention so far that I've seen is that it's an option in v-ray 5.0. Unfortunately I can't upgrade anytime soon.

Is this possible? Does anyone know how to do this?

Thanks

function fn_netSubmit =
(
    local arr_camTEST = #("cam1", "cam2", "cam3")
    local arr_renderSeatSide =#("side1", "side2", "side3")
    local arr_renderSeat = #("seat1", "seat2", "seat3")
    local arr_renderFrames = #("1", "3", "7")
    local appendDate = "200707"
    local outputLocation = "some\\location\\"
        
    --connect
    nm.connect #manual "mtlwarml401.ca.aero.bombardier.net" platform:#64
    if nm.QueryControl #wait do 
    (
        nm.GetControl()
        exit
    )
    
    if nm.getControl() == true then
    (
        for i = 1 to arr_camTEST.count do 
        (       
            job = nm.newJob()
            job.outputWidth = 3600
            job.outputHeight = 3600
            job.name = ("filename" + " " + arr_renderSeat[i] + " " + arr_renderSeatSide[i] + " " + "S" + "-" + appendDate)
            job.nonSeqFrames = true
            job.frames = arr_renderFrames[i]
            job.renderCamera  = arr_camTEST[i]
            job.frameOutputName = (outputLocation + "/" + ("filename"  + " " + arr_renderSeat[i] + " " + arr_renderSeatSide[i] + " " + "S") + ".tif")
            job.submit()
        )
    )
    
    nm.Disconnect()
)

fn_netSubmit()
1
I dunno about net rendering, but in general 3ds Max will append frame numbers unless you are rendering in Single Frame render mode. In MAXScript, you can ensure you're in single-frame mode by setting rendTimeType = 1 - paddy
Thanks paddy. I think I could set my render settings outside of the net interface, however, I think that would result in either rendering at frame 0 instead of the specified frame in the script. - Rebecca Taylor
Well you can also set the frame number to render the same way. Pretty much all the render settings can be modified in script. - paddy

1 Answers

0
votes

In the past I've used a script after rendering that parses the filenames in the directory and renames them. This turned out to be way easier and less buggy than trying to use post-render callbacks or trying to force the filename output to change mid-render:

newSuffixes=#("one","two","three")
--get folder
dirToProcess = getSavePath caption:"Select folder to rename" initialDir:"\\\\SERVER\\Path\\Path\\"

--sort functions for file list
fn numFromName str =
(
--returns the frame number from a max rendered filename, e.g. 0002 from file_0002.tga.  Filename MUST use an underscore.
local parts = filterstring str "\._"
return (parts[parts.count-1] as integer)
)   

fn compareFN v1 v2 =
(
--sort function copy-pasted from MXS help for filename numeric ordering
local d = (numFromName v1) - (numFromName v2)
case of
    (
    (d < 0.): -1
    (d > 0.): 1
    default: 0
    )
)

if dirToProcess != undefined do
(
local filesToProcess = getFiles (dirToProcess + "\\*.png")
--sort files array ito ordered list of frames in case they're collected out-of-order
qsort filesToProcess compareFN

for f in 1 to filesToProcess.count do
(
    --replace the underscore and frame number suffix of foo_####.png with the corresponding memebr of the suffixes array
    local newSuffix = newSuffixes[f]
    local fileToProcess = filesToProcess[f] as string
    local idx = (fileToProcess.count) - 7
    newFileName = replace fileToProcess idx 4 newSuffix --string function
    --debug
    --format "New file name: %\n" newFileName
    if not (copyfile fileToProcess newFileName) do format "Failed copying % to %" filetoProcess newFileName
)

)

(The original script generated the newsuffixes array programatically for thousands of images using data extracted from animation controllers)