Notifications
Clear all

[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)

8 Replies

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:

  1. Create your own preview tool (there is code in this forum and an example in the MXS Help)
  2. 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\"
 )
  1. 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

1 Reply
(@polytools3d)
Joined: 10 months ago

Posts: 0

Well, as the filename is always the same “_scene.avi”, I guess you can rename it.

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"
	
 )

thanks all for the help.
I ended settign the preview folder as needed and up using hiddnedoscommand() to rename the output