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


C++ MFnDagNode::getPath方法代码示例

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


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

示例1: dagNode

CBaseNode *CMayaNode::GetChild(int childId)
{
    MStatus status;
    MFnDagNode dagNode (m_dagPath, &status);
    if (status != MS::kSuccess)
        return 0;

    MObject objChild = dagNode.child (childId, &status);
    if (status != MS::kSuccess)
        return 0;

    MFnDagNode	childDagNode (objChild, &status);
    if (status != MS::kSuccess)
        return 0;

    MDagPath childPath;
    if (childDagNode.getPath (childPath) != MS::kSuccess)
        return 0;

    CMayaNode *pNode = new CMayaNode;
    if (!pNode->Create (childPath))
    {
        delete pNode;
        return 0;
    }

    return pNode;
}
开发者ID:BGCX261,项目名称:zombigame-svn-to-git,代码行数:28,代码来源:MayaNode.cpp

示例2: Hide

void EntityInstanceNode::Hide()
{
    MFnTransform transformFn( thisMObject() );

    u32 len = transformFn.childCount();

    MFnDagNode nodeFn;
    for( u32 i = 0; i < len; ++i )
    {
        nodeFn.setObject( transformFn.child( 0 ) );
        MDagPath path;
        nodeFn.getPath( path );        
        MGlobal::deleteNode( path.node() );
    }
}
开发者ID:,项目名称:,代码行数:15,代码来源:

示例3: doIt

MStatus unShowAvailableSystems::doIt( const MArgList& args )
{
	MItDag dagIter;
	MFnDagNode worldDag (dagIter.root());
	MDagPath worldPath;
	worldDag.getPath(worldPath);

	std::string str;
	findAvailableSystems(str,worldPath);
	if(!str.empty())
	{
		MessageBox(0,str.c_str(),"Particle or Ribbon Systems",0);
	}
	else
	{
		MessageBox(0,"no particle or ribbon system yet","Particle or Ribbon Systems",0);
	}

	return MS::kSuccess;
}
开发者ID:cpzhang,项目名称:zen,代码行数:20,代码来源:mayammexport.cpp

示例4: fillSkeleton

void DMPDSExporter::fillSkeleton( DMPParameters* param )
{
	MStatus stat;
	mSkelData.clear();
	if (!param->bExportSkeleton)
	{
		return;
	}
	mSkelData.skeleton.name = param->skeletonFileName.asUTF8();


	// Get the selection list
	MSelectionList activeList;
	stat = MGlobal::getActiveSelectionList(activeList);
	if(param->bExportAll)
	{
		// We are exporting the whole scene
		MItDag dagIter;
		MFnDagNode worldDag (dagIter.root());
		MDagPath worldPath;
		worldDag.getPath(worldPath);
		traverseSubSkeleton(param, worldPath);
	}
	else
	{
		if (MStatus::kSuccess != stat)
		{
			return;
		}
		MItSelectionList iter(activeList);

		for ( ; !iter.isDone(); iter.next())
		{								
			MDagPath dagPath;
			iter.getDagPath(dagPath);
			traverseSubSkeleton(param, dagPath); 
		}	
	}
	// may lose selection while exporting, so reset it.
	MGlobal::setActiveSelectionList(activeList);
}
开发者ID:jiazhipeng03,项目名称:Duel-Engine,代码行数:41,代码来源:DuelMPDSExporter.cpp

示例5: AddToInstances

void EntityNode::AddToInstances( MObject &addedNode )
{
    MStatus stat;

    MFnDagNode instanceFn;
    MFnDagNode nodeFn( addedNode );
    MDagPath source;
    nodeFn.getPath( source );

    M_EntityNode::iterator itor = m_Instances.begin();
    M_EntityNode::iterator end  = m_Instances.end();
    for( ; itor != end; ++itor)
    {
        instanceFn.setObject( itor->second->thisMObject() );

        instanceFn.setObject( instanceFn.parent( 0 ) );
        MDagPath parent;
        instanceFn.getPath( parent );

        MDagPath result;
        Maya::duplicate( source, parent, result, true );
    }
}
开发者ID:,项目名称:,代码行数:23,代码来源:

示例6: if


