Public Types | Public Member Functions | Protected Member Functions

MFnNumericData Class Reference

This reference page is linked to from the following overview topics: The basics, Communication Between Manipulators and Nodes, Generic Attributes.


Search for all occurrences

Detailed Description

Numeric data function set.

MFnNumericData allows the creation and manipulation of numeric data objects for use in the dependency graph. Normally, data objects are not required for the transmission of numeric data. The graph supports numeric types directly (see the methods of MDataHandle).

Numeric data objects are useful if you have an attribute that accepts generic data. A generic attribute can accept multiple types of data, so you cannot hardwire it to accept a specific type of numeric data. So, generic attributes can only accept numeric data in the form of actual data objects.

This function set only supports numeric data with multiple components, such as a pair of floats or a triple of integers. Single numeric values can be retrieved directly using MPlug or MDataHandle.

Examples:

apiMeshShape.cpp, blindDataShader.cpp, cgfxAttrDef.cpp, componentScaleManip.cpp, curvedArrowsNode.cpp, D3DViewportRenderer.cpp, footPrintManip.cpp, genericAttributeNode.cpp, geometrySurfaceConstraint.cpp, GLSLShaderNode.cpp, hwAnisotropicShader_NV20.cpp, hwDecalBumpShader_NV20.cpp, hwReflectBumpShader_NV20.cpp, hwToonShader_NV20.cpp, hwUnlitShader.cpp, pnTrianglesNode.cpp, polyModifierCmd.cpp, renderAccessNode.cpp, rotateManip.cpp, surfaceBumpManip.cpp, and swissArmyManip.cpp.

#include <MFnNumericData.h>

Inheritance diagram for MFnNumericData:
Inheritance graph
[legend]

List of all members.

Public Types

enum  Type {
  kInvalid, kBoolean, kByte, kChar,
  kShort, k2Short, k3Short, kLong,
  kInt = kLong, k2Long, k2Int = k2Long, k3Long,
  k3Int = k3Long, kFloat, k2Float, k3Float,
  kDouble, k2Double, k3Double, k4Double,
  kAddr, kLast
}
 

Supported numerical types.

More...

Public Member Functions

virtual MFn::Type type () const
 Function set type.
virtual ~MFnNumericData ()
 Destructor.
 MFnNumericData ()
 Default constructor.
 MFnNumericData (MObject &object, MStatus *ReturnStatus=NULL)
 Constructor.
MObject create (Type dataType, MStatus *ReturnStatus=NULL)
 Creates a new data object of the given type.
Type numericType (MStatus *ReturnStatus=NULL)
 Returns the type of the numeric data object.
MStatus getData (short &val1, short &val2)
 NO SCRIPT SUPPORT.
MStatus getData (int &val1, int &val2)
 NO SCRIPT SUPPORT.
MStatus getData (float &val1, float &val2)
 NO SCRIPT SUPPORT.
MStatus getData (double &val1, double &val2)
 NO SCRIPT SUPPORT.
MStatus getData (short &val1, short &val2, short &val3)
 NO SCRIPT SUPPORT.
MStatus getData (int &val1, int &val2, int &val3)
 NO SCRIPT SUPPORT.
MStatus getData (float &val1, float &val2, float &val3)
 NO SCRIPT SUPPORT.
MStatus getData (double &val1, double &val2, double &val3)
 NO SCRIPT SUPPORT.
MStatus getData (double &val1, double &val2, double &val3, double &val4)
 NO SCRIPT SUPPORT.
MStatus setData (short val1, short val2)
 NO SCRIPT SUPPORT.
MStatus setData (int val1, int val2)
 NO SCRIPT SUPPORT.
MStatus setData (float val1, float val2)
 NO SCRIPT SUPPORT.
MStatus setData (double val1, double val2)
 NO SCRIPT SUPPORT.
MStatus setData (short val1, short val2, short val3)
 NO SCRIPT SUPPORT.
MStatus setData (int val1, int val2, int val3)
 NO SCRIPT SUPPORT.
MStatus setData (float val1, float val2, float val3)
 NO SCRIPT SUPPORT.
MStatus setData (double val1, double val2, double val3)
 NO SCRIPT SUPPORT.
MStatus setData (double val1, double val2, double val3, double val4)
 NO SCRIPT SUPPORT.
 MFnNumericData (const MObject &object, MStatus *ReturnStatus=NULL)
 NO SCRIPT SUPPORT.
MStatus getData2Short (short &val1, short &val2)
 Gets the stored value of this data object as a pair of short integers.
MStatus getData2Int (int &val1, int &val2)
 Gets the stored value of this data object as a pair of int integers.
