상세 컨텐츠

본문 제목

MFnMesh create function

Maya API/C++

by hwano 2014. 1. 23. 18:16

본문

 

MObject create ( int 

numVertices,                                                              

int 

numPolygons,                                                            

const MPointArray vertexArray,
const MIntArray polygonCounts,
const MIntArray polygonConnects,
const MFloatArray uArray,
const MFloatArray vArray,
MObject  parentOrOwner = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Creates a new polygonal mesh given an array of vertices, polygon connection information, UV information, and sets this function set to operate on the new surface.

This method is meant to be as efficient as possible and thus assumes that all the given data is topologically correct.

The parentOrOwner argument is used to specify the owner of the new surface.

If the parentOrOwner is kMeshData then the created surface will be of type kMeshGeom and will be returned. The parentOrOwner will become the owner of the new mesh.

If parentOrOwner is NULL then a new transform will be created and returned which will be the parent for the mesh. The new transform will be added to the DAG.

If parentOrOwner is a DAG node then the new mesh will be returned and the parentOrOwner will become its parent.

The uv arrays must be of equal size. After using this method to create the mesh and the UV values, you can call assignUVs to assign the corresponding UV ids to the geometry.

Parameters:
[in] numVertices number of vertices
[in] numPolygons number of polygons
[in] vertexArray point (vertex) array. This should include all the vertices in the mesh, and no extras. For example, a cube could have the vertices: { (-1,-1,-1), (1,-1,-1), (1,-1,1), (-1,-1,1), (-1,1,-1), (-1,1,1), (1,1,1), (1,1,-1) }
[in] polygonCounts array of vertex counts for each polygon. For example the cube would have 6 faces, each of which had 4 verts, so the polygonCounts would be {4,4,4,4,4,4}.
[in] polygonConnects

array of vertex connections for each polygon. For example, in the cube, we have 4 vertices for every face, so we list the vertices for face0, face1, etc consecutively in the array. These are specified by indexes in the vertexArray: e.g for the cube: { 0, 1, 2, 3, 4, 5, 6, 7, 3, 2, 6, 5, 0, 3, 5, 4,0, 4, 7, 1, 1, 7, 6, 2 }    

//이부분이 4개씩 묶은 묶음 속에서 각자의 인덱스 상 순서가 상관이 있는지 없는지 모르겠다.

[in] uArray The array of u values to be set
[in] vArray The array of v values to be set
[in] parentOrOwner parent of the polygon that will be created
[out] ReturnStatus Status code
Returns:
  • If parentOrOwner is NULL then the transform for this surface is returned
  • If parentOrOwner is a DAG object then the new surface shape is returned
  • The surface geometry is returned if parentOrOwner is of type kMeshData
Status Codes:

관련글 더보기