- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions

# MFnBase Class Reference
OpenMaya - API module for common classes | FunctionSet classes

This reference page is linked to from the following overview topics: Creating and Manipulating Objects, MSelectionList, setObject() method, Appendix C: Frequently asked questions.

Search for all occurrences

## Detailed Description

Function Set Base Class.

Defines the interface for the API RTTI and Maya Object attachment methods common to all Function Set Classes.

Implements the Function Set compatibility test methods for all Function Sets.

The API provides access to Maya Objects as generic MObjects. Under the C++ class scheme MObjects simply have type MObject with no base or derived hierarchy. However, MObjects may be many different types of model or scene objects, from Attributes to Transforms, within Maya. This allows many different types of objects to be moved across or accessed through the API without undue concern on the part of plug-in developers for the type of object being manipulated.

Since it is impractical to provide every applicable method on MObjects, the methods applicable to Maya Objects are encapsulated in Function Sets. Function Sets can be attached to compatible MObjects to provide an external interface to methods appropriate to that MObject. All Function Sets provide a method setObject() which attaches them to the specified Maya Object. Additionally, most Function Sets provide a version of their constructor which attaches the new Function Set to a specified MObject.

The link between an MObject and the role it performs as a Maya scene or model object, as well as the compatibility between MObjects and Function Sets is managed by the API Run-Time Type Identification (RTTI) system. The two key concepts of this system are the Maya Object type and the Function Set type (both are MFn::Type). All MObjects have one and only one Maya Object type. All Function Sets have one and only one Function Set type. MObjects may, however, be compatible with many types of Function Sets. This compatibility follows the class hierarchy of the Function Sets. Thus an MObject with Maya Object type MFn::kNurbsSurface would be compatible with MFnNurbsSurface, MFnDagNode, MFnDependencyNode, MFnNamedObject and MFnBase.

Any MObject can be queried with the MObject::hasFn() method to determine if it is comaptible with a given Function Set.

The purpose of the Base Function Set (MFnBase) is to provide methods for determining whether or not a Function Set is compatible with a given Maya Object (MObject) type (MFn::Type) or a specific MObject. See: MFnBase::hasObj(MFn::Type) and MFnBase::hasObj(const MObject &)

As well, this Function Set provides virtual methods for determining the type of a Function Set under the API RTTI system.

`#include <MFnBase.h>`

Inheritance diagram for MFnBase:
[legend]

List of all members.

## Public Member Functions
virtual | ~MFnBase ()
| Class Destructor.
virtual MFn::Type | type () const
| Determines the type of the Function Set within the API RTTI system.
bool | hasObj (MFn::Type) const
| Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system.
bool | hasObj (const MObject &) const
| Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system.
MObject | object (MStatus *ReturnStatus=NULL) const
| Returns the MObject that is attached to the Function Set.
virtual MStatus | setObject (MObject &object)
| Attaches the Function Set to the specified Maya Object.
virtual MStatus | setObject (const MObject &object)
| NO SCRIPT SUPPORT.
## Static Public Member Functions
static const char * | className ()
| Returns the name of this class.

## Constructor & Destructor Documentation

~MFnBase | ( |  | ) | `[virtual]`

Class Destructor.

No additional action.

## Member Function Documentation

MFn::Type type | ( |  | ) | const`[virtual]`

Search for all occurrences

Determines the type of the Function Set within the API RTTI system.

Returns:
  Function Set type