MStatus getData2Float (float &val1, float &val2)
 Gets the stored value of this data object as a pair of floats.
MStatus getData2Double (double &val1, double &val2)
 Gets the stored value of this data object as a pair of doubles.
MStatus getData3Short (short &val1, short &val2, short &val3)
 Gets the stored value of this data object as a triple of short integers.
MStatus getData3Int (int &val1, int &val2, int &val3)
 Gets the stored value of this data object as a triple of int integers.
MStatus getData3Float (float &val1, float &val2, float &val3)
 Gets the stored value of this data object as a triple of floats.
MStatus getData3Double (double &val1, double &val2, double &val3)
 Gets the stored value of this data object as a triple of doubles.
MStatus getData4Double (double &val1, double &val2, double &val3, double &val4)
 Gets the stored value of this data object as a quadruple of doubles.
MStatus setData2Short (short val1, short val2)
 Sets the stored value of this data object as a pair of short integers.
MStatus setData2Int (int val1, int val2)
 Sets the stored value of this data object as a pair of int integers.
MStatus setData2Float (float val1, float val2)
 Sets the stored value of this data object as a pair of floats.
MStatus setData2Double (double val1, double val2)
 Sets the stored value of this data object as a pair of doubles.
MStatus setData3Short (short val1, short val2, short val3)
 Sets the stored value of this data object as a triple of short integers.
MStatus setData3Int (int val1, int val2, int val3)
 Sets the stored value of this data object as a triple of int integers.
MStatus setData3Float (float val1, float val2, float val3)
 Sets the stored value of this data object as a triple of floats.
MStatus setData3Double (double val1, double val2, double val3)
 Sets the stored value of this data object as a triple of doubles.
MStatus setData4Double (double val1, double val2, double val3, double val4)
 Sets the stored value of this data object as a quadruple of doubles.

Protected Member Functions

virtual const char * className () const
 Class name.

Member Enumeration Documentation

enum Type

Supported numerical types.

Enumerator:
kInvalid 

Invalid data.

kBoolean 

Boolean.

kByte 

One byte.

kChar 

One character.

kShort 

One short.

k2Short 

Two shorts.

k3Short 

Three shorts.

kLong 

One long.

Same as int since "long" is not platform-consistent.

kInt 

One int.

k2Long 

Two longs.

Same as 2 ints since "long" is not platform-consistent.

k2Int 

Two ints.

k3Long 

Three longs.

Same as 3 ints since "long" is not platform-consistent.

k3Int 

Three ints.

kFloat 

One float.

k2Float 

Two floats.

k3Float 

Three floats.

kDouble 

One double.

k2Double 

Two doubles.

k3Double 

Three doubles.

k4Double 

Four doubles.

kAddr 

An address.

kLast 

Last value.

Does not represent a real type, but can be used to loop on all possible types.

Reimplemented from MFnData.


Constructor & Destructor Documentation

MFnNumericData ( MObject object,
MStatus ReturnStatus = NULL 
)

Constructor.

Class constructor that initializes the function set to the given MObject.

Parameters:
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:
MFnNumericData ( const MObject object,
MStatus ReturnStatus = NULL 
)

NO SCRIPT SUPPORT.

Class constructor that initializes the function set to the given MObject.

Constructor

Parameters:
[in]objectThe MObject to attach the function set to
[out]ReturnStatusthe return status
Status Codes:

Member Function Documentation

MFn::Type type ( ) const [virtual]

Function set type.

Return the class type : MFn::kNumericData.

Reimplemented from MFnData.

const char * className ( ) const [protected, virtual]

Class name.

Return the class name : "MFnNumericData".

Reimplemented from MFnData.

MObject create ( Type  dataType,
MStatus ReturnStatus = NULL 
)

Creates a new data object of the given type.

Only pair and triples of numeric data may be created (eg k3Float).

Parameters:
[in]dataTypedata type of object to create
[out]ReturnStatusreturn status
Returns:
A pointer to the new object
Status Codes:
  • kSuccess operation successful
  • kInvalidParameter cannot create an object of the given type
  • kInsufficientMemory out of memory
Examples:
cgfxAttrDef.cpp, componentScaleManip.cpp, footPrintManip.cpp, genericAttributeNode.cpp, geometrySurfaceConstraint.cpp, polyModifierCmd.cpp, rotateManip.cpp, surfaceBumpManip.cpp, and swissArmyManip.cpp.
MFnNumericData::Type numericType ( MStatus ReturnStatus = NULL)

Returns the type of the numeric data object.

Parameters:
[out]ReturnStatusreturn status
Returns:
Type of data
Status Codes:
  • kSuccess operation successful
  • kFailure function set has no object
