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


C++ MDagPathArray类代码示例

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


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

示例1: iter

MStatus HesperisCmd::writeSelectedCurve(const MSelectionList & selList)
{
	MItSelectionList iter( selList );
	
	MDagPathArray curves;
	MDagPathArray tms;
	
	for(; !iter.isDone(); iter.next()) {								
		MDagPath apath;		
		iter.getDagPath( apath );
		tms.append(apath);
		ASearchHelper::LsAllTypedPaths(curves, apath, MFn::kNurbsCurve);
	}
	
	if(curves.length() < 1) {
		MGlobal::displayInfo(" zero curve selction!");
		return MS::kSuccess;
	}
	
	HesperisFile hesf;
	bool fstat = hesf.create(m_fileName.asChar());
	if(!fstat) {
		MGlobal::displayWarning(MString(" cannot create file ")+ m_fileName);
		return MS::kSuccess;
	}
	
	HesperisIO::WriteTransforms(tms, &hesf);
	HesperisCurveIO::WriteCurves(curves, &hesf);
	
	writeMesh(&hesf);
	
	MGlobal::displayInfo(" done.");
	
	return MS::kSuccess;
}
开发者ID:spinos,项目名称:aphid,代码行数:35,代码来源:HesperisCmd.cpp

示例2: 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

示例3: addInstancedDagPaths

    // --------------------------------------------------------------------
    MStatus SceneGraph::addInstancedDagPaths ( MSelectionList& selectionList )
    {
        MStatus status;
        int length = selectionList.length ( &status );
        if ( status != MStatus::kSuccess ) return MStatus::kFailure;

        for ( int i=0; i<length; i++ )
        {
            MDagPath dagPath;
            if ( selectionList.getDagPath ( i, dagPath ) != MStatus::kSuccess ) return MStatus::kFailure;

            if ( dagPath.isInstanced() )
            {
                int includedInstance=dagPath.instanceNumber ( &status );
                if ( status != MStatus::kSuccess ) return MStatus::kFailure;

                MObject object=dagPath.node ( &status );
                if ( status != MStatus::kSuccess ) return MStatus::kFailure;

                MDagPathArray paths;
                if ( MDagPath::getAllPathsTo ( object, paths ) != MStatus::kSuccess ) return MStatus::kFailure;

                int numPaths=paths.length();
                for ( int p=0; p<numPaths; p++ )
                    if ( p!=includedInstance )
                        selectionList.add ( paths[p] );
            }
        }

        return MStatus::kSuccess;
    }
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:32,代码来源:COLLADAMayaSceneGraph.cpp

示例4: l

bool LiveScene::hasChild( const Name &name ) const
{
	tbb::mutex::scoped_lock l( s_mutex );
	
	if( m_dagPath.length() == 0 && !m_isRoot )
	{
		throw Exception( "IECoreMaya::LiveScene::childNames: Dag path no longer exists!" );
	}
	
	unsigned currentPathLength = m_dagPath.fullPathName().length();
	MDagPathArray paths;
	getChildDags( m_dagPath, paths );
	
	for( unsigned i=0; i < paths.length(); ++i )
	{
		if( paths[i].hasFn( MFn::kTransform ) )
		{
			std::string childName( paths[i].fullPathName().asChar() + currentPathLength + 1 );
			if( Name( childName ) == name )
			{
				return true;
			}
		}
	}
	return false;
}
开发者ID:cnpinto,项目名称:cortex,代码行数:26,代码来源:LiveScene.cpp

