macroScript TimingBar
	category:"!animation tools"
	toolTip:""
	icon:#("Maxscript",1)
(
	--naming convention: camera_name = (### ,-=. ### ###), example "01 = 100 - 300"
	-- create array of cameras

	---names START
	global names =#()
	global a
	global q = #()
	global nm = #()
	---names END
	---
	
		Rollout SetAnimationTime "Set Time"
		(
			listbox objectToSelect "Cameras:" items:(for o in names collect (o)) selection:0 height:24
			button buttonprev "<<" width:40 height:40 across:3
			checkbutton buttonok "PLAY" width:70 height:40
			button buttonnext ">>" width:40 height:40
			on buttonok changed playState do
			(
				if playState == true do
				(
				buttonok.text = "STOP"
				playAnimation ()
				)
				if playState == false do
				(
				buttonok.text = "PLAY"
				stopAnimation ()
				)
			)
			on objectToSelect doubleClicked targ do
			(
				a=targ
				q=filterString names[a] ":,-,=,<,>,(,)"
				animationRange = interval ((execute q[1]) as integer) ((execute q[2]) as integer)
				stopAnimation()
			)
			on buttonnext pressed do
			(
				stopAnimation ()
				if (objectToSelect.selection != 0) then
				(
					if (objectToSelect.selection < objectToSelect.items.count) then
					(
					objectToSelect.selection = objectToSelect.selection +1
					a=(objectToSelect.selection)
					)
					else if (objectToSelect.selection == objectToSelect.items.count) then 
					(
						a = 1
						objectToSelect.selection = 1
					)
				)
				else
				(
					objectToSelect.selection = 1
					a=(objectToSelect.selection)
				)
				q=filterString names[a] ":,-,=,<,>,(,)"
				animationRange = interval ((execute q[1]) as integer) ((execute q[2]) as integer)
			)
			on buttonprev pressed do
			(
				stopAnimation ()
				if (objectToSelect.selection != 0) then
				(
					if (objectToSelect.selection !=1) then
					(
						objectToSelect.selection = objectToSelect.selection - 1
						a = objectToSelect.selection
					)
					else 
					(
						objectToSelect.selection = objectToSelect.items.count
						a = objectToSelect.items.count
					)
				)
				else 
				(
					objectToSelect.selection = objectToSelect.items.count
					a=(objectToSelect.selection)
				)
				q=filterString names[a] ":,-,=,<,>,(,)"
				animationRange = interval ((execute q[1]) as integer) ((execute q[2]) as integer)
			)
		)
		rollout seltxt "Selection"
		(	
			label txtHelp "Select text to collect timing"
			button colobj "collect" width:100 height:30
			on colobj pressed do
			(
				txt = selection as array
				num1 = txt.count
				for i = 1 to num1 do
				(
				nm[i] = filterstring (txt[i].baseObject.Text) "\n"
				tst = filterString nm[i][1] ":,-,=,<,>,(,)"
				if (tst.count<= 2) do
				(
				deleteitem nm[i] 1
				)
				)
				for l = 1 to num1 do
				(
				names = names + nm[l]
				)
				destroyDialog seltxt
				CreateDialog SetAnimationTime 200 400 400 300
			)
		)
	createDialog seltxt 160 60
)

