macroScript TackCrawler category:"VigTools" toolTip:"TrackCrawler v1.0" buttonText:"TCrawl" ( (-- Rollouts Start rollout MainUI "Track Crawler v1.0" width:232 height:425 ( -- MainUI -- Local defs local bipCheck = getFiles (maxFilePath + "Bip\\*.bip") local bipPaths = getFiles (maxFilePath + "BipClips\\*.bip") local bipFiles = for i = 1 to bipPaths.count collect getFileNameFile bipPaths[i] local headPaths = getFiles (maxFilePath + "HeadAnims\\*.xaf") local headFiles = for i = 1 to headPaths.count collect getfilenamefile headPaths[i] -- Main UI defs edittext e_frmbuff "" pos:[168,48] width:48 height:16 edittext e_AudioSFrm "" pos:[168,24] width:48 height:16 listbox listsel "" pos:[16,96] width:200 height:21 items:bipfiles button btn_FBSeqTracks "Seq Tracks" pos:[96,48] width:64 height:16 toolTip:"Sequences each track and adds the specified frame buffer" button btn_setTimeAll "Set Time to All" pos:[8,392] width:216 height:24 toolTip:"Sets the active time segment to include all tracks" button btn_Refresh "Refresh" pos:[16,48] width:56 height:16 toolTip:"Refreshes Track Crawler, use to update the list" button btn_STXopen "ProSound" pos:[16,24] width:56 height:16 toolTip:"Opens ProSound" GroupBox grp12 "Anim Clips" pos:[8,80] width:216 height:304 GroupBox grp1 "Sequence Tracks" pos:[88,8] width:136 height:64 label lbl2 "Start Seq On" pos:[96,24] width:64 height:16 label lbl10 "+" pos:[162,48] width:8 height:16 GroupBox grp7 "Launcher" pos:[8,8] width:72 height:64 -- Functions fn f_max a b = ( if (a > b) then a else b ) fn f_check a = ( if (a-1) > 1 then (a-1) else (1) ) fn dropsfx str = (--remove the _sfx suffix return substring str 1 (str.count - 4) ) fn RefreshUI = (--Refreshes the listbox (listsel) local StxN = for i=1 to prosound.numtracks() collect getfilenamefile (prosound.name(i)) local listItems = #() for j = 1 to StxN.count do ( listItems[j] = dropsfx(StxN[j]) ) listsel.items = listItems ) fn ProSoundactive = (--Activate ProSound if (prosound.isactive()) == false then ( prosound.close() prosound.open() ) ) -- More Local defs (need to be set after functions but before buttons, don't move) local StxN = for i=1 to prosound.numtracks() collect getfilenamefile (prosound.name(i)) local listItems = #() -- Buttons on MainUI open do (--Open MainUI RefreshUI() ) on btn_Refresh pressed do ( RefreshUI() ) on listsel selected idx do (-- Set Active Time Segment to Clicked Track curClipName = dropsfx (getFileNameFile ( (prosound.name(idx)) ) ) curHeadStart = prosound.start(idx) curHeadEnd = prosound.end(idx) animationRange = interval curHeadStart curHeadEnd MaxOps.TrackBar.redraw() listsel.enabled = true ) on btn_FBSeqTracks pressed do (-- Sequence Tracks local StxL = for i=1 to prosound.numtracks() collect prosound.filelength(i) as integer /320 local StxE = for i=1 to prosound.numtracks() collect prosound.end(i) as integer /320 local shiftval = 0 for i = 1 to stxL.count do ( prosound.setstart i 0 prosound.setend i StxL[i] ) for i = 1 to StxL.count do ( local frmbuff = e_frmbuff.text as integer local b = f_check (StxE[i]) local AudioStart = (e_AudioSFrm.text as integer) prosound.shift i (shiftval + AudioStart) shiftval += StxL[i] + frmbuff ) RefreshUI() ) on btn_setTimeAll pressed do (-- Set Active Time Segment to All local StxS = for i=1 to prosound.numtracks() collect prosound.start(i) as integer /320 local StxE = for i=1 to prosound.numtracks() collect prosound.end(i) as integer /320 local start = amin StxS local end = amax StxE animationRange = interval start end ) on btn_STXopen pressed do (--Launch ProSound prosound.close() prosound.open() ) ) rollout SoundErrorRollout "Missing Sound Files" width:192 height:120 (-- Error message that prompts the user to launch ProSound and load sounds button btn1 "Launch prosound" pos:[24,64] width:136 height:40 toolTip:"Launches prosound" label lbl19 " Zero sound files loaded! \n Please launch prosound \n and load sound files." pos:[32,8] width:128 height:40 on btn1 pressed do (--Launch prosound DestroyDialog SoundErrorRollout prosound.Close() prosound.Open() ) ) )-- Rollouts End (-- Launch Checks if frameRate != 15 then ( if querybox "FPS not set to 15, set it to 15?" beep:true then ( framerate = 15 if (prosound.numtracks() != 0) == true then ( CreateDialog MainUI ) else ( createdialog SoundErrorRollout ) ) else ( createdialog MainUI ) ) else ( if (prosound.numtracks() != 0) == true then (--Open Main UI CreateDialog MainUI ) else ( createdialog SoundErrorRollout ) ) ) )