示例5: ReferenceFile

    // --------------------------------------
    ReferenceFile* ReferenceManager::processReferenceFile(const MString& filename)
    {
        ReferenceFile* file = new ReferenceFile();
        file->filename = filename;
        mFiles.push_back(file);

#if MAYA_API_VERSION >= 800
        return file; // Versions 8.00 and 8.50 of Maya don't allow us to create references inside a plug-in.

#elif MAYA_API_VERSION >= 600

        // Get the original transformations for this file.
        // 1. Create a new reference
        MString tempFilename;
        MObject tempReferenceNode;

        {
            MString command = MString("file -r -type \"COLLADA importer\" -namespace \"_TEMP_EXP_NAMESPACE\" \"") + filename + "\";";
            MGlobal::executeCommand(command, tempFilename);

            tempFilename = getLastReferenceFilename ( tempFilename );

            MObject tempReferenceNode = getReferenceNode ( tempFilename );
            MString tempNodeName = MFnDependencyNode(tempReferenceNode).name();
            command = MString("file -loadReference \"") + tempNodeName + "\" \"" + tempFilename + "\";";
            MGlobal::executeCommand(command);
        }

        // 2. Get the original transformations for the root transforms of the temporary reference object
        MDagPathArray tempRoots;
        MObjectArray subReferences;
        getRootObjects ( tempReferenceNode, tempRoots, subReferences );
        uint tempRootCount = tempRoots.length();
        for (uint j = 0; j < tempRootCount; ++j)
        {
            MFnTransform tempT(tempRoots[j]);
            file->originalTransformations.push_back( tempT.transformation() );
        }

        // 3. Get the original node names. This will be used as the URL for export
        file->rootNames.setLength(tempRootCount);
        for (uint j = 0; j < tempRootCount; ++j)
        {
            MString& originalName = file->rootNames[j];
            originalName = tempRoots[j].partialPathName();
            originalName = originalName.substring ( originalName.index(':') + 1, originalName.length() );
        }

        // 4. Cleanup: remove this reference
        MString command = MString("file -rr \"") + tempFilename + "\";";
        MGlobal::executeCommand ( command );

#endif // MAYA >= 600

        return file;
    }
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:57,代码来源:COLLADAMayaReferenceManager.cpp

示例6: writeMesh

void HesperisCmd::writeMesh(HesperisFile * file)
{
	if(m_growMeshName.length() < 3) return;
	ASearchHelper searcher;
	MDagPath meshGrp;
	if(!searcher.dagByFullName(m_growMeshName.asChar(), meshGrp)) return;
	MDagPathArray meshes;
	ASearchHelper::LsAllTypedPaths(meshes, meshGrp, MFn::kMesh);
	if(meshes.length() < 1)
		MGlobal::displayInfo(MString(" no mesh found by name ")+m_growMeshName);

	HesperisIO::WriteMeshes(meshes, file);
}
开发者ID:spinos,项目名称:aphid,代码行数:13,代码来源:HesperisCmd.cpp

示例7: GetCurves

bool HesperisIO::GetCurves(const MDagPath &root, MDagPathArray & dst)
{
    MStatus stat;
	MItDag iter;
	iter.reset(root, MItDag::kDepthFirst, MFn::kNurbsCurve);
	for(; !iter.isDone(); iter.next()) {								
		MDagPath apath;		
		iter.getPath( apath );
		if(IsCurveValid(apath)) {
            MFnDagNode fdag(apath);
            if(!fdag.isIntermediateObject())
                dst.append(apath);
        }
	}
    return dst.length() > 0;
}
开发者ID:ahmidou,项目名称:aphid,代码行数:16,代码来源:HesperisIO.cpp

示例8: getChildDags

void LiveScene::getChildDags( const MDagPath& dagPath, MDagPathArray& paths ) const
{
	for( unsigned i=0; i < dagPath.childCount(); ++i )
	{
		MDagPath childPath = dagPath;
		childPath.push( dagPath.child( i ) );
		
		if( dagPath.length() == 0 )
		{
			// bizarrely, this iterates through things like the translate manipulator and
			// the view cube too, so lets skip them so they don't show up:
			if( childPath.node().hasFn( MFn::kManipulator3D ) )
			{
				continue;
			}

			// looks like it also gives us the ground plane, so again, lets skip that:
			if( childPath.fullPathName() == "|groundPlane_transform" )
			{
				continue;
			}
		}
		
		paths.append( childPath );
	}
}
开发者ID:cnpinto,项目名称:cortex,代码行数:26,代码来源:LiveScene.cpp

