Inside Sabertooth
Learn how Sabertooth uses 3ds Max to create 3D interactive projects, including HBO Go’s Game of Thrones interactive experience
  • 1/3
You are here: Forum Home / Autodesk® Maya® / Python / Convert time values to and from numbers and strings?
  RSS 2.0 ATOM  

Convert time values to and from numbers and strings?
Rate this thread
 
62676
 
Permlink of this thread  
avatar
  • KenjiQ
  • Posted: 08 December 2011 07:44 PM
  • Total Posts: 30
  • Joined: 20 February 2009 06:04 AM

When obtaining values from the system, such as current framerate, the value is often a string such as ‘film’.

eg.

mc.currentUnit(q=Truetime=True)
# Result: film #

Is there a good way of converting from the string values to numeric, without generating my own lookup table?

Conversely I’d also like to be able to go from a string value to time, such as ‘1000millisec’, is there any way of doing that other than the current (dodgy) way I’ve found?

mc.currentTime('1000millisec'update=False)

any help much appreciated



Replies: 0
avatar
  • ldunham1
  • Posted: 08 December 2011 10:39 PM

i cant seem to find anything for it actually, which is surprising.

This seemed to have a nice idea, although in mel and working with linear units rather than time, same principle applies.

http://xyz2.net/mel/mel.102.htm



Lee Dunham | Character TD
ldunham.blogspot.com

Replies: 0
avatar
  • KenjiQ
  • Posted: 10 December 2011 03:36 PM

Thanks for the reply, it’s nice to know I’m not alone in thinking it’s weird.

Look like some sort of lookup table like the mel link you posted is the way to go, I’ll post back my solution once I’ve written it.

Also thought it was curious that you can add SMPTE Timecode to the scene, but there is no way of querying it at any time other than the specified ‘Frame Start=Production Time Start’ point.



Replies: 0