Hi guys
I have an issue to get the currentTime in real time while playing an animation in a spinner.
I can easily get the CurrentTime in a spinner like this:
spn_CT.value = currentTime
but this way it's not in real time while playing an animation.
If anyone have an idea, thanks a lot :)
By
Comments (18)
Comment policy
What I want is to get every frame number you go trought in the spinner while playing an animation.
for exemple, if you have an animation range of 25 frames that begin at frame 0, I want my spinner to show 0,1,2,3,4,5,6....23,24,25 while playing the animation, like the timeslider.
.
This will prints the curent frame number as it is shown in the time slider:
Or you can use this:
Thanks for your help.
Unfortunately, this is not what I want, and barigazi give me a great solution ^^
I love to connect spinner and timeslider like this
try(destroyDialog ::testRoll)catch()
rollout testRoll "• • •"
(
spinner spn_CT "" pos:[5,5] fieldwidth:80 type:#integer
timer timeTick interval:30
on spn_CT changed val do
(
if (case1 = val < animationRange.start.frame) or (case2 = val > animationRange.end.frame) then
(
val = if case1 then animationRange.start.frame else animationRange.end.frame
)
else slidertime = val
)
on timeTick tick do
(
if spn_CT.value != sliderTime do spn_CT.value = sliderTime
)
on testRoll open do timeTick.active = on
on testRoll close do timeTick.active = off
)
createDialog testRoll 100 25 style:#(#style_titlebar, #style_sysmenu, #style_toolwindow)
Thanks a lot barigazy, exactly what I need :)
If you need advanced solution see this tool and check out "Tune" tab.
You can find playback controls
Thanks I'm gonna check this.
I didn't know the timer UI, but if I try to understand what you did, you have connected the value of the spinner to the timer, so the spinner change its value every 30 miliseconds according to the sliderTime ?
Yup :)
I really need to thank you again, the timer is really useful. You just changed the whole way i'll script with mxs ^^
My pleasure.
BTW using callbacks are good way to monitor something but only if you know to work with them. But timer is very easy to use and control, also when you play with .net stuffs then .net timer will save your life :)
Cheers!
Ok good to know :)
But for now I really don't like to use callback and .net since I don't understand them ^^ (and I read that .net has been badly integrated in max...)
Otherwise, any idea how to open the time configuration dialog via MXS ?
Who told you that .net is bad implemented in max?
Maybe python but .net is long time here and you can do awesome "magic" stuffs with it.
--open the time configuration dialog
max time config
No one in particular, just read it sometimes.
But I know you can do some very nice stuff with, I already give it a try, but it really hurt my brain :p
Since I don't have any good knowledge on programing, for know I prefered to focus on mxs.
I will also begin to learn C, but mostly I'm a 3D artist so I prefer to do 3D stuff than scripting ^^
thanks for the help anyway :)
Hi barigazi, always here to help me :)
Thanks but it's not working (actually it's the way I defined the spinner).
Maybe you didn't understand what I mean, so i'll try to explain a bit better.
for example, if you use this:
you'll see in the listener that you print every frame while playing the animation, and this is what I want in my spinner.
=> to delete the callback if you try it :)
Are you vant to unregisterTimeCallback if you spinner value is greater then or lower then animation range?
If Yes then
on spn_CT changed val do
(
if val < animationRange.start.frame or val > animationRange.end.frame then
(
unregisterTimeCallback time_p
)
else slidertime = val
)
spn_CT.value = slidertime
If you vant to get slider time in seconds then try like this
slidertime.frame/framerate