I try to optimize part of code, that currently export frame by frame on each visible layer. But i've got some trouble with loop 'FOR image = 1 TO 50'
Code: Select all
// COLLECT DATA FROM ARGS
tv_ReadUserString VfxConfig ExportPath
exportPath = '"'result'"'
tv_ReadUserString VfxConfig PlayblastPath
playblastPath = '"'result'"'
tv_ReadUserString VfxConfig Episode
episodeNum = result
tv_ReadUserString VfxConfig Sequence
sequenceNum = result
tv_ReadUserString VfxConfig Shot
shotNum = result
tv_ReadUserString VfxConfig Version
versionNum = result
// COLLECT DATA FROM TVPAINT FILE
tv_FirstImage
startingFrame = result
tv_LastImage
LastImage = result
tv_Background "NONE"
tv_SaveMode "PNG" "b32"
tv_AlphaSaveMode NoPreMultiply
layerRun = 1
layerCount = 0
WHILE layerRun == 1
tv_LayerGetID layerCount
layerID = result
IF (CMP(layerID,"NONE") != 0)
layerRun = 0
ELSE
tv_LayerSet layerID
tv_LayerInfo
PARSE result layerDisplay layerPosition layerOpacity layerName layerType layerStart layerEnd layerPrelighttable layerPostlighttable
IF (CMP(layerDisplay,"OFF") == 0) && (CMP(layerName,"playblast") == 0)
tv_layerpostbehavior layerID
endBehavior=result
IF (CMP(endBehavior, "NONE") == 1)
endingFrame=imageEnd
ELSE
endingFrame=LastImage
END
lyrExportPath = CONCAT(exportPath,layerName)
lyrExportPathFormat = '"'lyrExportPath'"'
tv_WriteTextFile "mkdir" lyrExportPathFormat
FOR CurrentImage = startingFrame TO endingFrame
currentReelImage = CurrentImage+1000
tv_layerImage CurrentImage
layerFileName = episodeNum"_"sequenceNum"_"shotNum"-"layerName"_"currentReelImage".png"
exportFullPath = CONCAT(lyrExportPathFormat,layerFileName)
exportFullPathFormat = '"'exportFullPath'"'
tv_LockDisplay "Exporting... (layer "layerName", image "currentReelImage" )"
tv_saveimage exportFullPathFormat
tv_UnLockDisplay
END
END
layerCount = layerCount + 1
END
END
Code: Select all
FOR CurrentImage = startingFrame TO endingFrame
regards