[Closed] createPreview() controlling the output
I searched and saw some threads, but no answer to my question.
can I control the output file path of the preview? it seems to just fire off _scene.avi into the project’s preview folder…I’d much rather name it and place it how I wish. (Max 2013)
Unfortunately no.
Also you can not cancel preview if you use that function.
I just use UIAccessor.
There doesn’t seem to be any property nor a method to set the output filename in the SDK. However, there are a few options:
- Create your own preview tool (there is code in this forum and an example in the MXS Help)
- You can temporary change the output folder of the preview (not the filename)
(
fn CreateViewportPreview folder: =
(
if folder == unsupplied do return createPreview()
currentFolder = pathConfig.GetDir #preview
pathConfig.SetDir #preview folder
createPreview()
pathConfig.SetDir #preview currentFolder
)
CreateViewportPreview folder:@"C: emp\"
)
- You can fire up a dialog to save the preview as you want (since Max 2013)
(
createPreview outputAVI:false
)
I would personally go with a custom tool. The preview tool isn’t one of the Max gems anyway.
actually the folder name is a minor issue compared to being stuck with “_scene.avi” as a fielname
Why not monitoring when the preview is done and the file is saved and then change the file name and destination?
See if this works:
(
fn CreateViewportPreview filename: =
(
if filename == unsupplied do return createPreview()
currentFolder = pathConfig.GetDir #preview
outputFolder = getFilenamePath filename
outputFileName = getFilenameFile filename
pathConfig.SetDir #preview outputFolder
createPreview outputAVI:true
pathConfig.SetDir #preview currentFolder
sleep 1
renameFile (outputFolder+"_scene.avi") (outputFolder+outputFileName+".avi")
)
CreateViewportPreview filename:@"C: emp\my_preview_file.avi"
)
i have made renaming using .net systemfilewatcher
https://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher(v=vs.110).aspx
thanks all for the help.
I ended settign the preview folder as needed and up using hiddnedoscommand() to rename the output