#include <MFnUnitAttribute.h>
MFnUnitAttribute is the function set for dependency nodes attributes that store one of the fundamental types of Maya data. The currently supported types are MAngle, MDistance, and MTime.
It is possible to set the defaults using a double. This is valid for angles and distances. In the case of angles, the value is assumed to be in radians, and in the case of distances, it is assumed to be in centimeters. Time values should not be set using a double.
It is possible to use unit attributes in place of double attributes when creating numeric compounds (see MFnNumericAttrbute). To create a numeric compound of three distance values, create the three child attributes using MFnUnitAttribute and then pass the children into the create method of MFnNumericAttribute.
Public Types | |
enum | Type { kInvalid, kAngle, kDistance, kTime, kLast } |
Type of unit represented by attribute values. More... | |
Public Member Functions | |
virtual MFn::Type | type () const |
Function set type. | |
virtual | ~MFnUnitAttribute () |
Destructor. | |
MFnUnitAttribute () | |
Default constructor. | |
MFnUnitAttribute (MObject &object, MStatus *ReturnStatus=NULL) | |
Constructor. | |
MObject | create (const MString &fullName, const MString &briefName, MFnUnitAttribute::Type unitType, double defaultValue=0.0, MStatus *ReturnStatus=NULL) |
MObject | create (const MString &fullName, const MString &briefName, const MTime &defaultValue, MStatus *ReturnStatus=NULL) |
MObject | create (const MString &fullName, const MString &briefName, const MAngle &defaultValue, MStatus *ReturnStatus=NULL) |
MObject | create (const MString &fullName, const MString &briefName, const MDistance &defaultValue, MStatus *ReturnStatus=NULL) |
MFnUnitAttribute::Type | unitType (MStatus *ReturnStatus=NULL) const |
bool | hasMin (MStatus *ReturnStatus=NULL) const |
bool | hasMax (MStatus *ReturnStatus=NULL) const |
bool | hasSoftMin (MStatus *ReturnStatus=NULL) const |
bool | hasSoftMax (MStatus *ReturnStatus=NULL) const |
MStatus | getMin (double &minValue) const |
MStatus | getMin (MTime &minValue) const |
MStatus | getMin (MAngle &minValue) const |
MStatus | getMin (MDistance &minValue) const |
MStatus | getMax (double &maxValue) const |
MStatus | getMax (MTime &maxValue) const |
MStatus | getMax (MAngle &maxValue) const |
MStatus | getMax (MDistance &maxValue) const |
MStatus | getSoftMin (double &minValue) const |
MStatus | getSoftMin (MTime &minValue) const |
MStatus | getSoftMin (MAngle &minValue) const |
MStatus | getSoftMin (MDistance &minValue) const |
MStatus | getSoftMax (double &maxValue) const |
MStatus | getSoftMax (MTime &maxValue) const |
MStatus | getSoftMax (MAngle &maxValue) const |
MStatus | getSoftMax (MDistance &maxValue) const |
MStatus | setMin (double minValue) |
MStatus | setMin (const MTime &minValue) |
MStatus | setMin (const MAngle &minValue) |
MStatus | setMin (const MDistance &minValue) |
MStatus | setMax (double maxValue) |
MStatus | setMax (const MTime &maxValue) |
MStatus | setMax (const MAngle &maxValue) |
MStatus | setMax (const MDistance &maxValue) |
MStatus | setSoftMin (double minValue) |
MStatus | setSoftMin (const MTime &minValue) |
MStatus | setSoftMin (const MAngle &minValue) |
MStatus | setSoftMin (const MDistance &minValue) |
MStatus | setSoftMax (double maxValue) |
MStatus | setSoftMax (const MTime &maxValue) |
MStatus | setSoftMax (const MAngle &maxValue) |
MStatus | setSoftMax (const MDistance &maxValue) |
MStatus | getDefault (double &defaultValue) |
MStatus | getDefault (MTime &defaultValue) |
MStatus | getDefault (MAngle &defaultValue) |
MStatus | getDefault (MDistance &defaultValue) |
MStatus | setDefault (double defaultValue) |
MStatus | setDefault (const MTime &defaultValue) |
MStatus | setDefault (const MAngle &defaultValue) |
MStatus | setDefault (const MDistance &defaultValue) |
MFnUnitAttribute (const MObject &object, MStatus *ReturnStatus=NULL) | |
Constructor. | |
Protected Member Functions | |
virtual const char * | className () const |
Class name. |
Constructor.
Class constructor that initializes the function set to the given MObject.
[in] | object | The MObject to attach the function set to |
[out] | ReturnStatus | the return status |
Constructor.
Class constructor that initializes the function set to the given MObject.
[in] | object | The MObject to attach the function set to |
[out] | ReturnStatus | the return status |
MFn::Type MFnUnitAttribute::type | ( | ) | const [virtual] |
const char * MFnUnitAttribute::className | ( | ) | const [protected, virtual] |
MObject MFnUnitAttribute::create | ( | const MString & | full, | |
const MString & | brief, | |||
MFnUnitAttribute::Type | unitType, | |||
double | defaultValue = 0.0 , |
|||
MStatus * | ReturnStatus = NULL | |||
) |
Create a new unit attribute and return it as an MObject. For both angle and distance attributes, the attribute is type independent. For example, you define an angular attribute as containing an angle in radians. The defaultValue passed to the create method must be in these units, and the value in those units will be returned by the get and set methods. If this method is used to instantiate a time attribute, the units stored in the attribute will be those of the current default time unit (see MTime).
A unit attribute supports both a hard maximum/minimum and a soft maximum/minimum. The soft maximum/minimum are used by the user interface for limits on sliders, but values within the hard range are still valid.
The create method needs to be called on a per node basis. That means if you want to create and add the same attribute to multiple nodes, you need to call the create method for each node to get a unique MObject back. If you call create just once and add the attribute to multiple nodes, Maya will encounter a fatal error.
[in] | full | the full (or int) name of the attribute |
[in] | brief | the brief (or short) name of the attribute |
[in] | unitType | an element of the MFnUnitAttribute::Type enum |
[in] | defaultValue | the default value for the new attribute |
[out] | ReturnStatus |
MObject MFnUnitAttribute::create | ( | const MString & | full, | |
const MString & | brief, | |||
const MTime & | defaultValue, | |||
MStatus * | ReturnStatus = NULL | |||
) |
Create a new unit attribute of type time and return it as an MObject. The units of the time value stored in the attribute will be those of the current default time units in effect (see MTime).
[in] | full | the full (or int) name of the attribute |
[in] | brief | the brief (or short) name of the attribute |
[in] | defaultValue | the default value for the new attribute |
[out] | ReturnStatus |
MObject MFnUnitAttribute::create | ( | const MString & | full, | |
const MString & | brief, | |||
const MAngle & | defaultValue, | |||
MStatus * | ReturnStatus = NULL | |||
) |
Create a new unit attribute of type angle and return it as an MObject.
[in] | full | the full (or int) name of the attribute |
[in] | brief | the brief (or short) name of the attribute |
[in] | defaultValue | the default value for the new attribute |
[out] | ReturnStatus |
MObject MFnUnitAttribute::create | ( | const MString & | full, | |
const MString & | brief, | |||
const MDistance & | defaultValue, | |||
MStatus * | ReturnStatus = NULL | |||
) |
Create a new unit attribute of type distance and return it as an MObject.
[in] | full | the full (or int) name of the attribute |
[in] | brief | the brief (or short) name of the attribute |
[in] | defaultValue | the default value for the new attribute |
[out] | ReturnStatus |
MFnUnitAttribute::Type MFnUnitAttribute::unitType | ( | MStatus * | ReturnStatus = NULL |
) | const |
Return the unit type of this attribute.
[out] | ReturnStatus |
bool MFnUnitAttribute::hasMin | ( | MStatus * | ReturnStatus = NULL |
) | const |
Determine whether or not this attribute has a minimum value set.
[out] | ReturnStatus |
bool MFnUnitAttribute::hasMax | ( | MStatus * | ReturnStatus = NULL |
) | const |
Determine whether or not this attribute has a maximum value set.
[out] | ReturnStatus |
bool MFnUnitAttribute::hasSoftMin | ( | MStatus * | ReturnStatus = NULL |
) | const |
Determine whether or not this attribute has a soft minimum value set.
[out] | ReturnStatus |
bool MFnUnitAttribute::hasSoftMax | ( | MStatus * | ReturnStatus = NULL |
) | const |
Determine whether or not this attribute has a soft maximum value set.
[out] | ReturnStatus |
MStatus MFnUnitAttribute::getMin | ( | double & | minValue | ) | const |
Return the minimum value for this attribute. This routine simply returns the numerical value of the attribute. It is up to the programmer to know the units used by this attribute (eg. radians for angular data, centimeters for distance data, etc.) and interpret the response appropriately.
[out] | minValue | the minimum value for this attribute |
Return the minimum value for this attribute.
[out] | minValue | the minimum value for this attribute |
Return the minimum value for this attribute.
[out] | minValue | the minimum value for this attribute |
Return the minimum value for this attribute.
[out] | minValue | the minimum value for this attribute |
MStatus MFnUnitAttribute::getMax | ( | double & | maxValue | ) | const |
Return the maximum value for this attribute. This routine simply returns the numerical value of the attribute. It is up to the programmer to know the units used by this attribute (eg. radians for angular data, centimeters for distance data, etc.) and interpret the response appropriately.
[out] | maxValue | the maximum value for this attribute |
Return the maximum value for this attribute.
[out] | maxValue | the maximum value for this attribute |
Return the maximum value for this attribute.
[out] | maxValue | the maximum value for this attribute |
Return the maximum value for this attribute.
[out] | maxValue | the maximum value for this attribute |
MStatus MFnUnitAttribute::getSoftMin | ( | double & | minValue | ) | const |
Return the soft minimum value for this attribute. This routine simply returns the numerical value of the attribute. It is up to the programmer to know the units used by this attribute (eg. radians for angular data, centimeters for distance data, etc.) and interpret the response appropriately.
[out] | minValue | the soft minimum value for this attribute |
Return the soft minimum value for this attribute.
[out] | minValue | the soft minimum value for this attribute |
Return the soft minimum value for this attribute.
[out] | minValue | the soft minimum value for this attribute |
Return the soft minimum value for this attribute.
[out] | minValue | the soft minimum value for this attribute |
MStatus MFnUnitAttribute::getSoftMax | ( | double & | maxValue | ) | const |
Return the soft maximum value for this attribute. This routine simply returns the numerical value of the attribute. It is up to the programmer to know the units used by this attribute (eg. radians for angular data, centimeters for distance data, etc.) and interpret the response appropriately.
[out] | maxValue | the soft maximum value for this attribute |
Return the soft maximum value for this attribute.
[out] | maxValue | the soft maximum value for this attribute |
Return the soft maximum value for this attribute.
[out] | maxValue | the soft maximum value for this attribute |
Return the soft maximum value for this attribute.
[out] | maxValue | the soft maximum value for this attribute |
MStatus MFnUnitAttribute::setMin | ( | double | minValue | ) |
Set the minimum value for this attribute. This routine simply stores the given double as the numerical value of the attribute. It is up to the programmer to know the units used by this attribute (eg. radians for angular data, centimeters for distance data, etc.) and provide the appropriate value.
[in] | minValue | the new minimum value for this attribute |
Set the minimum value for this attribute.
[in] | minValue | the new minimum value for this attribute |
Set the minimum value for this attribute.
[in] | minValue | the new minimum value for this attribute |
Set the minimum value for this attribute.
[in] | minValue | the new minimum value for this attribute |
MStatus MFnUnitAttribute::setMax | ( | double | maxValue | ) |
Set the maximum value for this attribute. This routine simply stores the given double as the numerical value of the attribute. It is up to the programmer to know the units used by this attribute (eg. radians for angular data, centimeters for distance data, etc.) and provide the appropriate value.
[in] | maxValue | the new maximum value for this attribute |
Set the maximum value for this attribute.
[in] | maxValue | the new maximum value for this attribute |
Set the maximum value for this attribute.
[in] | maxValue | the new maximum value for this attribute |
Set the maximum value for this attribute.
[in] | maxValue | the new maximum value for this attribute |
MStatus MFnUnitAttribute::setSoftMin | ( | double | minValue | ) |
Set the soft minimum value for this attribute. This routine simply stores the given double as the numerical value of the attribute. It is up to the programmer to know the units used by this attribute (eg. radians for angular data, centimeters for distance data, etc.) and provide the appropriate value.
[in] | minValue | the new soft minimum value for this attribute |
Set the soft minimum value for this attribute.
[in] | minValue | the new soft minimum value for this attribute |
Set the soft minimum value for this attribute.
[in] | minValue | the new soft minimum value for this attribute |
Set the soft minimum value for this attribute.
[in] | minValue | the new soft minimum value for this attribute |
MStatus MFnUnitAttribute::setSoftMax | ( | double | maxValue | ) |
Set the soft maximum value for this attribute. This routine simply stores the given double as the numerical value of the attribute. It is up to the programmer to know the units used by this attribute (eg. radians for angular data, centimeters for distance data, etc.) and provide the appropriate value.
[in] | maxValue | the new soft maximum value for this attribute |
Set the soft maximum value for this attribute.
[in] | maxValue | the new soft maximum value for this attribute |
Set the soft maximum value for this attribute.
[in] | maxValue | the new soft maximum value for this attribute |
Set the soft maximum value for this attribute.
[in] | maxValue | the new soft maximum value for this attribute |
MStatus MFnUnitAttribute::getDefault | ( | double & | defaultValue | ) |
Gets the default value for this attribute. This routine simply returns the given double which represents the default value for the attribute.
[out] | defaultValue | returns the default value for this attribute. This method simply returns the given default value of the attribute as a double. It is up to the programmer to know the units used by this attribute (eg. radians for angular data, centimeters for distance data, etc.). |
Gets the default value for a time attribute.
[out] | defaultValue | returns the default value for this attribute |
Gets the default value for this attribute.
[out] | defaultValue | returns the default value for this attribute in radians |
Gets the default value for this attribute.
[out] | defaultValue | returns the default value for this attribute in centimeters |
MStatus MFnUnitAttribute::setDefault | ( | double | defaultValue | ) |
Set a new default value for this attribute. This routine simply stores the given double as the new default value of the attribute. It is up to the programmer to know the units used by this attribute (eg. radians for angular data, centimeters for distance data, etc.) and provide the appropriate value.
[in] | defaultValue | the new default value for this attribute |
Set a new default value for a time attribute.
[in] | defaultValue | the new default value for this attribute |
Set a new default value for this attribute.
[in] | defaultValue | the new default value for this attribute |
Set a new default value for this attribute.
[in] | defaultValue | the new default value for this attribute |
Autodesk® Maya® 2009 © 1997-2008 Autodesk, Inc. All rights reserved. | Generated with 1.5.6 |