//.........这里部分代码省略.........
        // -euv / -emptyUV
        //     Returns the names of blacklisted UV sets.  These UV sets
        //     are disabled from being passed to the shader because there
        //     is at least one mesh where the UV set name is defined but 
        //     has no faces mapped.  Due to a bug in Maya (in 5.0 and
        //     possibly some other releases), Maya crashes if an empty
        //     UV set is accessed by a hardware shader.  Blacklisting is
        //     intended to protect the user against accidentally hitting
        //     the bug and crashing Maya.  After the Maya fix has been
        //     verified, this option can continue to be accepted for awhile
        //     for compatibility, returning an empty result array.
        //     Result type is string[].  (Query only; set internally)
        if ( fEmptyUV )
        {
            setResult( pNode->getEmptyUVSets() );
            return MS::kSuccess;
        }

        // -eus / -emptyUVShapes
        //     Returns the names of shape nodes that have empty UV sets 
        //     which are causing the UV set names to be blacklisted.
        //     After the Maya bug fix has been verified, this option
        //     can remain for awhile for compatibility, returning an
        //     empty result array.
        //     Result type is string[].  (Query only; set internally)
        if ( fEmptyUVShapes )
        {
            const MObjectArray& oaShapes = pNode->getEmptyUVSetShapes();
            MFnDagNode          fnDagNode;
            MDagPath            dpShape;
            for ( unsigned iShape = 0; iShape < oaShapes.length(); ++iShape )
            {
                fnDagNode.setObject( oaShapes[ iShape ] );
                fnDagNode.getPath( dpShape );
                saResult.append( dpShape.partialPathName() );
            }
            setResult( saResult );
            return MS::kSuccess;
        }

        // -tcs / -texCoordSource
        //     Returns the value of the texCoordSource attribute, because
        //     the MEL "getAttr" command doesn't work with string arrays.
        //     Result type is string[].  (Query only; set via "setAttr")
        if ( fTexCoordSource )
        {
            setResult( pNode->getTexCoordSource() );
            return MS::kSuccess;
        }

#if MAYA_API_VERSION >= 700

        // -cs / -colorSource
        //     Returns the value of the colorSource attribute, because
        //     the MEL "getAttr" command doesn't work with string arrays.
        //     Result type is string[].  (Query only; set via "setAttr")
        if ( fColorSource )
        {
            setResult( pNode->getColorSource() );
            return MS::kSuccess;
        }

#endif

        // Error if -q with no other query flags.
		return MS::kInvalidParameter;
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:67,代码来源:cgfxShaderCmd.cpp

示例7: processUpstreamNode


//.........这里部分代码省略.........
		
		MCheckStatus( status, "Disconnect Upstream mit meshNode" );


	}
	else	// No History (!fHasHistory)
	{
		// Use the DAG node function set to duplicate the shape of the meshNode.
		// The duplicate method will return an MObject handle to the transform
		// of the duplicated shape, so traverse the dag to locate the shape. Store
		// this duplicate shape as our "upstream" node to drive the input for the 
		// modifierNode.
		//
		depNodeFn.setObject( data.meshNodeShape );
		data.upstreamNodeTransform = createDuplicate.createNode("mesh");
		createDuplicate.doIt();

		dagNodeFn.setObject( data.upstreamNodeTransform );
		

		// Ensure that our upstreamNode is pointing to a shape.
		//
		MStatusAssert( (0 < dagNodeFn.childCount()),
					   "0 < dagNodeFn.childCount() -- Duplicate meshNode transform has no shape." );
		data.upstreamNodeShape = dagNodeFn.child(0);

		MPlug outMeshPlug = depNodeFn.findPlug("outMesh");
		depNodeFn.setObject(data.upstreamNodeShape);

		//jetzt inMesh upstreamNodeShape mit outMesh meshShape füllen
		MDGModifier tempMod;
		tempMod.connect(outMeshPlug,depNodeFn.findPlug("inMesh"));
		tempMod.doIt();

		//force DGEVAL
		MString cmd = "dgeval -src ";
		cmd += depNodeFn.name();
		cmd += ".outMesh";
		MGlobal::executeCommand(cmd,false,false);

		tempMod.undoIt();

		
		// Re-parent the upstreamNodeShape under our original transform
		//
		reparentDuplicate.reparentNode( data.upstreamNodeShape, data.meshNodeTransform );
		reparentDuplicate.doIt();


		deleteDuplicate.deleteNode( data.upstreamNodeTransform );
		deleteDuplicate.doIt();
		/*
		status = fDagModifier.reparentNode( data.upstreamNodeShape, data.meshNodeTransform );
		MCheckStatus( status, "reparentNode" );

		// Perform the DAG re-parenting
		// 
		// Note: This reparent must be performed before the deleteNode() is called.
		//		 See polyModifierCmd.h (see definition of fDagModifier) for more details.
		//
		status = fDagModifier.doIt();
		MCheckStatus( status, "fDagModifier.doIt()" );
		*/
		// Mark the upstreamNodeShape (the original shape) as an intermediate object
		// (making it invisible to the user)
		//
		dagNodeFn.setObject( data.upstreamNodeShape );
		dagNodeFn.setIntermediateObject( true );

		// Get the upstream node source attribute
		//
		data.upstreamNodeSrcAttr = dagNodeFn.attribute( "outMesh" );
		data.upstreamNodeSrcPlug = MPlug(data.upstreamNodeShape, data.upstreamNodeSrcAttr);

		/*
		// Remove the duplicated transform node (clean up)
		//
		status = fDagModifier.deleteNode( data.upstreamNodeTransform );
		MCheckStatus( status, "deleteNode" );

		// Perform the DAG delete node
		//
		// Note: This deleteNode must be performed after the reparentNode() method is
		//		 completed. See polyModifierCmd.h (see definition of fDagModifier) for
		//		 details.
		//
		status = fDagModifier.doIt();
		MCheckStatus( status, "fDagModifier.doIt()" );
		*/

		// Cache the DAG path to the duplicate shape
		//
		dagNodeFn.getPath( fDuplicateDagPath );

		//finally delete the tweaks to avoid double transformation
		deleteTweaks();
	}

	return status;
}
开发者ID:Byron,项目名称:bsuite,代码行数:101,代码来源:polyModifierCmd.cpp

