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

- Class List
- Class Hierarchy
- Class Members

Public Member Functions | Protected Member Functions

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

Search for all occurrences

## Detailed Description

String array function set for dependency node data.

MFnStringArrayData allows the creation and manipulation of MStringArray data objects for use in the dependency graph.

If a user written dependency node either accepts or produces MStringArrays, then this class is used to extract or create the data that comes from or goes to other dependency graph nodes. The MDataHandle::type method will return kStringArray when data of this type is present. To access it, the MDataHandle::data method is used to get an MObject for the data and this should then be used to initialize an instance of MFnStringArrayData.

Examples:

  cgfxShaderNode.cpp, and hlslShader.cpp.

`#include <MFnStringArrayData.h>`

Inheritance diagram for MFnStringArrayData:
[legend]

List of all members.

## Public Member Functions
virtual MFn::Type | type () const
| Function set type.
virtual | ~MFnStringArrayData ()
| Destructor.
| MFnStringArrayData ()
| Default constructor.
| MFnStringArrayData (MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
unsigned int | length (MStatus *ReturnStatus=NULL) const
| Return the number of strings in the instance.
MStatus | set (const MString &element, unsigned int index)
| Set the element at the specified index of the array.
MStatus | copyTo (MStringArray &) const
| Copy all the strings in the instance into the given MStringArray.
MStatus | set (const MStringArray &newArray)
| Set the instance to contain the strings defined in the given MStringArray.
MStringArray | array (MStatus *ReturnStatus=NULL)
| Return an MStringArray containing the string array currently operated upon by the function set.
MObject | create (MStatus *ReturnStatus=NULL)
| Create a new MObject, attach it to this instance, and initialize it to contain no strings.
MObject | create (const MStringArray &in, MStatus *ReturnStatus=NULL)
| Create a new MObject, attach it to this instance, and initialize it to contain the data from the given MStringArray.
const MString & | operator[] (unsigned int index) const
| Extract the indicated MString from the const instance.
| MFnStringArrayData (const MObject &object, MStatus *ReturnStatus=NULL)
| Constructor.
MString & | operator[] (unsigned int index)
| NO SCRIPT SUPPORT.
## Protected Member Functions
virtual const char * | className () const
| Class name.

## Constructor & Destructor Documentation

MFnStringArrayData | ( | MObject & | object,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Constructor.

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

Parameters:

  [in] | object | The MObject to attach the function set to
  [out] | ReturnStatus | the return status

Status Codes:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

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

Constructor.

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

Parameters:

  [in] | object | The MObject to attach the function set to
  [out] | ReturnStatus | the return status

Status Codes:
  - MS::kSuccess if the function set is successfully attached
  - MS::kInvalidParameter if the MObject does not represent a valid Maya object or if the function set is not allowed to attach to this MObject

## Member Function Documentation

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

Search for all occurrences

Function set type.

Return the class type : MFn::kStringArrayData.

Reimplemented from MFnData.

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

Search for all occurrences

Class name.

Return the class name : "MFnStringArrayData".

Reimplemented from MFnData.

unsigned int length | ( | MStatus * | ReturnStatus = `NULL` | ) | const

Search for all occurrences

Return the number of strings in the instance.

Parameters:

  [out] | ReturnStatus | kFailure if the instance is not attached to an MObject, and kSuccess otherwise.

Returns:
  The number of strings in the instance

MStatus set | ( | const MString & | element,
|  | unsigned int | index
| ) |  |

Search for all occurrences

Set the element at the specified index of the array.

No checking is done by this class to ensure that the index is valid - use the length method to determine the size of the array.

Parameters:

  [in] | element | the element
  [in] | index | the index of the MString to set

Returns:
  - kSuccess operation successful
  - kFailure instance is not attached to an MObject

MStatus copyTo | ( | MStringArray & | dest | ) | const

Search for all occurrences

Copy all the strings in the instance into the given MStringArray.

Parameters:

  [out] | dest | the MStringArray to populate

Returns:
  - kSuccess operation successful
  - kFailure instance is not attached to an MObject

MStatus set | ( | const MStringArray & | array | ) |

Search for all occurrences

Set the instance to contain the strings defined in the given MStringArray.

Parameters:

  [in] | array | the MStringArray containing the data to set into this instance

Returns:
  - kSuccess operation successful
  - kFailure instance is not attached to an MObject

MStringArray array | ( | MStatus * | ReturnStatus = `NULL` | ) |

Search for all occurrences

Return an MStringArray containing the string array currently operated upon by the function set.

The MStringArray returned by this method is editable, so any changes to the return instance also affects the MObject operated upon by this function set.

Parameters:

  [out] | ReturnStatus | kFailure if the instance is not attached to an MObject, and kSuccess otherwise.

Returns:
  A copy of the MStringArray held in this instance

MObject create | ( | MStatus * | ReturnStatus = `NULL` | ) |

Search for all occurrences

Create a new MObject, attach it to this instance, and initialize it to contain no strings.

Parameters:

  [out] | ReturnStatus | kSuccess

Returns:
  The newly created MObject

Examples:
  cgfxShaderNode.cpp, and hlslShader.cpp.

MObject create | ( | const MStringArray & | arr,
|  | MStatus * | ReturnStatus = `NULL`
| ) |  |

Search for all occurrences

Create a new MObject, attach it to this instance, and initialize it to contain the data from the given MStringArray.

Parameters:

  [in] | arr | the data to use when initializing this instance
  [out] | ReturnStatus | kSuccess

Returns:
  The newly created MObject

const MString & operator[] | ( | unsigned int | index | ) | const

Extract the indicated MString from the const instance.

No checking is done by this class to ensure that the index is valid - use the length method to determine the size of the array. If the instance is not attached to an MObject, this method will return an MString containing "".

Parameters:

  [in] | index | the index of the MString to extract

Returns:
  The indicated MString

MString & operator[] | ( | unsigned int | index | ) |

NO SCRIPT SUPPORT.

Extract the indicated MString from the instance.

by the function set. The MString returned by this method is editable, so any changes to the return instance also affects the MObject operated upon by this function set.

No checking is done by this class to ensure that the index is valid - use the length method to determine the size of the array. If the instance is not attached to an MObject, this method will return an MString containing "".

Parameters:

  [in] | index | the index of the MString to extract

Returns:
  The indicated MString

MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData
MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData MFnStringArrayData