MaxwellMayaMesh class
Description
This class represents triangle mesh objects. It allows you to specify or retrieve the geometry data, as well as assign per-triangle materials. The inherited method GetShapeType
returns ShapeType_Mesh
. You can create meshes by calling the MaxwellMayaAPI::CreateMesh
method.
Base class: MaxwellMayaShape
.
Methods
bool | SetPosition(unsigned int positionIndex, unsigned int stepIndex, const MPoint& position) |
bool | SetPositions(unsigned int stepIndex, const float* positions) |
bool | SetPositions(unsigned int stepIndex, const double* positions) |
bool | SetPositions(unsigned int stepIndex, const MFloatPointArray& positions) |
bool | SetPositions(unsigned int stepIndex, const MPointArray& positions) |
bool | SetNormal(unsigned int normalIndex, unsigned int stepIndex, const MVector& normal) |
bool | SetNormals(unsigned int stepIndex, const float* normals) |
bool | SetNormals(unsigned int stepIndex, const double* normals) |
bool | SetNormals(unsigned int stepIndex, const MFloatVectorArray& normals) |
bool | SetNormals(unsigned int stepIndex, const MVectorArray& normals) |
bool | SetTriangle(unsigned int triangleIndex, unsigned int posIdx0, unsigned int posIdx1, unsigned int posIdx2, unsigned int normIdx0, unsigned int normIdx1, unsigned int normIdx2) |
bool | SetTriangles(const unsigned int* positionIndices, const unsigned int* normalIndices) |
bool | SetTriangles(const MIntArray& positionIndices, const MIntArray& normalIndices) |
bool | CreateUVSets(unsigned int count) |
bool | SetTriangleUVs(unsigned int triangleIndex, unsigned int setIndex, double u0, double v0, double u1, double v1, double u2, double v2) |
bool | SetUVs(unsigned int setIndex, const float* uvs) |
bool | SetUVs(unsigned int setIndex, const double* uvs) |
bool | SetUVs(unsigned int setIndex, const MFloatArray& uvs) |
bool | SetUVs(unsigned int setIndex, const MDoubleArray& uvs) |
bool | SetTriangleMaterial(unsigned int triangleIndex, const MaxwellMayaMaterial* material) |
bool | SetTrianglesMaterial(unsigned int numTriangles, const unsigned int* triangleIndices, const MaxwellMayaMaterial* material) |
bool | SetTrianglesMaterial(const MIntArray& triangleIndices, const MaxwellMayaMaterial* material) |
bool | AddGeometryModifier(const MaxwellMayaExtensionParams* params) |
unsigned int | GetNumPositions() const |
unsigned int | GetNumNormals() const |
unsigned int | GetNumTriangles() const |
unsigned int | GetNumSteps() const |
unsigned int | GetNumUVSets() const |
bool | GetPosition(unsigned int positionIndex, unsigned int stepIndex, MPoint& position) const |
bool | GetPositions(unsigned int stepIndex, MPointArray& positions) const |
bool | GetNormal(unsigned int normalIndex, unsigned int stepIndex, MVector& normal) const |
bool | GetNormals(unsigned int stepIndex, MVectorArray& normals) const |
bool | GetTriangle(unsigned int triangleIndex, unsigned int& posIdx0, unsigned int& posIdx1, unsigned int& posIdx2, unsigned int& normIdx0, unsigned int& normIdx1, unsigned int& normIdx2) const |
bool | GetTriangles(MIntArray& positionIndices, MIntArray& normalIndices) const |
bool | GetTriangleUVs(unsigned int triangleIndex, unsigned int setIndex, double& u0, double& v0, double& u1, double& v1, double& u2, double& v2) const |
bool | GetUVs(unsigned int setIndex, MFloatArray& uvs) const |
MaxwellMayaMaterial* | GetTriangleMaterial(unsigned int triangleIndex) |
const MaxwellMayaMaterial* | GetTriangleMaterial(unsigned int triangleIndex) const |
Inherited methods |
bool SetPosition(unsigned int positionIndex, unsigned int stepIndex, const MPoint& position)
Sets the position for a vertex. The positionIndex argument must be between 0 and GetNumPositions()
- 1. The number of vertices is specified when the mesh is created and cannot be changed afterwards. The stepIndex argument is relevant when motion blur is enabled. Specify 0 for the initial position or 1 for the final position (Maxwell currently supports only two deformation steps). The number of deformation steps is defined when the mesh is created. In Python, the position argument can be any object which has x
, y
and z
floating point members.
bool SetPositions(unsigned int stepIndex, const float* positions)
bool SetPositions(unsigned int stepIndex, const double* positions)
bool SetPositions(unsigned int stepIndex, const MFloatPointArray& positions)
bool SetPositions(unsigned int stepIndex, const MPointArray& positions)
Set all the vertex positions in one call. The arrays must have exactly GetNumPositions()
elements. The meaning of the stepIndex argument is the same as in the SetPosition
method. In Python, the positions argument can either be a flat list of floating point numbers, in which case it is interpreted as a sequence of x, y, z values (so there must be 3*GetNumPositions()
elements) or a list of objects which have x
, y
and z
floating point members (e.g OpenMaya.MVector
).
bool SetNormal(unsigned int normalIndex, unsigned int stepIndex, const MVector& normal)
Sets the normal at the given index. The normalIndex argument must be between 0 and GetNumNormals()
- 1. The number of normals is specified when the mesh is created and cannot be changed afterwards. The stepIndex argument has the same meaning as in the SetPosition
method. In Python, the normal argument can be any object which has x
, y
and z
floating point members.
bool SetNormals(unsigned int stepIndex, const float* normals)
bool SetNormals(unsigned int stepIndex, const double* normals)
bool SetNormals(unsigned int stepIndex, const MFloatVectorArray& normals)
bool SetNormals(unsigned int stepIndex, const MVectorArray& normals)
Set all the normals in one call. The arrays must have exactly GetNumNormals()
elements. The meaning of stepIndex is the same as in the SetPosition
method. In Python, the types accepted for the normals argument are the same as in the SetPositions
method.
bool SetTriangle(unsigned int triangleIndex, unsigned int posIdx0, unsigned int posIdx1, unsigned int posIdx2, unsigned int normIdx0, unsigned int normIdx1, unsigned int normIdx2)
Set the position indices and normal indices for the given triangle. The triangleIndex argument must be between 0 and GetNumTriangles()
- 1. The number of triangles is specified when the mesh is created and cannot be changed afterwards. The position indices must be between 0 and GetNumPositions()
- 1, while the normal indices must be between 0 and GetNumNormals()
- 1.
bool SetTriangles(const unsigned int* positionIndices, const unsigned int* normalIndices)
bool SetTriangles(const MIntArray& positionIndices, const MIntArray& normalIndices)
Set all the triangle indices in one call. The arrays must have exactly 3*GetNumTriangles()
elements. The Python version accepts either flat arrays of integers, or arrays of 3-tuples. When you pass 3-tuples, the arrays must have GetNumTriangles()
elements, since there's one tuple per triangle.
bool CreateUVSets(unsigned int count)
Add the specified number of UV sets to the mesh, preserving any existing sets.
bool SetTriangleUVs(unsigned int triangleIndex, unsigned int setIndex, double u0, double v0, double u1, double v1, double u2, double v2)
Set the UVs for the specified triangle. The triangleIndex argument must be between 0 and GetNumTriangles()
- 1. The setIndex argument must be between 0 and GetNumUVSets()
- 1.
bool SetUVs(unsigned int setIndex, const float* uvs)
bool SetUVs(unsigned int setIndex, const double* uvs)
bool SetUVs(unsigned int setIndex, const MFloatArray& uvs)
bool SetUVs(unsigned int setIndex, const MDoubleArray& uvs)
Set all the UVs for the given set in one call. The arrays must have exactly 6*GetNumTriangles()
items and the element order is the same as in the SetTriangleUVs()
call: u0, v0, u1, v1, u2, v2. The Python version accepts either a flat array of floating point numbers, or an array of 6-tuples. When you pass 6-tuples, the array must have GetNumTriangles()
elements, since there's one tuple per triangle.
bool SetTriangleMaterial(unsigned int triangleIndex, const MaxwellMayaMaterial* material)
Assign the specified material to a triangle. The triangleIndex argument must be between 0 and GetNumTriangles()
- 1. You can apply a material on the entire object using the SetMaterial
method inherited from MaxwellMayaShape
, then override it at the triangle level using this method; or you can explicitly set the material for each triangle. Do not leave triangles without material, or Maxwell will fail to render the scene. The material argument cannot be NULL. The only way to remove a material from a triangle is to apply the object-level material on it. The Python version accepts a list of integers for the first argument, in which case it applies the given material on each of the triangle indices contained in the list.
bool SetTrianglesMaterial(unsigned int numTriangles, const unsigned int* triangleIndices, const MaxwellMayaMaterial* material)
bool SetTrianglesMaterial(const MIntArray& triangleIndices, const MaxwellMayaMaterial* material)
Applies the given material on each triangle index contained in the triangleIndices array. These methods do not exist in Python because the equivalent functionality is available there by passing a list of indices as the first argument to SetTriangleMaterial
.
bool AddGeometryModifier(const MaxwellMayaExtensionParams* params)
Adds a geometry modifier extension to the object. Geometry modifiers are Maxwell plug-ins which get called by the engine before rendering to perform modifications on the mesh.
unsigned int GetNumPositions() const
Returns the number of positions for the mesh. This value is specified when the mesh is created and cannot be changed afterwards.
unsigned int GetNumNormals() const
Returns the number of normals for the mesh. This value is specified when the mesh is created and cannot be changed afterwards.
unsigned int GetNumTriangles() const
Returns the number of triangles for the mesh. This value is specified when the mesh is created and cannot be changed afterwards.
unsigned int GetNumSteps() const
Returns the number of deformation steps defined for the mesh. Maxwell currently supports at most two deformation steps, so this function returns 1 or 2. This value is specified when the mesh is created and cannot be changed afterwards.
unsigned int GetNumUVSets() const
Returns the number of UV sets contained in the mesh.
bool GetPosition(unsigned int positionIndex, unsigned int stepIndex, MPoint& position) const
Copies the position for the vertex specified by positionIndex into the position output argument. The positionIndex parameter must be between 0 and GetNumPositions()
- 1. The stepIndex
argument has the same meaning as in the SetPosition
method. The Python version takes only the first two arguments and returns an OpenMaya.MPoint
object.
bool GetPositions(unsigned int stepIndex, MPointArray& positions) const
Places all the vertex positions for the mesh in the positions output argument. The stepIndex parameter has the same meaning as in the SetPosition
method. The Python version takes only the first argument and returns a list of OpenMaya.MPoint
objects.
bool GetNormal(unsigned int normalIndex, unsigned int stepIndex, MVector& normal) const
Copies the normal specified by normalIndex into the normal output argument. The normalIndex parameter must be between 0 and GetNumNormals()
- 1. The stepIndex argument has the same meaning as in the SetPosition
method. The Python version takes only the first two arguments and returns an OpenMaya.MVector
object.
bool GetNormals(unsigned int stepIndex, MVectorArray& normals) const
Places all the normals for the mesh in the normals output argument. The stepIndex parameter has the same meaning as in the SetPosition
method. The Python version takes only the first argument and returns a list of OpenMaya.MVector
objects.
bool GetTriangle(unsigned int triangleIndex, unsigned int& posIdx0, unsigned int& posIdx1, unsigned int& posIdx2, unsigned int& normIdx0, unsigned int& normIdx1, unsigned int& normIdx2) const
Copies the position and normal indices for the triangle specified by triangleIndex into the posIdx* and normIdx* output arguments. The triangleIndex parameter must be between 0 and GetNumTriangles()
- 1. The Python version takes only the first argument and returns a 6-tuple containing the indices in the same order as the parameters of the C++ method.
bool GetTriangles(MIntArray& positionIndices, MIntArray& normalIndices) const
Places the position and normal indices for the mesh in the given arrays. The Python version takes no arguments and returns a tuple containing the two lists. Each list contains 3-tuples of indices, one for each triangle.
bool GetTriangleUVs(unsigned int triangleIndex, unsigned int setIndex, double& u0, double& v0, double& u1, double& v1, double& u2, double& v2) const
Copies the UVs for the given triangle and set index into the output arguments. The triangleIndex argument must be between 0 and GetNumTriangles()
- 1, while setIndex must be between 0 and GetNumUVSets()
- 1. The Python version takes only the first two arguments and returns a 6-tuple with the UV values.
bool GetUVs(unsigned int setIndex, MFloatArray& uvs) const
Returns all the UVs for the set specified by setIndex. The setIndex argument must be between 0 and GetNumUVSets()
- 1. The array will contain 6 values for each triangle, in the same order as the output arguments of GetTriangleUVs
. The Python version takes only the setIndex argument and returns a list of 6-tuples.
MaxwellMayaMaterial* GetTriangleMaterial(unsigned int triangleIndex)
const MaxwellMayaMaterial* GetTriangleMaterial(unsigned int triangleIndex) const
Returns the material assigned to the given triangle. The triangleIndex argument must be between 0 and GetNumTriangles()
- 1. If no material is assigned explicitly to the triangle, the C++ version returns NULL and the Python version returns None.