示例8: processUpstreamNode


//.........这里部分代码省略.........
	//
	// If there is no history, copy the selected node and place it ahead of the
	// modifierNode as the new upstream node so that the modifierNode has an
	// input mesh to operate on.
	//
	MPlugArray tempPlugArray;

	if( fHasHistory )
	{
		// Since we have history, look for what connections exist on the
		// meshNode "inMesh" plug. "inMesh" plugs should only ever have one
		// connection.
		//
		data.meshNodeDestPlug.connectedTo( tempPlugArray, true, false);

		// ASSERT: Only one connection should exist on meshNodeShape.inMesh!
		//
		MStatusAssert( (tempPlugArray.length() == 1),
					   "tempPlugArray.length() == 1 -- 0 or >1 connections on meshNodeShape.inMesh" );
		data.upstreamNodeSrcPlug = tempPlugArray[0];

		// Construction history only deals with shapes, so we can grab the
		// upstreamNodeShape off of the source plug.
		//
		data.upstreamNodeShape = data.upstreamNodeSrcPlug.node();
		depNodeFn.setObject( data.upstreamNodeShape );
		data.upstreamNodeSrcAttr = data.upstreamNodeSrcPlug.attribute();

		// Disconnect the upstream node and the selected node, so we can
		// replace them with our own connections below.
		//
		fDGModifier.disconnect( data.upstreamNodeShape,
								data.upstreamNodeSrcAttr,
								data.meshNodeShape,
								data.meshNodeDestAttr );

	}
	else	// No History (!fHasHistory)
	{
		// Use the DAG node function set to duplicate the shape of the meshNode.
		// The duplicate method will return an MObject handle to the transform
		// of the duplicated shape, so traverse the dag to locate the shape. Store
		// this duplicate shape as our "upstream" node to drive the input for the 
		// modifierNode.
		//
		dagNodeFn.setObject( data.meshNodeShape );
		data.upstreamNodeTransform = dagNodeFn.duplicate( false, false );
		dagNodeFn.setObject( data.upstreamNodeTransform );


		// Ensure that our upstreamNode is pointing to a shape.
		//
		MStatusAssert( (0 < dagNodeFn.childCount()),
					   "0 < dagNodeFn.childCount() -- Duplicate meshNode transform has no shape." );
		data.upstreamNodeShape = dagNodeFn.child(0);

		// Re-parent the upstreamNodeShape under our original transform
		//
		status = fDagModifier.reparentNode( data.upstreamNodeShape, data.meshNodeTransform );
		MCheckStatus( status, "reparentNode" );

		// Perform the DAG re-parenting
		// 
		// Note: This reparent must be performed before the deleteNode() is called.
		//		 See polyModifierCmd.h (see definition of fDagModifier) for more details.
		//
		status = fDagModifier.doIt();
		MCheckStatus( status, "fDagModifier.doIt()" );

		// Mark the upstreamNodeShape (the original shape) as an intermediate object
		// (making it invisible to the user)
		//
		dagNodeFn.setObject( data.upstreamNodeShape );
		dagNodeFn.setIntermediateObject( true );

		// Get the upstream node source attribute
		//
		data.upstreamNodeSrcAttr = dagNodeFn.attribute( "outMesh" );

		// Remove the duplicated transform node (clean up)
		//
		status = fDagModifier.deleteNode( data.upstreamNodeTransform );
		MCheckStatus( status, "deleteNode" );

		// Perform the DAG delete node
		//
		// Note: This deleteNode must be performed after the reparentNode() method is
		//		 completed. See polyModifierCmd.h (see definition of fDagModifier) for
		//		 details.
		//
		status = fDagModifier.doIt();
		MCheckStatus( status, "fDagModifier.doIt()" );

		// Cache the DAG path to the duplicate shape
		//
		dagNodeFn.getPath( fDuplicateDagPath );
	}

	return status;
}
开发者ID:AlbertR,项目名称:cgru170,代码行数:101,代码来源:polyModifierCmd.cpp

