View Full Version : Anyone has a script to share which would show time in seconds the way as is polycount
02-09-2009, 06:08 PM
I thought that this could be rather useful feature to more people so maybe there is a chance that someone already has it and I don't have to go through all those scripts and figure out how to maxscript this.
What I'm looking for is a script, that would display current time in minutes, seconds and miliseconds in viewport in a similar way as polycount stats work.
It would be great if someone has even something similar that would be easy for me to modify for my needs :D
02-09-2009, 06:26 PM
going with some of the stuff outlined here:
From the other thread, a function to draw up some text at a specified location (supports multiple lines)
fn drawText str pos:[16,16] col:(color 0 0 0) lineSpacing:-4 = (
-- split up into individual lines
local lines = filterString str "\n"
local lineHeight = (gw.getTextExtent "`j").y
local strExtent = gw.getTextExtent str
local verticalOffset = 0
for str in lines do (
-- draw the text
gw.setTransform (Matrix3 1)
gw.wText [pos.x,pos.y + verticalOffset,0] str color:col
strRect = (Box2 (pos.x + 1) (pos.y - lineHeight) strExtent.x (lineHeight + 2))
-- increment the offset
verticalOffset += lineHeight + lineSpacing
Draw the time on viewport redraw:
fn drawTime = ( drawText localtime pos:[16,128] col:yellow )
02-09-2009, 06:34 PM
Thanks, that will help me much. You know, i'm the kind of a scripter who when needs a script has to dig through lot of samples, through maxscript help file for almost every line of code and it takes ages to make something :D
Now I have noticed.... stupid me, i didn't mean that kind of time, rather time on which time slider is. I think that should be rather easy to calculate from current timeslider frame and framerate in scene.
02-09-2009, 07:36 PM
just replace the 'localtime' with '(slidertime as string)' - should do the trick if you're already working with time settings set to natural time.
though.. why show that in the viewport, if you can already see that on the timeslider itself? ;)
02-09-2009, 07:53 PM
I need this because it seems to me that non of the 4 options for timeslider display time in format like this: mintues:seconds:milliseconds. But especially I need this for easy navigation to specific frame (so timeslider in frames) and than I need to read what time is this in seconds:milliseconds. I know it's not a big deal to do the math in head, but if you need more of this, it can become boring not to mention possible different frame rate which you would have to check in time configuration dialog.
02-09-2009, 08:27 PM
true, there is no minute:second:millisecond display. Note that I think you typically won't get millisecond-accurate results anyway; there are always 4800 'ticks' per second.. it doesn't divide too nicely to 1/1000ths of a second :)
Anyway - sliderTime plus a bit of math it is, then
02-09-2009, 08:27 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
vBulletin v3.0.5, Copyright ©2000-2014, Jelsoft Enterprises Ltd.