当前位置: 首页>>代码示例>>C++>>正文


C++ MIntArray::append方法代码示例

本文整理汇总了C++中MIntArray::append方法的典型用法代码示例。如果您正苦于以下问题:C++ MIntArray::append方法的具体用法?C++ MIntArray::append怎么用?C++ MIntArray::append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MIntArray的用法示例。


在下文中一共展示了MIntArray::append方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: populateInfluenceIndexArray

void skinClusterWeights::populateInfluenceIndexArray(MFnSkinCluster &skinClusterFn, MIntArray &influenceIndexArray)
{
   MStatus status;

   MIntArray  allIndexArray;
   MDagPathArray pathArray;
   skinClusterFn.influenceObjects(pathArray, &status);
   for (unsigned j = 0; j < pathArray.length(); j++) {
	allIndexArray.append(skinClusterFn.indexForInfluenceObject(pathArray[j]));
   }

   if (influenceArray.length() > 0) {
        // Add the influence indices for the influence objects specified in the cmd
        for (unsigned j = 0; j < influenceArray.length(); j++) {
	    unsigned int index = skinClusterFn.indexForInfluenceObject(influenceArray[j], &status);
	    for (unsigned k = 0; k < allIndexArray.length(); k++) {
	        if ((int)index == allIndexArray[k]) {
		    influenceIndexArray.append(k);
		}
	    }
	}
    } else {
        // Add the influence indices for all the influence objects of the skinCluster
	for (unsigned j = 0; j < allIndexArray.length(); j++) {
	    influenceIndexArray.append(j);
	}
    }
}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:28,代码来源:skinClusterWeights.cpp

示例2: makePlane

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;

}
开发者ID:bungnoid,项目名称:MG_Tools,代码行数:32,代码来源:MG_poseReader.cpp

示例3: GetLocalIndex

MIntArray GetLocalIndex( MIntArray & getVertices, MIntArray & getTriangle )
{
	MIntArray   localIndex;
	unsigned    gv, gt;

	assert ( getTriangle.length() == 3 );    // Should always deal with a triangle

	for ( gt = 0; gt < getTriangle.length(); gt++ )
	{
		for ( gv = 0; gv < getVertices.length(); gv++ )
		{
			if ( getTriangle[gt] == getVertices[gv] )
			{
				localIndex.append( gv );
				break;
			}
		}

		// if nothing was added, add default "no match"
		if ( localIndex.length() == gt )
			localIndex.append( -1 );
	}

	return localIndex;
}
开发者ID:nkostelnik,项目名称:importer,代码行数:25,代码来源:MayaReader.cpp

示例4: create_shape

MStatus metro_model_translator::create_shape( const m2033::mesh_ptr m )
{
	MFloatPointArray v;
	MVectorArray norm;
	MIntArray p;
	MIntArray idx;

	MFnTransform transform_fn;
	MObject transform_obj = transform_fn.create( MObject::kNullObj );
	transform_fn.setName( m->get_name().c_str() );

	m2033::mesh::vertices mv = m->get_vertices();
	m2033::mesh::indices mi = m->get_indices();
	m2033::mesh::texcoords mt = m->get_tex_coords();
	m2033::mesh::normals mn = m->get_normals();

	for( unsigned i = 0; i < mv.size(); i++ ) {
		v.append( -mv[i].x, mv[i].y, mv[i].z );
		norm.append( MVector( -mn[i].x, mn[i].y, mn[i].z ) );
	}

	for( unsigned i = 0; i < mi.size() / 3; i++ ) {
		idx.append( mi[i*3+2] );
		idx.append( mi[i*3+1] );
		idx.append( mi[i*3] );
		p.append( 3 );
	}

	MFloatArray u_values, v_values;
	for( unsigned i = 0; i < mt.size(); i++ ) {
		u_values.append( mt[i].x );
		v_values.append( -mt[i].y );
	}

	MFnMesh meshFn;
	MObject mesh = meshFn.create( v.length(), p.length(), v, p, idx, u_values, v_values, transform_obj );
	MString name = m->get_name().c_str();
	meshFn.setName( name + MString("_shape") );

	MStatus s = meshFn.assignUVs( p, idx, 0 );
	if( !s ) {
		return s;
	}

	s = meshFn.unlockVertexNormals( idx );
	if( !s ) {
		return s;
	}
	meshFn.setVertexNormals( norm, idx );

	MObject mat = create_material( m->get_texture_name(), &s );
	if( !s ) {
		return s;
	}
	MFnSet mat_fn(mat);
	mat_fn.addMember(mesh);

	return MS::kSuccess;
}
开发者ID:CakeZCanaaN,项目名称:metro2033-tools,代码行数:59,代码来源:metro_model_translator.cpp