示例9: isIn

 bool isIn(const MDagPath & dagPath, const MObject & referenceNode)
 {
     MDagPathArray rootDagPaths;
     MObjectArray subReferences;
     ReferenceManager::getRootObjects(referenceNode, rootDagPaths, subReferences);
     for (unsigned int i = 0; i < rootDagPaths.length(); ++i) {
         if (rootDagPaths[i] == dagPath) {
             return true;
         }
     }
     for (unsigned int i = 0; i < subReferences.length(); ++i) {
         if (isIn(dagPath, subReferences[i])) {
             return true;
         }
     }
     return false;
 }
开发者ID:Dumuual,项目名称:OpenCOLLADA,代码行数:17,代码来源:COLLADAMayaReferenceManager.cpp

示例10: meshFn

    // ------------------------------------------------------------
    void SceneGraph::addForcedNodes ( const MDagPath& dagPath )
    {
        MFnMesh meshFn ( dagPath );

        // Iterate upstream finding all the nodes which affect the mesh.
        MStatus stat;
        MPlug plug = meshFn.findPlug ( ATTR_IN_MESH );
        if ( plug.isConnected() )
        {
            MItDependencyGraph dependGraphIter ( plug,
                                                 MFn::kInvalid,
                                                 MItDependencyGraph::kUpstream,
                                                 MItDependencyGraph::kDepthFirst,
                                                 MItDependencyGraph::kPlugLevel,
                                                 &stat );

            if ( stat == MS::kSuccess )
            {
                dependGraphIter.disablePruningOnFilter();
                for ( ; ! dependGraphIter.isDone(); dependGraphIter.next() )
                {
                    MObject thisNode = dependGraphIter.thisNode();
                    MFn::Type type = thisNode.apiType();

                    if ( thisNode.apiType() == MFn::kSkinClusterFilter )
                    {
                        MFnSkinCluster clusterFn ( thisNode );
                        MDagPathArray jointPaths;
                        clusterFn.influenceObjects ( jointPaths, &stat );
                        if ( stat == MS::kSuccess )
                        {
                            uint count = jointPaths.length();
                            for ( uint i = 0; i < count; ++i ) appendForcedNodeToList ( jointPaths[i] );
                        }
                    }
                    else if ( thisNode.apiType() == MFn::kJointCluster )
                    {
                        MObject joint = DagHelper::getNodeConnectedTo ( thisNode, ATTR_MATRIX );
                        MDagPath jointPath = MDagPath::getAPathTo ( joint );
                        appendForcedNodeToList ( jointPath );
                    }
                }
            }
        }
    }
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:46,代码来源:COLLADAMayaSceneGraph.cpp

示例11: findForcedNodes

    // ------------------------------------------------------------
    void SceneGraph::findForcedNodes()
    {
        MStatus status;

        if ( mExportSelectedOnly )
        {
            MSelectionList selectedItems;
            MGlobal::getActiveSelectionList ( selectedItems );
            uint selectedCount = selectedItems.length();
            MDagPathArray queue;

            for ( uint i = 0; i < selectedCount; ++i )
            {
                MDagPath selectedPath;
                status = selectedItems.getDagPath ( i, selectedPath );
                if ( status == MStatus::kSuccess ) queue.append ( selectedPath );
            }

            while ( queue.length() > 0 )
            {
                MDagPath selectedPath = queue[queue.length() - 1];
                queue.remove ( queue.length() - 1 );

                // Queue up the children.
                uint childCount = selectedPath.childCount();
                for ( uint i = 0; i < childCount; ++i )
                {
                    MObject node = selectedPath.child ( i );
                    MDagPath childPath = selectedPath;
                    childPath.push ( node );
                    queue.append ( childPath );
                }

                // Look for a mesh
                if ( selectedPath.node().hasFn ( MFn::kMesh ) )
                {
                    // export forced nodes in path
                    addForcedNodes ( selectedPath );
                }
            }
        }
        else
        {
            for ( MItDag dagIt ( MItDag::kBreadthFirst ); !dagIt.isDone(); dagIt.next() )
            {
                MDagPath currentPath;
                status = dagIt.getPath ( currentPath );
                if ( status == MStatus::kSuccess )
                {
                    MFnDagNode node ( currentPath );
                    String nodeName = node.name().asChar();
                    if ( currentPath.node().hasFn ( MFn::kMesh ) )
                    {
                        // export forced nodes in path
                        addForcedNodes ( currentPath );
                    }
                }
            }
        }
    }
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:61,代码来源:COLLADAMayaSceneGraph.cpp

