C++ API Reference
|
Manipulate Linear Data. More...
#include <MDistance.h>
Public Member Functions | |
OPENMAYA_ENUM (Unit, kInvalid, kInches, kFeet, kYards, kMiles, kMillimeters, kCentimeters, kKilometers, kMeters, kLast) | |
Available Unit Systems. More... | |
MDistance () | |
The default class constructor. More... | |
MDistance (const MDistance &src) | |
Copy constructor. More... | |
~MDistance () | |
The class destructor. | |
MDistance & | operator= (const MDistance &src) |
The assignment operator. More... | |
Unit | unit () const |
Return the units currently in effect for this instance. More... | |
double | value () const |
Return the value of the current instance in the currently set units. More... | |
MStatus | setUnit (Unit newUnit) |
Set the units used by this instance. More... | |
MStatus | setValue (double newValue) |
Set the value of this instance. More... | |
double | as (Unit newUnit, MStatus *ReturnStatus=NULL) const |
Return the current value of this instance in the provided units. More... | |
double | asUnits (Unit newUnit, MStatus *ReturnStatus=NULL) const |
Return the current value of this instance in the provided units. More... | |
double | asInches () const |
Return the current value of this instance in inches. More... | |
double | asFeet () const |
Return the current value of this instance in feet. More... | |
double | asYards () const |
Return the current value of this instance in yards. More... | |
double | asMiles () const |
Return the current value of this instance in miles. More... | |
double | asMillimeters () const |
Return the current value of this instance in millimeters. More... | |
double | asCentimeters () const |
Return the current value of this instance in centimeters. More... | |
double | asKilometers () const |
Return the current value of this instance in kilometers. More... | |
double | asMeters () const |
Return the current value of this instance in meters. More... | |
Static Public Member Functions | |
static Unit | uiUnit () |
Returns the Working Units (or UI units) chosen in the settings of the prefs window. More... | |
static MStatus | setUIUnit (Unit newUnit) |
Set the unit system to be used by the user in the UI. More... | |
static Unit | internalUnit () |
Returns the internal unit system. More... | |
static double | internalToUI (double internalValue) |
Converts a value from internal units to UI units. More... | |
static double | uiToInternal (double uiValue) |
Converts a value from UI units to internal units. More... | |
static const char * | className () |
Returns the name of this class. More... | |
static MStatus | setInternalUnit (Unit internalUnit) |
This method is obsolete. More... | |
Manipulate Linear Data.
The MDistance class provides a fundamental type for the Maya API to hold and manipulate linear data. All API methods that require or return distance information do so through variables of this type.
OPENMAYA_MAJOR_NAMESPACE_OPEN MDistance | ( | ) |
The default class constructor.
Initialize the MDistance instance to 0 in the current internal units. (See setInternalUnit and internalUnit below).
Copy constructor.
[in] | src | Existing MDistance object from which to initialize the new one. |
OPENMAYA_ENUM | ( | Unit | , |
kInvalid | , | ||
kInches | , | ||
kFeet | , | ||
kYards | , | ||
kMiles | , | ||
kMillimeters | , | ||
kCentimeters | , | ||
kKilometers | , | ||
kMeters | , | ||
kLast | |||
) |
Available Unit Systems.
kInches | Inches |
kFeet | Feet |
kYards | Yards |
kMiles | Miles |
kMillimeters | Millimeters |
kCentimeters | Centimeters |
kKilometers | Kilometers |
kMeters | Meters |
MDistance::Unit unit | ( | ) | const |
Return the units currently in effect for this instance.
double value | ( | ) | const |
Return the value of the current instance in the currently set units.
MStatus setUnit | ( | Unit | newUnit | ) |
Set the units used by this instance.
[in] | newUnit | an element of the MDistance::Unit enum |
MStatus setValue | ( | double | newValue | ) |
Set the value of this instance.
[in] | newValue | the new value in the units currently in effect |
double as | ( | Unit | newUnit, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Return the current value of this instance in the provided units.
[in] | otherUnit | an element of the MDistance::Unit enum specifying the desired units |
[out] | ReturnStatus | return status |
double asUnits | ( | Unit | newUnit, |
MStatus * | ReturnStatus = NULL |
||
) | const |
Return the current value of this instance in the provided units.
[in] | otherUnit | an element of the MDistance::Unit enum specifying the desired units |
[out] | ReturnStatus | return status |
double asInches | ( | ) | const |
Return the current value of this instance in inches.
double asFeet | ( | ) | const |
Return the current value of this instance in feet.
double asYards | ( | ) | const |
Return the current value of this instance in yards.
double asMiles | ( | ) | const |
Return the current value of this instance in miles.
double asMillimeters | ( | ) | const |
Return the current value of this instance in millimeters.
double asCentimeters | ( | ) | const |
Return the current value of this instance in centimeters.
double asKilometers | ( | ) | const |
Return the current value of this instance in kilometers.
double asMeters | ( | ) | const |
Return the current value of this instance in meters.
|
static |
Returns the Working Units (or UI units) chosen in the settings of the prefs window.
|
static |
Set the unit system to be used by the user in the UI.
[in] | newUnit | and element of the MDistance::Unit enum. |
|
static |
Returns the internal unit system.
|
static |
Converts a value from internal units to UI units.
[in] | internalValue | a value in internal units |
|
static |
Converts a value from UI units to internal units.
[in] | uiValue | a value in UI units |
|
static |
Returns the name of this class.
|
static |
This method is obsolete.
[From Maya 2019]
Changing the internal units is generally not a good idea and using the method may often produce unexpected results. It is recommended to just read the values and convert them to the units desired.
Set the internal unit system.
[in] | internalUnit | the internal unit to be used by distance |