示例5: unsetAllBlindData

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;
}
开发者ID:jonntd,项目名称:mayaMVG,代码行数:27,代码来源:MVGMesh.cpp

示例6: rateValue

MStatus sweptEmitter::emitCountPerPoint
	(
		const MPlug &plug,
		MDataBlock &block,
		int length,					// length of emitCountPP
		MIntArray &emitCountPP		// output: emitCount for each point
	)
//
//	Descriptions:
//		Compute emitCount for each point where new particles come from.
//
{
	MStatus status;

	int plugIndex = plug.logicalIndex( &status );
	McheckErr(status, "ERROR in emitCountPerPoint: when plug.logicalIndex.\n");

	// Get rate and delta time.
	//
	double rate = rateValue( block );
	MTime dt = deltaTimeValue( plugIndex, block );

	// Compute emitCount for each point.
	//
	double dblCount = rate * dt.as( MTime::kSeconds );

	int intCount = (int)dblCount;
	for( int i = 0; i < length; i++ )
	{
		emitCountPP.append( intCount );
	}

	return( MS::kSuccess );
}
开发者ID:DimondTheCat,项目名称:xray,代码行数:34,代码来源:sweptEmitter.cpp

示例7: 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]);
		}		
	}

}
开发者ID:Byron,项目名称:bsuite,代码行数:26,代码来源:componentConverter.cpp

示例8: appendToMesh

void mesh::appendToMesh(MPointArray& points, MIntArray& faceCounts,MIntArray& faceConnects){
	for(int i=0;i<gPoints.length();i++){
		points.append(gPoints[i]);
	}
	for(int i=0;i<gFaceCounts.length();i++){
		faceCounts.append(gFaceCounts[i]);
	}
	for(int i=0;i<gFaceConnects.length();i++){
		faceConnects.append(gFaceConnects[i]);
	}
	if(gPoints.length()==0){
		std::string s=std::to_string((long double)gPoints.length());
		MGlobal::displayInfo(MString(s.c_str()));
		s=std::to_string((long double)gFaceCounts[0]);
		MGlobal::displayInfo(MString(s.c_str()));
		s=std::to_string((long double)gFaceConnects.length());
		MGlobal::displayInfo(MString(s.c_str()));
	}
}
开发者ID:siqihuang,项目名称:Movable-Tree,代码行数:19,代码来源:mesh.cpp

示例9: restoreClassParameterStates

void ParameterisedHolderModificationCmd::restoreClassParameterStates( const IECore::CompoundData *classes, IECore::Parameter *parameter, const std::string &parentParameterPath )
{
	std::string parameterPath = parentParameterPath;
	if( parentParameterPath.size() )
	{
		parameterPath += ".";
	}
	parameterPath += parameter->name();
		
	if( parameter->isInstanceOf( "ClassParameter" ) )
	{				
		const CompoundData *c = classes->member<const CompoundData>( parameterPath );
		if( c )
		{
			ClassParameterHandler::setClass(
				parameter,
				c->member<const IECore::StringData>( "className" )->readable().c_str(),
				c->member<const IECore::IntData>( "classVersion" )->readable(),
				c->member<const IECore::StringData>( "searchPathEnvVar" )->readable().c_str()
			);
		}
	}
	else if( parameter->isInstanceOf( "ClassVectorParameter" ) )
	{		
		const CompoundData *c = classes->member<const CompoundData>( parameterPath );
		if( c )
		{
			IECore::ConstStringVectorDataPtr parameterNames = c->member<const IECore::StringVectorData>( "parameterNames" );
			IECore::ConstStringVectorDataPtr classNames = c->member<const IECore::StringVectorData>( "classNames" );
			IECore::ConstIntVectorDataPtr classVersions = c->member<const IECore::IntVectorData>( "classVersions" );
			MStringArray mParameterNames;
			MStringArray mClassNames;
			MIntArray mClassVersions;
			int numClasses = parameterNames->readable().size();
			for( int i=0; i<numClasses; i++ )
			{
				mParameterNames.append( parameterNames->readable()[i].c_str() );
				mClassNames.append( classNames->readable()[i].c_str() );
				mClassVersions.append( classVersions->readable()[i] );
			}
			ClassVectorParameterHandler::setClasses( parameter, mParameterNames, mClassNames, mClassVersions );
		}
	}
	
	if( parameter->isInstanceOf( IECore::CompoundParameter::staticTypeId() ) )
	{
		CompoundParameter *compoundParameter = static_cast<CompoundParameter *>( parameter );
		const CompoundParameter::ParameterVector &childParameters = compoundParameter->orderedParameters();
		for( CompoundParameter::ParameterVector::const_iterator it = childParameters.begin(); it!=childParameters.end(); it++ )
		{
			restoreClassParameterStates( classes, it->get(), parameterPath );
		}
	}
}
开发者ID:AtomicFiction,项目名称:cortex,代码行数:54,代码来源:ParameterisedHolderModificationCmd.cpp