示例12: referenceNodeFn

    // --------------------------------------
    void ReferenceManager::getRootObjects(
        const MObject& referenceNode, 
        MDagPathArray& rootPaths, 
        MObjectArray& subReferences)
    {
        rootPaths.clear();
        subReferences.clear();

        MFnDependencyNode referenceNodeFn(referenceNode);

        // Get the paths of all the dag nodes included in this reference
        MStringArray nodeNames;
        MString command = MString("reference -rfn \"") + referenceNodeFn.name() + "\" -q -node -dp;";
        MGlobal::executeCommand(command, nodeNames);

        uint nodeNameCount = nodeNames.length();
        MDagPathArray nodePaths;
        for (uint j = 0; j < nodeNameCount; ++j)
        {
            MObject o = DagHelper::getNode(nodeNames[j]);
            MDagPath p = DagHelper::getShortestDagPath(o);
            if (p.length() > 0)
            {
                nodePaths.append(p);
            }
            else
            {
                if (o != MObject::kNullObj && o.apiType() == MFn::kReference
                    && strstr(nodeNames[j].asChar(), "_UNKNOWN_REF_NODE") == NULL)
                {
                    subReferences.append(o);
                }
            }
        }

        // Keep only the root transform for the reference in our path arrays
        uint nodePathCount = nodePaths.length();
        for (uint j = 0; j < nodePathCount; ++j)
        {
            const MDagPath& p = nodePaths[j];
            if ( !isRootTransform ( nodePaths, p ) ) continue;
            rootPaths.append(p);
        }
    }
开发者ID:AsherBond,项目名称:MondocosmOS,代码行数:45,代码来源:COLLADAMayaReferenceManager.cpp

示例13: getShortestDagPath

    //---------------------------------------------------
    // Get a dag path or node from a String
    MDagPath DagHelper::getShortestDagPath ( const MObject& node )
    {
        MDagPathArray paths;
        MDagPath::getAllPathsTo ( node, paths );
        MDagPath shortestPath;
        if ( paths.length() > 0 )
        {
            shortestPath = paths[0];
            for ( uint i = 1; i < paths.length(); ++i )
            {
                if ( shortestPath.length() > paths[i].length() )
                {
                    shortestPath = paths[i];
                }
            }
        }

        return shortestPath;
    }
开发者ID:3dfreeman,项目名称:OpenCOLLADA,代码行数:21,代码来源:COLLADAMayaDagHelper.cpp

示例14: CheckExistingCurves

bool HesperisIO::CheckExistingCurves(CurveGroup * geos, MObject &target)
{
    MDagPathArray existing;
    MDagPath root;
    MDagPath::getAPathTo(target, root);
    if(!GetCurves(root, existing)) return false;
    
    const unsigned ne = existing.length();
    if(ne != geos->numCurves()) return false;
    
    unsigned n = 0;
    unsigned i=0;
    for(;i<ne;i++) {
        MFnNurbsCurve fcurve(existing[i].node());
		n += fcurve.numCVs();
    }
    if(n!=geos->numPoints()) return false;
    
    MGlobal::displayInfo(" existing curves matched");
    
    return true;
}
开发者ID:ahmidou,项目名称:aphid,代码行数:22,代码来源:HesperisIO.cpp

示例15: WriteTransforms

bool HesperisIO::WriteTransforms(const MDagPathArray & paths, HesperisFile * file, const std::string & beheadName)
{
	file->setWriteComponent(HesperisFile::WTransform);
    file->setDirty();
	
	unsigned i = 0;
	for(;i<paths.length();i++) AddTransform(paths[i], file, beheadName);
	
	bool fstat = file->save();
	if(!fstat) MGlobal::displayWarning(MString(" cannot save transform to file ")+ file->fileName().c_str());
	file->close();
	return true;
}
开发者ID:ahmidou,项目名称:aphid,代码行数:13,代码来源:HesperisIO.cpp


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