本文整理汇总了C++中MIntArray类的典型用法代码示例。如果您正苦于以下问题:C++ MIntArray类的具体用法?C++ MIntArray怎么用?C++ MIntArray使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MIntArray类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tmFn
bool ProxyViz::loadInternal(MDataBlock& block)
{
MDataHandle tmH = block.inputValue(aplantTransformCache);
MFnPointArrayData tmFn(tmH.data());
MPointArray plantTms = tmFn.array();
if(plantTms.length() < 1) return false;
MDataHandle idH = block.inputValue(aplantIdCache);
MFnIntArrayData idFn(idH.data());
MIntArray plantIds = idFn.array();
if(plantIds.length() < 1) return false;
MDataHandle triH = block.inputValue(aplantTriangleIdCache);
MFnIntArrayData triFn(triH.data());
MIntArray plantTris = triFn.array();
if(plantTris.length() < 1) return false;
MDataHandle crdH = block.inputValue(aplantTriangleCoordCache);
MFnVectorArrayData crdFn(crdH.data());
MVectorArray plantCoords = crdFn.array();
if(plantCoords.length() < 1) return false;
MDataHandle cotH = block.inputValue(aplantOffsetCache);
MFnVectorArrayData cotFn(cotH.data());
MVectorArray plantOffsets = cotFn.array();
return loadPlants(plantTms, plantIds, plantTris, plantCoords, plantOffsets);
}
示例2: intersectArrays
//
// Intersect the current face list with the one provided, keep only the common elements
//
void meshMapUtils::intersectArrays( MIntArray& selection, MIntArray& moreFaces )
{
int j = selection.length() - 1;
while ( j >= 0 )
{
bool found = false;;
// For each item in moreFaces, try find it in fSelectedFaces
for( unsigned int i = 0 ; i < moreFaces.length(); i++ )
{
if( selection[j] == moreFaces[i] )
{
found = true;
break;
}
}
if( !found )
{
selection.remove(j);
}
j--;
}
}
示例3: findEdgeInfo
void CXRayObjectExport:: CreateSMGEdgeAttrs ( MFnMesh& fnMesh )
{
int numPolygons = fnMesh.numPolygons();
for ( int pid=0; pid<numPolygons; pid++ )
{
MIntArray vertexList;
fnMesh.getPolygonVertices( pid, vertexList );
int vcount = vertexList.length();
if(vcount!=3)
Msg( "poly vertex count not equel 3(is not a tri) vertex count = %d", vcount );
for ( int vid=0; vid<vcount;vid++ )
{
int a = vertexList[vid];
int b = vertexList[ vid==(vcount-1) ? 0 : vid+1 ];
SXREdgeInfoPtr elem = findEdgeInfo( a, b );
if ( NULL != elem )
{
set_edge_smooth_flag( polySmoothingGroups[pid], vid, elem->smooth );
}
}
}
}
示例4: p1p
MObject MG_poseReader::makePlane(const MVector& p1,const MVector& p2,const MVector& p3){
MFnMesh meshFn;
MPoint p1p (p1);
MPoint p2p (p2);
MPoint p3p (p3);
MPointArray pArray;
pArray.append(p1p);
pArray.append(p2p);
pArray.append(p3p);
MIntArray polyCount;
polyCount.append(3);
MIntArray polyConnect;
polyConnect.append(0);
polyConnect.append(1);
polyConnect.append(2);
MFnMeshData data;
MObject polyData = data.create();
MStatus stat;
meshFn.create(3,1,pArray,polyCount,polyConnect,polyData,&stat);
return polyData;
}
示例5: dData
bool
PxrUsdMayaWriteUtil::ReadMayaAttribute(
const MFnDependencyNode& depNode,
const MString& name,
VtIntArray* val)
{
MStatus status;
depNode.attribute(name, &status);
if (status == MS::kSuccess) {
MPlug plug = depNode.findPlug(name);
MObject dataObj;
if ( (plug.getValue(dataObj) == MS::kSuccess) &&
(dataObj.hasFn(MFn::kIntArrayData)) ) {
MFnIntArrayData dData(dataObj, &status);
if (status == MS::kSuccess) {
MIntArray arrayValues = dData.array();
size_t numValues = arrayValues.length();
val->resize(numValues);
for (size_t i = 0; i < numValues; ++i) {
(*val)[i] = arrayValues[i];
}
return true;
}
}
}
return false;
}
示例6: _GetLightingParam
static
bool
_GetLightingParam(
const MIntArray& intValues,
const MFloatArray& floatValues,
GfVec4f& paramValue)
{
bool gotParamValue = false;
if (intValues.length() >= 3) {
paramValue[0] = intValues[0];
paramValue[1] = intValues[1];
paramValue[2] = intValues[2];
if (intValues.length() > 3) {
paramValue[3] = intValues[3];
}
gotParamValue = true;
} else if (floatValues.length() >= 3) {
paramValue[0] = floatValues[0];
paramValue[1] = floatValues[1];
paramValue[2] = floatValues[2];
if (floatValues.length() > 3) {
paramValue[3] = floatValues[3];
}
gotParamValue = true;
}
return gotParamValue;
}
示例7: GetAdjacency
MStatus GetAdjacency(MDagPath& pathMesh, std::vector<std::set<int> >& adjacency) {
MStatus status;
// Get mesh adjacency. The adjacency will be all vertex ids on the connected faces.
MItMeshVertex itVert(pathMesh, MObject::kNullObj, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
MFnMesh fnMesh(pathMesh, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
adjacency.resize(itVert.count());
for (; !itVert.isDone(); itVert.next()) {
MIntArray faces;
status = itVert.getConnectedFaces(faces);
CHECK_MSTATUS_AND_RETURN_IT(status);
adjacency[itVert.index()].clear();
// Put the vertex ids in a set to avoid duplicates
for (unsigned int j = 0; j < faces.length(); ++j) {
MIntArray vertices;
fnMesh.getPolygonVertices(faces[j], vertices);
for (unsigned int k = 0; k < vertices.length(); ++k) {
if (vertices[k] != itVert.index()) {
adjacency[itVert.index()].insert(vertices[k]);
}
}
}
}
return MS::kSuccess;
}
示例8: createHelperMesh
void SoftBodyNode::createHelperMesh(MFnMesh &mayaMesh, std::vector<int> &triIndices, std::vector<float> &triVertices, MSpace::Space space)
{
MFloatPointArray ptArray;
mayaMesh.getPoints(ptArray, space);
// append vertex locations (x, y, z) into "flattened array"
for(int i = 0; i < ptArray.length(); i++)
{
MFloatPoint pt;
pt = ptArray[i];
pt.cartesianize();
triVertices.push_back(pt.x);
triVertices.push_back(pt.y);
triVertices.push_back(pt.z);
}
std::cout << std::endl;
// create vector of triangle indices
MIntArray tCounts;
MIntArray tVerts;
mayaMesh.getTriangles(tCounts, tVerts);
triIndices.resize(tVerts.length());
for(int i = 0; i < tVerts.length(); i ++)
{
triIndices[i] = tVerts[i];
}
}
示例9: getPolygonPoints
MPointArray* retargetLocator::getPolygonPoints( MFnMesh& inputMesh )
{
polygonNum = inputMesh.numPolygons();
MPointArray inputMeshPoints;
inputMesh.getPoints( inputMeshPoints );
MPointArray* polygonPoints = new MPointArray[ polygonNum ];
MIntArray polyVertexIndies;
for( int polygonId =0; polygonId < polygonNum; polygonId++ )
{
inputMesh.getPolygonVertices( polygonId, polyVertexIndies );
int length = polyVertexIndies.length();
polygonPoints[polygonId].setLength( length );
for( int i=0; i < length; i++ )
{
polygonPoints[polygonId].set( inputMeshPoints[ polyVertexIndies[i] ], i );
}
}
return polygonPoints;
}
示例10: edgeIter
//---------------------------------------------------------------------------
void componentConverter::getConnectedFaces(MIntArray& edgeIDs,
MIntArray& result )
//---------------------------------------------------------------------------
{
MItMeshEdge edgeIter(mesh);
MIntArray connectedFaces;
result.clear();
unsigned int l = edgeIDs.length();
for(unsigned int i = 0; i < l; i++)
{
edgeIter.setIndex(edgeIDs[i],tmp);
edgeIter.getConnectedFaces(connectedFaces);
for(unsigned int x = 0; x < connectedFaces.length();x++)
{
result.append(connectedFaces[x]);
}
}
}
示例11: compute_halfedge_indices
MStatus compute_halfedge_indices(MIntArray &nFV, MIntArray &F, MIntArray &selV, MIntArray &selF, MIntArray &selHE)
{
MIntArray F2H(nFV.length(), 0);
size_t cumsum = 0;
for (size_t k=0; k<nFV.length(); k++)
{
F2H[k] = cumsum;
cumsum += nFV[k];
}
selHE.setLength(selF.length());
for (size_t k=0; k<selF.length(); k++)
{
size_t cV = selV[k];
size_t cF = selF[k];
size_t cnFV = nFV[cF];
size_t cF2H = F2H[cF];
for (size_t kFV=0; kFV<cnFV; kFV++)
{
if (F[cF2H+kFV]==cV)
{
selHE[k] = cF2H + kFV; break;
}
}
}
return MS::kSuccess;
}
示例12: vIt
MStatus MVGMesh::unsetAllBlindData() const
{
MStatus status;
// Get all vertices
MItMeshVertex vIt(_dagpath, MObject::kNullObj, &status);
vIt.updateSurface();
vIt.geomChanged();
MIntArray componentId;
while(!vIt.isDone())
{
const int index = vIt.index(&status);
componentId.append(index);
vIt.next();
}
MVGEditCmd* cmd = new MVGEditCmd();
if(cmd)
{
cmd->clearBD(_dagpath, componentId);
MArgList args;
if(cmd->doIt(args))
cmd->finalize();
}
delete cmd;
return status;
}
示例13: polyIter
int SelectRingToolCmd2::navigateFace(
const MDagPath &dagPath,
const int faceIndex,
const int edgeIndex,
const Location loc )
{
int prevIndex;
MItMeshPolygon polyIter( dagPath );
polyIter.setIndex( faceIndex, prevIndex );
// Get the face's edges
MIntArray edges;
polyIter.getEdges( edges );
// Find the edge in the current face
unsigned int i;
for( i=0; i < edges.length(); i++ )
{
if( edgeIndex == edges[i] )
{
int offset;
if( loc == OPPOSITE )
offset = edges.length() / 2;
else
offset = (loc == NEXT) ? 1 : -1;
return edges[ (i + offset) % edges.length() ];
}
}
return -1; // Should never reach here
}
示例14: dagPath
IECoreScene::PrimitiveVariable FromMayaMeshConverter::normals() const
{
MFnMesh fnMesh;
const MDagPath *d = dagPath( true );
if( d )
{
fnMesh.setObject( *d );
}
else
{
fnMesh.setObject( object() );
}
V3fVectorDataPtr normalsData = new V3fVectorData;
normalsData->setInterpretation( GeometricData::Normal );
vector<V3f> &normals = normalsData->writable();
normals.reserve( fnMesh.numFaceVertices() );
int numPolygons = fnMesh.numPolygons();
V3f blankVector;
if( space() == MSpace::kObject )
{
const float* rawNormals = fnMesh.getRawNormals(0);
MIntArray normalIds;
for( int i=0; i<numPolygons; i++ )
{
fnMesh.getFaceNormalIds( i, normalIds );
for( unsigned j=0; j < normalIds.length(); ++j )
{
const float* normalIt = rawNormals + 3 * normalIds[j];
normals.push_back( blankVector );
V3f& nn = normals.back();
nn.x = *normalIt++;
nn.y = *normalIt++;
nn.z = *normalIt;
}
}
}
else
{
MFloatVectorArray faceNormals;
for( int i=0; i<numPolygons; i++ )
{
fnMesh.getFaceVertexNormals( i, faceNormals, space() );
for( unsigned j=0; j<faceNormals.length(); j++ )
{
MFloatVector& n = faceNormals[j];
normals.push_back( blankVector );
V3f& nn = normals.back();
nn.x = n.x;
nn.y = n.y;
nn.z = n.z;
}
}
}
return PrimitiveVariable( PrimitiveVariable::FaceVarying, normalsData );
}
示例15: makeCubes
static void makeCubes(std::vector<cube> &cubes, MString &name, MStatus *stat)
{
MFnMesh fnMesh;
MObject result;
MFloatPointArray points;
MIntArray faceCounts;
MIntArray faceConnects;
int index_offset = 0;
for (std::vector<cube>::iterator cit = cubes.begin(); cit != cubes.end(); ++cit)
{
point3 diag = cit->diagonal();
float scale = diag.x;
point3 pos = cit->start + (diag * .5f);
MFloatVector mpos(pos.x, pos.y, pos.z);
addCube(scale, mpos, index_offset * (8), points, faceCounts, faceConnects);
index_offset += 1;
}
unsigned int vtx_cnt = points.length();
unsigned int face_cnt = faceCounts.length();
MObject newMesh =
fnMesh.create(
/* numVertices */ vtx_cnt,
/* numFaces */ face_cnt,
points,
faceCounts,
faceConnects,
MObject::kNullObj,
stat);
/* Harden all edges. */
int n_edges = fnMesh.numEdges(stat);
for (int i = 0; i < n_edges; ++i)
{
fnMesh.setEdgeSmoothing(i, false);
}
fnMesh.cleanupEdgeSmoothing(); /* Must be called after editing edges. */
fnMesh.updateSurface();
/* Assign Shader. */
MSelectionList sel_list;
if (!MFAIL(sel_list.add("initialShadingGroup")))
{
MObject set_obj;
sel_list.getDependNode(0, set_obj);
MFnSet set(set_obj);
set.addMember(newMesh);
}
/* Give it a swanky name. */
MFnDagNode parent(fnMesh.parent(0));
name = parent.setName("polyMengerSponge", false, stat);
}