[Closed] Timeslider controlled with the Mouse wheel
Hi, few weeks ago I noticed one interesting behaviour of maxs spinners. You can change their
s value scrolling middle mouse button but only once, after first roll spinner lose focus. Then I found this thread and decided to use this behaviour for changing timeslider position. Few hours and here what I have got for now.
How to use:
Save this script in scripts\startup folder.
Go to Customize User Inteface and drag MiddleMode from Mir category to Your toolbar.
Activate MiddleMode.
After that whenever you will hold Control button You will go in MiddleMode and scrolling mouse middle button will move timeslider.
macroScript MiddleMode
category:"Mir"
Icon:#("VCRControls",11)
(
global MidMouse, fnMidActiv, fnMidMode, fnGrRange
CtrlState = false
fn fnMidMode Text = (
gw.wText [20,40,10] Text color:green
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
fn fnGrRange = (
case slidertime of (
(animationRange.start) : animationRange = interval (animationRange.start -= 1) animationRange.end
(animationRange.end) : animationRange = interval animationRange.start (animationRange.end += 1)
)
)
fn fnMidActiv = (
fnMidMode "Middle Mode: ON"
setFocus MidMouse.frame_spn
)
rollout MidMouse "Mir"
(
spinner frame_spn "" range:[-999999, 9999999, slidertime] width:90 type:#integer
timer tim interval:10 active:true
on frame_spn changed val do (
fnGrRange ()
slidertime = MidMouse.frame_spn.value
MidMouse.frame_spn.value = slidertime )
on tim tick do (
if keyboard.controlPressed == true and CtrlState == false then (
MidMouse.frame_spn.value = slidertime
registerRedrawViewsCallback fnMidActiv
fnMidActiv ()
CtrlState = true )
if keyboard.controlPressed == false and CtrlState == true then (
gw.clearScreen (box2 5 20 100 20)
gw.enlargeUpdateRect #whole
gw.updateScreen()
unregisterRedrawViewsCallback fnMidActiv
try ( toolmode.commandmode = toolmode.commandmode) catch ()
CtrlState =false )
)
)
on isChecked do MidMouse.open
on execute do (
destroydialog MidMouse
createdialog MidMouse 200 100 5000 5000
try ( toolmode.commandmode = toolmode.commandmode) catch ()
)
on closeDialogs do (
destroydialog MidMouse
MidMouse.tim.active = false
try ( toolmode.commandmode = toolmode.commandmode) catch ()
)
)
Awesome, I’ll take it for a spin (pun intended) in a minute. Will it work in Max9 or is it 2008-exclusive?
Cheers!
It supports max 8, max 9, max 2008 and maybe max 7 and max 6. Didnt test it in them.
Pretty impressive! I REALLY like the function you made to allow the timeslider to expand beyond it’s set range, that’ll sure come in handy!
Do you think it would be possible to implement a function similar to Ofer’s where holding a different modifier button would allow you to scroll in 10f increments?
Cheers!
Sure.
macroScript MiddleMode
category:"Mir"
Icon:#("VCRControls",11)
(
global MidMouse, fnMidActiv, fnMidMode, fnGrRange
CtrlState = false
fn fnMidMode Text = (
gw.wText [20,40,10] Text color:green
gw.enlargeUpdateRect #whole
gw.updateScreen()
)
fn fnGrRange = (
case slidertime of (
(animationRange.start) : animationRange = interval (animationRange.start -= 1) animationRange.end
(animationRange.end) : animationRange = interval animationRange.start (animationRange.end += 1)
)
)
fn fnMidActiv = (
fnMidMode "Middle Mode: ON"
setFocus MidMouse.frame_spn
)
rollout MidMouse "Mir"
(
spinner frame_spn "" range:[-999999, 9999999, slidertime] width:90 type:#integer
timer tim interval:10 active:true
on frame_spn changed val do (
temp = slidertime
fnGrRange ()
slidertime = MidMouse.frame_spn.value
MidMouse.frame_spn.value = slidertime
if keyboard.shiftPressed == true do (
if slidertime > temp do slidertime = MidMouse.frame_spn.value + 9
if slidertime < temp do slidertime = MidMouse.frame_spn.value - 9
MidMouse.frame_spn.value = slidertime
)
)
on tim tick do (
if keyboard.controlPressed == true and CtrlState == false then (
MidMouse.frame_spn.value = slidertime
registerRedrawViewsCallback fnMidActiv
fnMidActiv ()
CtrlState = true )
if keyboard.controlPressed == false and CtrlState == true then (
gw.clearScreen (box2 5 20 100 20)
gw.enlargeUpdateRect #whole
gw.updateScreen()
unregisterRedrawViewsCallback fnMidActiv
try ( toolmode.commandmode = toolmode.commandmode) catch ()
CtrlState =false )
)
)
on isChecked do MidMouse.open
on execute do (
destroydialog MidMouse
createdialog MidMouse 200 100 5000 5000
try ( toolmode.commandmode = toolmode.commandmode) catch ()
)
on closeDialogs do (
destroydialog MidMouse
MidMouse.tim.active = false
try ( toolmode.commandmode = toolmode.commandmode) catch ()
)
)