示例9: GetSelectedMesh

MFnMesh* GDExporter::GetSelectedMesh(void)
{
	MSelectionList currSelection;
	MGlobal::getActiveSelectionList(currSelection);

	unsigned int selectionCount = currSelection.length();
	
	MFnMesh* exportingMesh = 0;

	for(unsigned int selectionIndex = 0; selectionIndex < selectionCount; ++selectionIndex )
	{
		MDagPath currPath;
		currSelection.getDagPath(selectionIndex, currPath);

		if( currPath.apiType() != MFn::kTransform )
			continue;

		MFnTransform currTransform(currPath);
		unsigned int childCount = currTransform.childCount();
		for(unsigned int childIndex = 0; childIndex < childCount; ++childIndex)
		{
			MObject childObject = currTransform.child(childIndex);
			if( childObject.apiType() == MFn::kMesh )
			{
				MFnDagNode dagNode;
				dagNode.setObject(childObject);
				MDagPath childPath;
				dagNode.getPath(childPath);
				
				MFnMesh* pChildMesh = new MFnMesh(childPath);
				
				if( pChildMesh->isIntermediateObject() )
					continue;
				
				bool bExportMesh = true;
				if( pChildMesh->isInstanced(false) )
					if( childPath.instanceNumber() != 0 )
						bExportMesh = false;

				if( bExportMesh )
				{
					if( exportingMesh != 0 )
					{
						delete exportingMesh;
						delete pChildMesh;
						MGlobal::displayError(MString("GDExporter - More than one mesh object selected."));
						return 0;
					}

					exportingMesh = pChildMesh;
				}
			}
		}
	}

	if( exportingMesh == 0 )
	{
		MGlobal::displayError(MString("GDExporter - No mesh objects currently selected."));
		return 0;
	}

	return exportingMesh;
}
开发者ID:Burnsidious,项目名称:FSGDEngine,代码行数:63,代码来源:GDExporter.cpp

示例10: doIt

	// Execute the command
	MStatus OgreExporter::doIt(const MArgList& args)
	{
		// clean up
		delete m_pMesh;
		delete m_pMaterialSet;

		// Parse the arguments.
		m_params.parseArgs(args);
		// Create output files
		m_params.openFiles();
		// Create a new empty mesh
		m_pMesh = new Mesh();
		// Create a new empty material set
		m_pMaterialSet = new MaterialSet();
		// Save current time for later restore
		m_curTime = MAnimControl::currentTime();
		// Save active selection list for later restore
		MGlobal::getActiveSelectionList(m_selList);
		/**************************** LOAD DATA **********************************/
		if (m_params.exportAll)
		{	// We are exporting the whole scene
			std::cout << "Export the whole scene\n";
			std::cout.flush();
			MItDag dagIter;
			MFnDagNode worldDag (dagIter.root());
			MDagPath worldPath;
			worldDag.getPath(worldPath);
			stat = translateNode(worldPath);
		}
		else
		{	// We are translating a selection
			std::cout << "Export selected objects\n";
			std::cout.flush();
			// Get the selection list
			MSelectionList activeList;
			stat = MGlobal::getActiveSelectionList(activeList);
			if (MS::kSuccess != stat)
			{
				std::cout << "Error retrieving selection list\n";
				std::cout.flush();
				exit();
				return MS::kFailure;
			}
			MItSelectionList iter(activeList);

			for ( ; !iter.isDone(); iter.next())
			{								
				MDagPath dagPath;
				stat = iter.getDagPath(dagPath);
				stat = translateNode(dagPath); 
			}							
		}

		// Load vertex animations
		if (m_params.exportVertAnims)
			m_pMesh->loadAnims(m_params);

		// Load blend shapes
		if (m_params.exportBlendShapes)
			m_pMesh->loadBlendShapes(m_params);

		// Restore skeleton to correct pose
		if (m_pMesh->getSkeleton())
			m_pMesh->getSkeleton()->restorePose();

		// Load skeleton animation (do it now, so we have loaded all needed joints)
		if (m_pMesh->getSkeleton() && m_params.exportSkelAnims)
		{
			// Load skeleton animations
			m_pMesh->getSkeleton()->loadAnims(m_params);
		}

		/**************************** WRITE DATA **********************************/
		stat = writeOgreData();

		std::cout << "Export completed succesfully\n";
		std::cout.flush();
		exit();

		return MS::kSuccess;
	}
开发者ID:Anti-Mage,项目名称:ogre,代码行数:82,代码来源:ogreExporter.cpp


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