/* Author: Dai Sato Date: 2009/11/22 ScriptName: MR_Proxy_BakeAll This scripts enable you to change selected objects(with animation) to mr_Proxy objects. And you can change some parameters of selected objects all at once. Caution: If you wanna use property "AnimOffset", you have to apply Skin modifier or other deformation modifier to an object, whose animation is just drived by linked hierarchy. How to use: Just put this script to \3ds max root\ui\macroscripts\. Then, start up 3ds max, and go to "Customize"->"Customize User Interface". You can find this script in a category "DSTRUEVISION". Drag that to any toolbar on which you wanna put this script's button. */ macroScript MR_Proxy_BakeAll category:"DSTRUEVISION" tooltip:"MR_Proxy_BakeAll" buttontext:"MR_Proxy_BakeAll" ( fn my_Mr_ProxyCreate proxyOutDir myStartTime myEndTime checkBoxState = ( myProxyObjects = #() myProxyFilename = #() tempObjects = #() myCount = 1 for o in selection do ( print o.name tempObjects[myCount] = o if (superclassOf o == GeometryClass) then ( print "YES22" tempIndex = findString o.name ":" if( tempIndex != undefined ) then ( tempNew = replace o.name tempIndex 1 "_" myProxyFilename[myCount] = proxyOutDir +"\\"+ tempNew + "_.mib" ) else ( myProxyFilename[myCount] = proxyOutDir + "\\" + o.name + "_.mib" print myProxyFilename ) myProxyObjects[myCount] = mr_Proxy() myProxyObjects[myCount].name = "mrProxy_" + o.name myCount += 1 ) ) for i = 1 to myProxyObjects.count do ( print myProxyObjects[i] if(checkBoxState == true) then myProxyObjects[i].writeProxy tempObjects[i] myProxyFilename[i] replace:true animation:true else myProxyObjects[i].writeProxy tempObjects[i] myProxyFilename[i] replace:true animation:true start:myStartTime end:myEndTime ) ) try (destroydialog MR_Proxy_BakeAll_Roll) catch() rollout MR_Proxy_BakeAll_Roll "MR_Proxy_BakeAll" width:179 height:300 ( label lab1 "Set proxy file output dir" pos:[13,7] width:107 height:13 edittext uiExportEdt text:"c:\\temp\\" pos:[8,24] width:128 height:16 button uiExportLookDirBtn "Dir" pos:[142,15] width:27 height:27 label lab2 "Use current time range" pos:[8,50] width:107 height:13 checkbox useCurrentTimeRange_checkBox "" pos:[120,50] width:24 height:15 triState:1 spinner starttime "start frames:" pos:[24,65] width:147 height:16 range:[-8000,8000,0] type:#integer scale:1 spinner endTime "end frames:" pos:[24,85] width:147 height:16 range:[-8000,8000,0] type:#integer scale:1 button btnBakeAll "Bake All" pos:[6,105] width:80 height:22 ------------------------------------------------------------------------------------------------------------------------------------------------------------ progressBar pb12 "ProgressBar" pos:[6,130] width:168 height:2 enabled:true value:100 color:(color 255 255 255) button btnProxyFilePathChange "Proxy File Path Change" pos:[6,140] width:168 height:22 enabled:true progressBar pb13 "ProgressBar" pos:[6,170] width:168 height:2 enabled:true value:100 color:(color 255 255 255) spinner offsetFrame_spin "offset frames:" pos:[23,180] width:147 height:16 range:[-8000,8000,0] type:#integer scale:1 button btnLT "Change anim offset" pos:[6,200] width:168 height:22 -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- button btn9 "Change viewport verts" pos:[6,268] width:162 height:19 progressBar pb5 "ProgressBar" pos:[6,229] width:168 height:2 enabled:true value:100 color:(color 255 255 255) spinner spn7 "view verts" pos:[19,242] width:147 height:16 range:[-8000,8000,128] type:#integer scale:1 on uiExportLookDirBtn pressed do ( local curpath = uiExportEdt.text local newPath = getSavePath initialDir:(curpath) caption:"Select the path where the proxy files will be saved" if newPath != undefined then ( uiExportEdt.text = newpath ) ) on btnBakeAll pressed do ( tempText = uiExportEdt.text undo on ( my_Mr_ProxyCreate tempText startTime.value endTime.value useCurrentTimeRange_checkBox.checked ) ) on btnProxyFilePathChange pressed do ( theCachefile=(getSavePath) caption:" ** POINT TO YOUR LOCATION ** ex. test_####.mib" tempSelection = selection if( theCachefile != undefined and tempSelection.count != 0) then ( for o in selection do ( tempFlag = false tempBuf = filterString o.name "_ . - :" for i = 1 to tempBuf.count do ( if(tempBuf[i] == "mrProxy") then ( tempFlag = true exit ) else tempFlag = false print tempFlag ) if (tempFlag == true ) then ( print o.name tempBuf2 = substituteString o.name "mrProxy_" "" print tempBuf2 tempIndex = findString tempBuf2 ":" if( tempIndex != undefined ) then ( tempNew = replace tempBuf2 tempIndex 1 "_" o.fileName = theCachefile + "\\" + tempNew + "_.mib" ) else ( o.fileName = theCachefile + "\\" + tempBuf2 + "_.mib" ) ) ) ) ) on offsetFrame_spin changed val do ( tempOffset = offsetFrame_spin.value for o in selection do ( tempFlag = false tempBuf = filterString o.name "_ . - :" for i = 1 to tempBuf.count do ( if(tempBuf[i] == "mrProxy") then ( tempFlag = true exit ) else tempFlag = false print tempFlag ) if (tempFlag == true ) then ( o.AnimOffset = tempOffset ) ) ) on btnLT pressed do ( tempOffset = offsetFrame_spin.value for o in selection do ( tempFlag = false tempBuf = filterString o.name "_ . - :" for i = 1 to tempBuf.count do ( if(tempBuf[i] == "mrProxy") then ( tempFlag = true exit ) else tempFlag = false print tempFlag ) if (tempFlag == true ) then ( o.AnimOffset = tempOffset ) ) ) on spn7 changed val do ( ) on btn9 pressed do ( tmpVal = spn7.value tmpSel = selection for j=1 to tmpSel.count do ( tempFlag = false tempBuf = filterString tmpSel[j].name "_ . - :" for i = 1 to tempBuf.count do ( if(tempBuf[i] == "mrProxy") then ( tempFlag = true exit ) else tempFlag = false print tempFlag ) if (tempFlag == true ) then ( tmpSel[j].Points_to_display = tmpVal ) ) ) ) createDialog MR_Proxy_BakeAll_Roll bgColor:[0,0,0] lockHeight:false lockWidth:true \ style:#(#style_titlebar, #style_border, #style_sysmenu, #style_resizing) )