Just a quick post about how to access the playback range in the maya time slider using python.
#import animation module import maya.OpenMayaAnim as animAPI #gets the playback start time minValue = animAPI.MAnimControl.minTime().value() #gets the playback end time maxValue = animAPI.MAnimControl.maxTime().value()
A breakdown of whats going on here:
1. Import the OpenMayaAnim module to access the part of the maya api that deals with animation.
2. animAPI.MAnimControl – The MAnimControl class is called, which houses several functions that deal with how an animation is played back in the viewport.
2. MAnimControl.minTime () – This gets the start time of the animation in the UI bar, and returns it as a MTime object, which holds both the start value as well as what the unit returned is measured in.
3. minTime().value() – Returns time value stored in MTime as a float