MStatus getData ( short &  val1,
short &  val2 
)

NO SCRIPT SUPPORT.

Gets the stored value of this data object as a pair of short integers.

The data object must have been created as a pair of short integers for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of short integers, or function set has no object
Examples:
apiMeshShape.cpp.
MStatus getData ( int &  val1,
int &  val2 
)

NO SCRIPT SUPPORT.

Gets the stored value of this data object as a pair of int integers.

The data object must have been created as a pair of int integers for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of int integers, or function set has no object
MStatus getData ( float &  val1,
float &  val2 
)

NO SCRIPT SUPPORT.

Gets the stored value of this data object as a pair of floats.

The data object must have been created as a pair of floats for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of floats, or function set has no object
MStatus getData ( double &  val1,
double &  val2 
)

NO SCRIPT SUPPORT.

Gets the stored value of this data object as a pair of doubles.

The data object must have been created as a pair of doubles for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of doubles, or function set has no object
MStatus getData ( short &  val1,
short &  val2,
short &  val3 
)

NO SCRIPT SUPPORT.

Gets the stored value of this data object as a triple of short integers.

The data object must have been created as a pair of short integers for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
[out]val3storage for the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of short integers, or function set has no object
MStatus getData ( int &  val1,
int &  val2,
int &  val3 
)

NO SCRIPT SUPPORT.

Gets the stored value of this data object as a triple of int integers.

The data object must have been created as a triple of int integers for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
[out]val3storage for the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of int integers, or function set has no object
MStatus getData ( float &  val1,
float &  val2,
float &  val3 
)

NO SCRIPT SUPPORT.

Gets the stored value of this data object as a triple of floats.

The data object must have been created as a triple of floats for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
[out]val3storage for the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of floats, or function set has no object
MStatus getData ( double &  val1,
double &  val2,
double &  val3 
)

NO SCRIPT SUPPORT.

Gets the stored value of this data object as a triple of doubles.

The data object must have been created as a triple of doubles for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
[out]val3storage for the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of doubles, or function set has no object
MStatus getData ( double &  val1,
double &  val2,
double &  val3,
double &  val4 
)

NO SCRIPT SUPPORT.

Gets the stored value of this data object as a quadruple of doubles.

The data object must have been created as a quadruple of doubles for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
[out]val3storage for the third element
[out]val4storage for the fourth element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a quadruple of doubles, or function set has no object
MStatus setData ( short  val1,
short  val2 
)

NO SCRIPT SUPPORT.

Sets the stored value of this data object as a pair of short integers.

The data object must have been created as a pair of short integers for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of short integers, or function set has no object
Examples:
cgfxAttrDef.cpp, componentScaleManip.cpp, footPrintManip.cpp, genericAttributeNode.cpp, polyModifierCmd.cpp, rotateManip.cpp, surfaceBumpManip.cpp, and swissArmyManip.cpp.
MStatus setData ( int  val1,
int  val2 
)

NO SCRIPT SUPPORT.

Sets the stored value of this data object as a pair of int integers.

The data object must have been created as a pair of int integers for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of int integers, or function set has no object
MStatus setData ( float  val1,
float  val2 
)

NO SCRIPT SUPPORT.

Sets the stored value of this data object as a pair of floats.

The data object must have been created as a pair of floats for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of floats, or function set has no object
MStatus setData ( double  val1,
double  val2 
)

NO SCRIPT SUPPORT.

Sets the stored value of this data object as a pair of doubles.

The data object must have been created as a pair of doubles for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kDataIsNotOfThatType data is not a pair of doubles
  • kObjectDoesNotExist function set has no object
MStatus setData ( short  val1,
short  val2,
short  val3 
)

NO SCRIPT SUPPORT.

Sets the stored value of this data object as a triple of short integers.

The data object must have been created as a triple of short integers for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
[in]val3the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of doubles, or function set has no object
MStatus setData ( int  val1,
int  val2,
int  val3 
)

NO SCRIPT SUPPORT.

Sets the stored value of this data object as a triple of int integers.

The data object must have been created as a triple of int integers for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
[in]val3the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of int integers, or function set has no object
MStatus setData ( float  val1,
float  val2,
float  val3 
)

NO SCRIPT SUPPORT.

Sets the stored value of this data object as a triple of floats.

The data object must have been created as a triple of floats for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
[in]val3the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of floats, or function set has no object
MStatus setData ( double  val1,
double  val2,
double  val3 
)

NO SCRIPT SUPPORT.

Sets the stored value of this data object as a triple of doubles.

The data object must have been created as a triple of doubles for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
[in]val3the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of doubles, or function set has no object
MStatus setData ( double  val1,
double  val2,
double  val3,
double  val4 
)