示例10: recFindTransformDAGNodes

void CXRayObjectExport::recFindTransformDAGNodes( MString& nodeName, MIntArray& transformNodeIndicesArray )
{
	// To handle Maya groups we traverse the hierarchy starting at
	// each objectNames[i] going towards the root collecting transform
	// nodes as we go.
	MStringArray result;
	MString cmdStr = "listRelatives -ap " + nodeName;
	MGlobal::executeCommand( cmdStr, result );
	
	if( result.length() == 0 )
		// nodeName must be at the root of the DAG.  Stop recursing
		return;

	for( unsigned int j=0; j<result.length(); j++ ) {
		// check if the node result[i] is of type transform
		MStringArray result2;
		MGlobal::executeCommand( "nodeType " + result[j], result2 );
		
		if( result2.length() == 1 && result2[0] == "transform" ) {
			// check if result[j] is already in result[j]
			bool found=false;
			unsigned int i;
			for( i=0; i<transformNodeNameArray.length(); i++) {
				if( transformNodeNameArray[i] == result[j] ) {
					found = true;
					break;
				}
			}

			if( !found ) {
				transformNodeIndicesArray.append(transformNodeNameArray.length());
				transformNodeNameArray.append(result[j]);
			}
			else {
				transformNodeIndicesArray.append(i);
			}
			recFindTransformDAGNodes(result[j], transformNodeIndicesArray);
		}
	}
}
开发者ID:2asoft,项目名称:xray,代码行数:40,代码来源:maTranslator.cpp

示例11: addCube

static void addCube(
    float scale,
    MFloatVector pos,
    int index_offset,
    MFloatPointArray &points,
    MIntArray &faceCounts,
    MIntArray &faceConnects)
{
#define mkpoint(x, y, z) points.append((MFloatPoint(x, y, z) * scale) + pos)

    mkpoint( 0.5, 0.5, 0.5);
    mkpoint(-0.5, 0.5, 0.5);
    mkpoint(-0.5,-0.5, 0.5);
    mkpoint( 0.5,-0.5, 0.5);

    mkpoint( 0.5, 0.5,-0.5);
    mkpoint(-0.5, 0.5,-0.5);
    mkpoint(-0.5,-0.5,-0.5);
    mkpoint( 0.5,-0.5,-0.5);

#undef mkpoint

    for (int i = 0; i < 6; i++)
        faceCounts.append(4);

    int face_connects[6 * 4] =
    {
        0, 1, 2, 3,
        7, 6, 5, 4,
        3, 7, 4, 0,
        2, 1, 5, 6,
        0, 4, 5, 1,
        2, 6, 7, 3
    };
    for (int i = 0; i < 6 * 4; i++)
    {
        faceConnects.append(face_connects[i] + index_offset);
    }
}
开发者ID:skurmedel,项目名称:mayamenger,代码行数:39,代码来源:mengercmd.cpp

示例12: appendToMesh

void CylinderMesh::appendToMesh(
    MPointArray& points, 
    MIntArray& faceCounts, 
    MIntArray& faceConnects)
{
    MPointArray cpoints;
    MVectorArray cnormals; 
    transform(cpoints, cnormals);    

    int startIndex = points.length(); // offset for indexes
    for (int i = 0; i < cpoints.length(); i++)
    {
        points.append(cpoints[i]);
    }
    for (int i = 0; i < gFaceCounts.length(); i++)
    {
        faceCounts.append(gFaceCounts[i]);
    }

    for (int i = 0; i < gFaceConnects.length(); i++)
    {
        faceConnects.append(gFaceConnects[i]+startIndex);
    }
}
开发者ID:adairrabbit,项目名称:LiuSalon,代码行数:24,代码来源:cylinder.cpp

示例13: transferValueToMaya

