Here is what I would like:
Code: Select all
tv_Request "Choose format|png|jpeg"
IF RESULT == 1
tv_SaveMode "png" "b32" "nodither" "255"
tv_AlphaSaveMode NoPreMultiply
background = "off"
ELSE
tv_SaveMode "jpeg"
background = "on"
END
Code: Select all
tv_Request "Choose format|png|jpeg"
IF RESULT == 1
tv_SaveMode "png" "b32" "nodither" "255"
PARSE RESULT format palette dithering colour
export_format = format
tv_AlphaSaveMode NoPreMultiply
background = "off"
ELSE
export_format = "jpg"
background = "on"
END
The final export is done by using tv_clipsavestructure where the export format is set using this variable.
Here is my full script:
Code: Select all
//Export all
PARAM None
//Select colour
tv_listrequest "A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z"
PARSE RESULT number letter
selectedgroup_colour = number
IF selectedgroup_colour == -1
EXIT
ELSE
//Request folder
tv_reqfile "Where to save the files?"
export_path = RESULT
//Request file format
tv_Request "Choose format|png|jpeg"
IF RESULT == 1
tv_SaveMode "png" "b32" "nodither" "255"
PARSE RESULT format palette dithering colour
export_format = format
tv_AlphaSaveMode NoPreMultiply
background = "off"
ELSE
//tv_SaveMode "jpeg"
export_format = "jpg"
background = "on"
END
//Export sequence according to layer colour group
exportColourGroup(selectedgroup_colour, export_format, background)
END
//********************************************************
// Export sequence according to layer colour group
//********************************************************
FUNCTION exportColourGroup(selectedgroup_colour, export_format, background)
layerRun = 1
layerPos = 0
WHILE layerRun
tv_LayerGetID layerPos
layerID = RESULT
IF CMP(layerID,"NONE") == 0
tv_LayerColor GET LayerID
group_colour = RESULT - 1
IF selectedgroup_colour == group_colour
exportSequence(export_format, background)
END
layerPos = layerPos + 1
ELSE
layerRun = 0
END
END
END
//********************************************************
// Exports image sequence using tv_clipsavestructure
// based on selected group and file format
//********************************************************
FUNCTION exportSequence(export_format, background)
gabarit_dossier = "%cn-%ln"
gabarit_fichier = "%ln.%4ii"
tv_clipsavestructure '"'export_path'"' "JSON" "fileformat" export_format "background" background "patternfolder" gabarit_dossier "patternfile" gabarit_fichier "onlyvisiblelayers" "true" "allimages" "true"
END