NO SCRIPT SUPPORT.

Sets the stored value of this data object as a quadruple of doubles.

The data object must have been created as a quadruple of doubles for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
[in]val3the third element
[in]val4the fourth element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of doubles, or function set has no object
MStatus getData2Short ( short &  val1,
short &  val2 
)

Gets the stored value of this data object as a pair of short integers.

The data object must have been created as a pair of short integers for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of short integers, or function set has no object
MStatus getData2Int ( int &  val1,
int &  val2 
)

Gets the stored value of this data object as a pair of int integers.

The data object must have been created as a pair of int integers for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of int integers, or function set has no object
MStatus getData2Float ( float &  val1,
float &  val2 
)

Gets the stored value of this data object as a pair of floats.

The data object must have been created as a pair of floats for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of floats, or function set has no object
MStatus getData2Double ( double &  val1,
double &  val2 
)

Gets the stored value of this data object as a pair of doubles.

The data object must have been created as a pair of doubles for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of doubles, or function set has no object
MStatus getData3Short ( short &  val1,
short &  val2,
short &  val3 
)

Gets the stored value of this data object as a triple of short integers.

The data object must have been created as a pair of short integers for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
[out]val3storage for the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of short integers, or function set has no object
MStatus getData3Int ( int &  val1,
int &  val2,
int &  val3 
)

Gets the stored value of this data object as a triple of int integers.

The data object must have been created as a triple of int integers for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
[out]val3storage for the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of int integers, or function set has no object
MStatus getData3Float ( float &  val1,
float &  val2,
float &  val3 
)

Gets the stored value of this data object as a triple of floats.

The data object must have been created as a triple of floats for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
[out]val3storage for the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of floats, or function set has no object
MStatus getData3Double ( double &  val1,
double &  val2,
double &  val3 
)

Gets the stored value of this data object as a triple of doubles.

The data object must have been created as a triple of doubles for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
[out]val3storage for the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of doubles, or function set has no object
MStatus getData4Double ( double &  val1,
double &  val2,
double &  val3,
double &  val4 
)

Gets the stored value of this data object as a quadruple of doubles.

The data object must have been created as a quadruple of doubles for this to succeed.

Parameters:
[out]val1storage for the first element
[out]val2storage for the second element
[out]val3storage for the third element
[out]val4storage for the fourth element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a quadruple of doubles, or function set has no object
MStatus setData2Short ( short  val1,
short  val2 
)

Sets the stored value of this data object as a pair of short integers.

The data object must have been created as a pair of short integers for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of short integers, or function set has no object
MStatus setData2Int ( int  val1,
int  val2 
)

Sets the stored value of this data object as a pair of int integers.

The data object must have been created as a pair of int integers for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of int integers, or function set has no object
MStatus setData2Float ( float  val1,
float  val2 
)

Sets the stored value of this data object as a pair of floats.

The data object must have been created as a pair of floats for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of floats, or function set has no object
MStatus setData2Double ( double  val1,
double  val2 
)

Sets the stored value of this data object as a pair of doubles.

The data object must have been created as a pair of doubles for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kDataIsNotOfThatType data is not a pair of doubles
  • kObjectDoesNotExist function set has no object
MStatus setData3Short ( short  val1,
short  val2,
short  val3 
)

Sets the stored value of this data object as a triple of short integers.

The data object must have been created as a triple of short integers for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
[in]val3the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a pair of doubles, or function set has no object
MStatus setData3Int ( int  val1,
int  val2,
int  val3 
)

Sets the stored value of this data object as a triple of int integers.

The data object must have been created as a triple of int integers for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
[in]val3the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of int integers, or function set has no object
MStatus setData3Float ( float  val1,
float  val2,
float  val3 
)

Sets the stored value of this data object as a triple of floats.

The data object must have been created as a triple of floats for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
[in]val3the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of floats, or function set has no object
MStatus setData3Double ( double  val1,
double  val2,
double  val3 
)

Sets the stored value of this data object as a triple of doubles.

The data object must have been created as a triple of doubles for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
[in]val3the third element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of doubles, or function set has no object
Examples:
geometrySurfaceConstraint.cpp.
MStatus setData4Double ( double  val1,
double  val2,
double  val3,
double  val4 
)

Sets the stored value of this data object as a quadruple of doubles.

The data object must have been created as a quadruple of doubles for this to succeed.

Parameters:
[in]val1the first element
[in]val2the second element
[in]val3the third element
[in]val4the fourth element
Returns:
Return status
Status Codes:
  • kSuccess operation successful
  • kFailure data is not a triple of doubles, or function set has no object

MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData
MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData MFnNumericData