Manipulate Linear Data.
More...
#include <MDistance.h>
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.
- Examples:
- animExportUtil/animFileExport.cpp, animImportExport/animFileUtils.cpp, atomImportExport/atomCachedPlugs.cpp, atomImportExport/atomFileUtils.cpp, cgFx/cgfxAttrDef.cpp, footPrintManip/footPrintManip.cpp, footPrintNode/footPrintNode.cpp, footPrintNode_AnimatedMaterial/footPrintNode_GeometryOverride_AnimatedMaterial.cpp, footPrintNode_GeometryOverride/footPrintNode_GeometryOverride.cpp, footPrintNode_SubSceneOverride/footPrintNode_SubSceneOverride.cpp, rawfootPrintNode/rawfootPrintNode.cpp, squaresNode_noDepthTest/squaresNode_noDepthTest.cpp, and swissArmyManip/swissArmyManip.cpp.
Available Unit Systems.
Enumerator |
---|
kInches |
Inches.
|
kFeet |
Feet.
|
kYards |
Yards.
|
kMiles |
Miles.
|
kMillimeters |
Millimeters.
|
kCentimeters |
Centimeters.
|
kKilometers |
Kilometers.
|
kMeters |
Meters.
|
The default class constructor.
Initialize the MDistance instance to 0 in the current internal units. (See setInternalUnit and internalUnit below).
Class constructor.
Initialize the MDistance instance to the given value in the given unit system
- Parameters
-
[in] | newValue | the initial value of the instance |
[in] | newUnit | the unit system for the initial value |
Copy constructor.
- Parameters
-
[in] | src | Existing MDistance object from which to initialize the new one. |
The assignment operator.
- Parameters
-
[in] | src | Existing MDistance object from which to set the value of this one. |
- Returns
- Reference to this MDistance instance.
Return the units currently in effect for this instance.
- Returns
- An element of the MDistance::Unit enum
Return the value of the current instance in the currently set units.
- Returns
- The current value of the instance
Set the units used by this instance.
- Parameters
-
- Returns
- MS::kSuccess if a valid unit was provided, MS::kFailure otherwise
MStatus setValue |
( |
double |
newValue | ) |
|
Set the value of this instance.
- Parameters
-
[in] | newValue | the new value in the units currently in effect |
- Returns
- Always returns MS::kSuccess
Return the current value of this instance in the provided units.
- Parameters
-
[in] | otherUnit | an element of the MDistance::Unit enum specifying the desired units |
[out] | ReturnStatus | return status |
- Returns
- The current value in the given units
- Status Codes:
- MS::kSuccess operation successful
- MS::kFailure operation failed
- Examples:
- cgFx/cgfxAttrDef.cpp.
Return the current value of this instance in the provided units.
- Parameters
-
[in] | otherUnit | an element of the MDistance::Unit enum specifying the desired units |
[out] | ReturnStatus | return status |
- Returns
- The current value in the given units
- Status Codes:
- MS::kSuccess operation successful
- MS::kFailure operation failed
double asInches |
( |
| ) |
const |
Return the current value of this instance in inches.
- Returns
- The current value in the inches
Return the current value of this instance in feet.
- Returns
- The current value in the feet
Return the current value of this instance in yards.
- Returns
- The current value in the yards
Return the current value of this instance in miles.
- Returns
- The current value in the miles
double asMillimeters |
( |
| ) |
const |
Return the current value of this instance in millimeters.
- Returns
- The current value in the millimeters
double asCentimeters |
( |
| ) |
const |
double asKilometers |
( |
| ) |
const |
Return the current value of this instance in kilometers.
- Returns
- The current value in the kilometers
double asMeters |
( |
| ) |
const |
Return the current value of this instance in meters.
- Returns
- The current value in the meters
double internalToUI |
( |
double |
internalValue | ) |
|
|
static |
Converts a value from internal units to UI units.
- Parameters
-
[in] | internalValue | a value in internal units |
- Returns
- The value in UI units
- Examples:
- objExport/objExport.cpp.
double uiToInternal |
( |
double |
uiValue | ) |
|
|
static |
const char * className |
( |
| ) |
|
|
static |
Returns the name of this class.
- Returns
- The name of this class.
Deprecated in 2019.0
Set the internal unit system.
- Deprecated:
- 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.
- 2019.0:
- Deprecated in this version.
- Parameters
-
[in] | internalUnit | the internal unit to be used by distance |
- Returns
- Status code
- Status Codes:
- MS::kSuccess a valid unit was provided
- MS::kFailure a valid unit was not provided
The documentation for this class was generated from the following files:
- MDistance.h
- MDistance.cpp