[Closed] Creating a preview (mov) based on scene name ?
Hey guys, I’m currently trying to write a small script to create a quicktime preview based on the scene’s filename but am coming up against a brick wall :banghead:
I want it so I can open a scene, name the scene accordingly (eg. EP1_SH_0010.max), and then hit the preview button and it will write the file to a certain directory with the same name as the file (eg. EP1_SH_0010.mov). Then i want to be able to rename that scene (EP1_SH_0020.max), set up my camera’s for the next shot, hit the same button again and get another preview using the new file name (EP1_SH_0020.mov)
My current code is as follows
previewName = (getDir #preview) + "\\" + getFilenameFile maxfilename + ".mov"
createPreview outputAVI:false percentSize:50 dspFrameNums:true filename:previewName
Any idea’s on where I’m going wrong with this, is this possible in max ? I’m usually a maya user, and am not a scripter, so I’ve two big things working against me here haha. Any help would be greatly appreciated :keenly:
As far as I know you can’t create mov in max.
But you can try create sequence and convert after, check this…
http://forums.cgsociety.org/showthread.php?f=98&t=459963&highlight=quicktime
thanks for checking in SECC0!! You can create mov’s through the “Create Preview Animation” tool (shift + v), so i take it you mean i can’t access that through max script ? Thats a pity , but thanks for the possible alternate solution! i’ll start digging through that thread now and see what i can come up with
You can create mov’s through the “Create Preview Animation”
Hmm didnt know about this… In my max 2012 there is no mov. Also in 2012 there is no function createPreview
When I open 2014 I saw it.
I didnt use createPreview function and maybe I’m wrong but It looks like when you set outputAVI:false you can’t set output via script, when I run this it always open output window.
You can try to press all needed buttons via UiAccessor but it’s a lillte bit tricky.
Try this function
NOTE: I tested this in max 2014 /Nitrous driver
The UIAccessor intefrace just pressed for you buttons and do other interface stuff wwhich can be not available in maxscript.
But there are a problem – I dunno how to catch Quicktime Settings window. This window popup when you press save. Therefore I cant tell Uiaccessor which button it must press.
You must press OK manually.
PS. Please check this text ,
http://c2n.me/3qCfr5T
I can’t because my vers of window is russian. But Im afraid it will be not changes anything in this case.
(
local pathtoSave = "c:\dropsx3_.mov"
WM_SETREDRAW=0xB
CB_SETCURSEL = 0x14e
CB_SHOWDROPDOWN = 0x014F
WM_LBUTTONDOWN = 0x0201
WM_LBUTTONUP = 0x202
WM_COMMAND = 0x0111
EN_CHANGE = 0x0300
-- EN_KILLFOCUS = 0x0200
WM_KILLFOCUS = 0x0008
BM_SETCHECK = 241 -- checkbutton toggle message ID
WM_SETFOCUS = 0x07
WM_ENABLE = 0x0A
WM_PASTE = 0x0302 --0x000c
dialogMonitorOPS.UnRegisterNotification id:#test -- remove any old instance
DialogMonitorOPS.enabled = true -- enable the monitor
DialogMonitorOPS.Interactive = off
DialogMonitorOPS.ShowNotification()
fn FneditValueSpn hwnd val =
(
WM_CHAR = 0x0102
VK_RETURN = 0x000D
uiaccessor.setwindowtext hwnd val
windows.sendMessage hwnd WM_CHAR VK_RETURN 0 -- press ENTER key
)
fn test =
(
hwnd = DialogMonitorOPS.GetWindowHandle() -- check the dialog that popped up
hwnd_title = UIAccessor.GetWindowText hwnd
if (hwnd_title == "Create Animated Sequence File...") then
(
controls = windows.getChildrenHWND hwnd -- get all controls for this dialog
hcombo = controls[11][1]
uiaccessor.setwindowtext hcombo pathtoSave
UIAccessor.PressDefaultButton()-- hwnd "Save" --Create
)
if (hwnd_title == "File Exists") then
(
controls = windows.getChildrenHWND hwnd -- get all controls for this dialog
UIAccessor.SendMessage controls[4][1] BM_SETCHECK 1 0
-- UIAccessor.PressButtonByName hwnd "Yes"
UIAccessor.PressDefaultButton()
)
if (hwnd_title == "Standart Video Compression Settings") then -----THERE MUS BE QUICKTIME COMPRESSION SETTINGS TITLE TEXT
(
controls = windows.getChildrenHWND hwnd -- get all controls for this dialog
UIAccessor.PressDefaultButton()
-- UIAccessor.PressButtonByName hwnd "Yes"
)
if (hwnd_title == "Make Preview") then try
(
controls = windows.getChildrenHWND hwnd -- get all controls for this dialog
hcombo = controls[34][1]
uiaccessor.SendMessage hcombo WM_ENABLE 0 0
-- SLEEP 1 --DEBUG
UIAccessor.PressButtonByName hwnd "Create" --Create
)
catch (format "ERROR -%
" (getCurrentException()))
true
)
dialogMonitorOPS.RegisterNotification test id:#test -- register the monitor
max preview
dialogMonitorOPS.UnRegisterNotification id:#test -- remove the monitor
dialogMonitorOps.enabled = false -- disable the monitor
)
The only way to utilize createPreview keyword arguments ( like percentSize:50) is to output an AVI. Max script will not talk to QuickTime directly.
I was asked to make MOV files but I pointed out that Quicktime can open AVI just as easily.
If MOV is an absolute requirement, you will need to convert it via a command line utility (like ffmpeg) plus DosCommand or HiddenDosCommand