Search code examples
animation3dsmaxmaxscript

Maxscript Spinner


I am a newbie to Maxscript, I am wondering if there is a way to change the value of the range of a spinner?

spinner ScrollToFrame "Select Frame" type:#integer range:[startFrame, totalFrames, 0]

fn getFrameInfo = (
    totalFrames = animationrange.end
    startFrame = animationrange.start
)

button updateFrames "Update Frames" align:#left pos:[120, 15]
on updateFrames pressed do (
    startFrame = animationrange.start
    totalFrames = animationrange.end
-- Code that I thought worked
ScrollToFrame.range:[startFrame, totalFrames, 0]
)

Solution

  • The : keyword assignment works on control creation, when accessing the created control you have to use regular = assignment:

    try destroyDialog test catch()
    rollout test ""
    (
        fn getFrameInfo =
            [animationrange.start, animationrange.end, animationrange.start]
    
        spinner ScrollToFrame "Select Frame" type:#integer range:(getFrameInfo())
        button updateFrames "Update Frames"
    
        on updateFrames pressed do (
            ScrollToFrame.range = getFrameInfo()
        )
    )
    createDialog test