ScriptSpot

Forum topic · General Scripting

Attach a dialog to the Timeslider possible?

By erazorhead · 2008-05-17

Description

Hi
Does anyone know if is it possible to attach a Dialog to the Timeslider so that it follows the Timeslider when I scurb it?

thank you!

Comments (4)

rodimus111 · 2011-06-07

Have you found a way to get the widht of the trackbar?

decapitator · 2008-05-22

By the looks of it not with just maxscript, It can be done with the SDK though if you want to mess around you will need to get the position from the hwnd of the slider

for hwnd in (windows.getChildrenHWND #max) do if hwnd[4] == "TimeSlider" do print hwnd[1]

that prints the hwnd of the "TimeSlider" you also have the "<", "TimeSliderTumb" and ">" representing the buttons on the timeslider..

For what I can see is that just maxscript isnt able to read the positions from those windows so thats why it wouldnt work with that but I can be wrong..

And you could allways hardcode it (if max is allways the same size/position (like maximized)) to the desktop resolution but thats not dynamic at all (just get percentage from 'animationRange.start/end')

erazorhead · 2008-05-22

hey thanks for the reply!
Yeah i figured it wouldnt be that easy;)
I also got told you could update the dialog to mouseposition whenever the time was changed, and in a crude way that works too. Ill post an update if i get it workin.
Thank you!

decapitator · 2008-05-27

Hey again, I managed to get it quite well with just maxscript (found some functions) its now based on the maxwindow size and maxwindow position so not the timeSlider position itself but it works quite allright.

rollout tSlider "timeSlider++" width:120 height:0
(
	fn setPos =
	(
		al = (animationRange.end - animationRange.start).frame --> animation length
		ap = (abs (animationRange.start - sliderTime).frame) --> animation position
		mww = ((getMAXWindowSize())[1] - (GetDialogSize tSlider)[1]) --> max window width - dialog width
		setDialogPos tSlider [((ap / al) * mww) + (getMAXWindowPos())[1],((getMAXWindowSize())[2] - 93) + (getMAXWindowPos())[2]] --set dialog position [% position + max x pos, max window size - 100 + max window height]
	)
	on tSlider open do 
	(
		setPos() --move the dialog
		tmCb = registerTimeCallback setPos
	)
	on tSlider close do unRegisterTimeCallback tmCb
)
createDialog tSlider

Just copy/paste it in a new script and run it it will create a dialog without anything on it just its titlebar..
Check createDialog style's to remove that and replace it with a dialog or w/e