void MayaGeoAttribute::transferValueToMaya(MPlug &plug, MDataBlock &data){
	coral::Geo *coralGeo = value();
	const std::vector<Imath::V3f> &coralPoints = coralGeo->points();
	
	// transfer points
	MFloatPointArray mayaPoints;
	for(int i = 0; i < coralPoints.size(); ++i){
		const Imath::V3f *coralPoint = &coralPoints[i];
		mayaPoints.append(MFloatPoint(coralPoint->x, coralPoint->y, coralPoint->z));
	}
	
	// transfer faces
	MIntArray mayaFaceCount;
	MIntArray mayaFaceVertices;
	
	const std::vector<std::vector<int> > coralFaces = coralGeo->rawFaces();
	for(int polyId = 0; polyId < coralFaces.size(); ++polyId){
		const std::vector<int> *coralFace = &coralFaces[polyId];
		int faceVertexCount = coralFace->size();
		mayaFaceCount.append(faceVertexCount);
		
		for(int i = 0; i < faceVertexCount; ++i){
			mayaFaceVertices.append(coralFace->at(i));
		}
	}
	
	// create maya mesh
	MDataHandle dataHandle = data.outputValue(plug);
	
	MFnMeshData dataCreator;
	MObject newOutputData = dataCreator.create();
	
	MFnMesh newMesh;
	newMesh.create(mayaPoints.length(), coralFaces.size(), mayaPoints, mayaFaceCount, mayaFaceVertices, newOutputData);
	dataHandle.set(newOutputData);
}
开发者ID:BigMacchia,项目名称:coral-repo,代码行数:36,代码来源:MayaGeoAttribute.cpp

示例14: getMaterialName

//-----------------------------------------------------------------------------------------
LPCSTR CXRayObjectExport::getMaterialName(MDagPath & mdagPath, int cid, int objectIdx)
{
    MStatus stat;
	
    int i, length;
	MIntArray * currentMaterials = new MIntArray();
	MStringArray mArray;


	for ( i=0; i<numSets; i++ )	{
		if ( lookup(mdagPath,i,cid) ) {
			MFnSet fnSet( (*sets)[i] );
			if ( MFnSet::kRenderableOnly == fnSet.restriction(&stat) ) {
				currentMaterials->append( i );
				mArray.append( fnSet.name() );
			}
		}
	}

	// Test for equivalent materials
	//
	bool materialsEqual = false;
	if ((lastMaterials != NULL) && (lastMaterials->length() == currentMaterials->length())){
		materialsEqual = true;
		length = lastMaterials->length();
		for (i=0; i<length; i++){
			if ((*lastMaterials)[i]!=(*currentMaterials)[i]){
				materialsEqual = false;
				break;
			}
		}			
	}

	if (!materialsEqual){
		if (lastMaterials!=NULL) xr_delete(lastMaterials);

		lastMaterials = currentMaterials;

		int mLength = mArray.length(); 
		if (mLength==0) xrDebug::Fatal(DEBUG_INFO,"Object '%s' has polygon '%d' without material.",0,cid);
		if (mLength>1){
			xrDebug::Fatal(DEBUG_INFO,"Object '%s' has polygon '%d' with more than one material.",0,cid);
		}
	}else{
		xr_delete(currentMaterials);
	}
	return mArray[0].asChar();
}
开发者ID:2asoft,项目名称:xray,代码行数:49,代码来源:MayaExport.cpp

示例15: pruneUVs

MStatus splitUV::pruneUVs( MIntArray& validUVIndices )
//
// Description:
//
//		This method will remove any invalid UVIds from the component list and UVId array.
//		The benefit of this is to reduce the amount of extra processing that the node would
//		have to perform. It will result in less iterations through the mesh as there are
//		less UVs to search for.
//
{
	MStatus status;

	unsigned i;
	MIntArray validUVIds;

	for( i = 0; i < validUVIndices.length(); i++ )
	{
		int uvIndex = validUVIndices[i];
		validUVIds.append( fSelUVs[uvIndex] );
	}

	// Replace the local int array of UVIds
	//
	fSelUVs.clear();
	fSelUVs = validUVIds;

	// Build the list of valid components
	//
	MFnSingleIndexedComponent compFn;
	compFn.create( MFn::kMeshMapComponent, &status );
	MCheckStatus( status, "compFn.create( MFn::kMeshMapComponent )" );
	status = compFn.addElements( validUVIds );
	MCheckStatus( status, "compFn.addElements( validUVIds )" );
	MObject component = compFn.object();

	// Replace the component list
	//
	MFnComponentListData compListFn;
	compListFn.create();
	status = compListFn.add( component );
	MCheckStatus( status, "compListFn.add( component )" );

	fComponentList = compListFn.object();

	return status;
}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:46,代码来源:splitUVCmd.cpp


注:本文中的MIntArray::append方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。