Reimplemented in MFnAirField, MFnAmbientLight, MFnAnimCurve, MFnAnisotropyShader, MFnAreaLight, MFnArrayAttrsData, MFnAssembly, MFnAttribute, MFnBlendShapeDeformer, MFnBlinnShader, MFnCamera, MFnCameraSet, MFnCharacter, MFnCircleSweepManip, MFnClip, MFnComponent, MFnComponentListData, MFnCompoundAttribute, MFnContainerNode, MFnCurveSegmentManip, MFnDagNode, MFnData, MFnDependencyNode, MFnDirectionalLight, MFnDirectionManip, MFnDiscManip, MFnDistanceManip, MFnDoubleArrayData, MFnDoubleIndexedComponent, MFnDragField, MFnDynSweptGeometryData, MFnEnumAttribute, MFnExpression, MFnField, MFnFloatArrayData, MFnFluid, MFnFreePointTriadManip, MFnGenericAttribute, MFnGeometryData, MFnGeometryFilter, MFnGravityField, MFnHikEffector, MFnIkEffector, MFnIkHandle, MFnIkJoint, MFnIkSolver, MFnImageSource, MFnInstancer, MFnIntArrayData, MFnKeyframeDelta, MFnKeyframeDeltaAddRemove, MFnKeyframeDeltaBlockAddRemove, MFnKeyframeDeltaBreakdown, MFnKeyframeDeltaInfType, MFnKeyframeDeltaMove, MFnKeyframeDeltaScale, MFnKeyframeDeltaTangent, MFnKeyframeDeltaWeighted, MFnLambertShader, MFnLattice, MFnLatticeData, MFnLatticeDeformer, MFnLayeredShader, MFnLight, MFnLightDataAttribute, MFnManip3D, MFnMatrixAttribute, MFnMatrixData, MFnMesh, MFnMeshData, MFnMessageAttribute, MFnMotionPath, MFnNewtonField, MFnNIdData, MFnNObjectData, MFnNonAmbientLight, MFnNonExtendedLight, MFnNumericAttribute, MFnNumericData, MFnNurbsCurve, MFnNurbsCurveData, MFnNurbsSurface, MFnNurbsSurfaceData, MFnParticleSystem, MFnPartition, MFnPfxGeometry, MFnPhongEShader, MFnPhongShader, MFnPlugin, MFnPluginData, MFnPointArrayData, MFnPointLight, MFnPointOnCurveManip, MFnPointOnSurfaceManip, MFnRadialField, MFnReference, MFnReflectShader, MFnRenderLayer, MFnRenderPass, MFnRotateManip, MFnScaleManip, MFnSet, MFnSingleIndexedComponent, MFnSkinCluster, MFnSphereData, MFnSpotLight, MFnStateManip, MFnStringArrayData, MFnStringData, MFnSubd, MFnSubdData, MFnToggleManip, MFnTransform, MFnTripleIndexedComponent, MFnTurbulenceField, MFnTypedAttribute, MFnUInt64ArrayData, MFnUint64SingleIndexedComponent, MFnUniformField, MFnUnitAttribute, MFnVectorArrayData, MFnVolumeAxisField, MFnVolumeLight, MFnVortexField, MFnWeightGeometryFilter, and MFnWireDeformer.

bool hasObj | ( | MFn::Type | mtype | ) | const

Search for all occurrences

Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system.

Parameters:

  [in] | mtype | Maya Object type

Returns:
  - true = Compatible
  - false = Not Compatible

bool hasObj | ( | const MObject & | object | ) | const

Search for all occurrences

Determines whether or not the Function Set is compatible with the specified Maya Object within the API RTTI system.

Parameters:

  [in] | object | Maya Object to be tested for compatibility

Returns:
  - true = Compatible
  - false = Not Compatible

MObject object | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Returns the MObject that is attached to the Function Set.

Parameters:

  [in] | ReturnStatus | Status Code (see below)

Returns:
  An MObject that references the object to which the Function Set is attached. If the function set is not attached to an MObject, MObject::kNullObj will be returned.

Status Codes:
  - MS::kSuccess Success
  - MS::kInvalidParameter The Function Set was not attached to an object.

Examples:
  cgfxAttrDef.cpp, meshOpCmd.cpp, particleAttrNode.cpp, polyModifierCmd.cpp, splitUVCmd.cpp, and testNobjectNode.cpp.

MStatus setObject | ( | MObject & | object | ) | `[virtual]`

Search for all occurrences

Attaches the Function Set to the specified Maya Object.

Parameters:

  [in] | object | Maya Object which is the target for attachment

Returns:
  Status Code (see below)

Status Codes:
  - MS::kSuccess Successful attachment
  - MS::kInvalidParameter Invalid parameter passed for object - could not access object, object does not exist or object is incompatible type

Reimplemented in MFnDagNode.

Examples:
  apiMeshShape.cpp, cgfxAttrDef.cpp, cgfxShaderCmd.cpp, closestPointCmd.cpp, closestPointOnCurveCmd.cpp, clusterWeightFunction.cpp, createClipCmd.cpp, findFileTexturesCmd.cpp, getAttrAffectsCmd.cpp, intersectCmd.cpp, particleAttrNode.cpp, pointOnMeshCmd.cpp, polyModifierCmd.cpp, swissArmyManip.cpp, testNobjectNode.cpp, and whatisCmd.cpp.

MStatus setObject | ( | const MObject & | object | ) | `[virtual]`

Search for all occurrences

NO SCRIPT SUPPORT.

Attaches the Function Set to the specified read-only Maya Object.

Parameters:

  [in] | object | Maya Object which is the target for attachment

Returns:
  Status Code (see below)

Status Codes:
  - MS::kSuccess Successful attachment
  - MS::kInvalidParameter Invalid parameter passed for object - could not access object, object does not exist or object is incompatible type

Reimplemented in MFnDagNode.

const char * className | ( |  | ) | `[static]`

Search for all occurrences

Returns the name of this class.

Returns:
  Name of this class.

Reimplemented in MFnPlugin.

MFnBase MFnBase MFnBase MFnBase MFnBase MFnBase MFnBase MFnBase MFnBase MFnBase
MFnBase MFnBase MFnBase MFnBase MFnBase MFnBase MFnBase MFnBase MFnBase MFnBase