Quantcast
Channel: mel wiki
Viewing all articles
Browse latest Browse all 610

API: How can I find the working units?

$
0
0
The below classes compare with the mel currentUnit command.

The below classes have the ability to query both the internal units, and the ui units (except MTime). The internal units, while they can be changed, usually shouldn't be. Defaults for internal units are:
  • Linear : Centimeters
  • Angular : ? Mine comes up as kInvalid, which is odd. I'd expect it to be Radians though.
  • Time : Has no differentiation between internal\ui: There is only ui units. I think when Maya installs this is 24fps (film).
UI units are the ones you can change via Maya's prefs, or via mel.

Linear:

OpenMaya.MDistance
import maya.OpenMaya as om
uiLinearUnit = om.MDistance.uiUnit()
This returns an int value that corresponds to the Unit enum on the MDistance class. Which corresponds to these constants:
1kInches
2kFeet
3kYards
4kMiles
5kMillimeters
6kCentimeters
7kKilometers
8kMeters

Angular:

OpenMaya.MAngle
import maya.OpenMaya as om
uiAngularUnit = om.MAngle.uiUnit()
This returns an int value that corresponds to the Unit enum on the MAngle class. Which corresponds to these constants:
1kInvalid
2kRadians
3kDegrees
4kAngMinutes
5kAngSeconds
6kLast

Time:

OpenMaya.MTime
import maya.OpenMaya as om
uiTimeUnit = om.MTime.uiUnit()
This returns an int value that corresponds to the Unit enum on the MTime class. There are a lot of constant values, check the docs for the specifics.

Also see:


Viewing all articles
Browse latest Browse all 610

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>