本文整理汇总了C++中MFnDagNode::findPlug方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnDagNode::findPlug方法的具体用法?C++ MFnDagNode::findPlug怎么用?C++ MFnDagNode::findPlug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnDagNode
的用法示例。
在下文中一共展示了MFnDagNode::findPlug方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: processMeshNode
// --------------------------------------------------------------------------------------------
MStatus polyModifierCmd::processMeshNode( modifyPolyData& data )
// --------------------------------------------------------------------------------------------
{
MStatus status = MS::kSuccess;
// Declare our function sets. Use MFnDagNode here so
// we can retrieve the parent transform.
//
MFnDagNode dagNodeFn;
// Use the DAG path to retrieve our mesh shape node.
//
data.meshNodeShape = fDagPath.node();
dagNodeFn.setObject( data.meshNodeShape );
// ASSERT: meshNodeShape node should have a parent transform!
//
MStatusAssert( (0 < dagNodeFn.parentCount()),
"0 < dagNodeFn.parentCount() -- meshNodeshape has no parent transform" );
data.meshNodeTransform = dagNodeFn.parent(0);
data.meshNodeDestPlug = dagNodeFn.findPlug( "inMesh" );
data.meshNodeDestAttr = data.meshNodeDestPlug.attribute();
return status;
}
示例2: scanScene
void tLocatorMgr::scanScene(const float lframe__, const int sample__,
boost::shared_ptr< liqRibHT > &htable__,
int &count__,
MStatus &returnStatus__)
{
CM_TRACE_FUNC("tLocatorMgr::scanScene("<<lframe__<<","<<sample__<<",htable__,count__,returnStatus__)");
//[refactor 10] beg from scanScene()
MItDag dagCoordSysIterator( MItDag::kDepthFirst, MFn::kLocator, &returnStatus__);
for (; !dagCoordSysIterator.isDone(); dagCoordSysIterator.next())
{
#if (Refactoring == 0)
LIQ_CHECK_CANCEL_REQUEST;
#endif
MDagPath path;
MObject currentNode;
currentNode = dagCoordSysIterator.item();
MFnDagNode dagNode;
dagCoordSysIterator.getPath( path );
if(MS::kSuccess != returnStatus__)
continue;
if(!currentNode.hasFn(MFn::kDagNode))
continue;
returnStatus__ = dagNode.setObject( currentNode );
if(MS::kSuccess != returnStatus__)
continue;
// scanScene: if it's a coordinate system then insert it into the hash table
if( dagNode.typeName() == "liquidCoordSys" )
{
int coordType = 0;
MPlug typePlug = dagNode.findPlug( "type", &returnStatus__ );
if( MS::kSuccess == returnStatus__ )
typePlug.getValue( coordType );
bool useSamples( ( sample__ > 0 ) && isObjectMotionBlur( path ) );
ObjectType mrttype = getMRTType(currentNode, coordType);
ObjectType mrttype_shouldbe = ( coordType == 5 )? MRT_ClipPlane : MRT_Coord;
if( mrttype != mrttype_shouldbe ){
liquidMessage2(messageError, "mrttype[%d] should be %d", mrttype_shouldbe);
}
htable__->insert( path,
lframe__,
( useSamples )? sample__ : 0,
mrttype, //( coordType == 5 )? MRT_ClipPlane : MRT_Coord,
count__++ );
continue;
}
}
//[refactor 10] end from scanScene()
}
示例3: importData
MStatus sgBDataCmd_key::importData()
{
MStatus status;
MTime::Unit currentUnit = MTime().unit();
MPlugArray connections;
sgObject_keyData& objectKeyData = m_objectKeyDataImport;
MObject& oTarget = objectKeyData.oTargetNode;
MDoubleArray& dArrTime = objectKeyData.dArrTime;
MTime::Unit unit = (MTime::Unit)objectKeyData.unit;
MFnDagNode fnNode = oTarget;
MPlugArray targetPlugs;
unsigned int numAttr = objectKeyData.namesAttribute.length();
unsigned int lengthTime = dArrTime.length();
for( unsigned int j=0; j<numAttr; j++ )
{
if( numAttr <= j ) break;
MPlug targetPlug = fnNode.findPlug( objectKeyData.namesAttribute[j] );
targetPlug.connectedTo( connections, true, false );
if( connections.length() ){
m_dgMod_connection.disconnect( connections[0], targetPlug );
m_dgMod_delete.deleteNode( connections[0].node() );
}
m_dgMod_connection.doIt();
m_dgMod_delete.doIt();
MObject oAnimCurve = MFnAnimCurve().create( targetPlug );
m_oArrKeyAfter.append( oAnimCurve );
MFnAnimCurve fnAnimCurve( oAnimCurve );
for( unsigned int k=0; k<lengthTime; k++ )
{
double& dTime = dArrTime[k];
double& dValue = objectKeyData.dArrValuesArray[ k*numAttr+j ];
MTime mTime( dTime, unit );
mTime.setUnit( currentUnit );
fnAnimCurve.addKeyframe( mTime, dValue );
}
}
return MS::kSuccess;
};
示例4: isVisible
bool polyExporter::isVisible(MFnDagNode & fnDag, MStatus& status)
//Summary: determines if the given DAG node is currently visible
//Args : fnDag - the DAG node to check
//Returns: true if the node is visible;
// false otherwise
{
if(fnDag.isIntermediateObject())
return false;
MPlug visPlug = fnDag.findPlug("visibility", &status);
if (MStatus::kFailure == status) {
MGlobal::displayError("MPlug::findPlug");
return false;
} else {
bool visible;
status = visPlug.getValue(visible);
if (MStatus::kFailure == status) {
MGlobal::displayError("MPlug::getValue");
}
return visible;
}
}
示例5: setObjectKeyDataDefault
MStatus sgBDataCmd_key::setObjectKeyDataDefault( sgObject_keyData& objectKeyData, const MDagPath& dagPathTarget, bool bMatrixType )
{
MStatus status;
objectKeyData.oTargetNode = dagPathTarget.node();
objectKeyData.numAttr = 0;
objectKeyData.namesAttribute.clear();
objectKeyData.lengthTime = 0;
objectKeyData.dArrTime.clear();
objectKeyData.dArrValuesArray.clear();
MFnDagNode fnDagNode = dagPathTarget;
MPlugArray plugArrTransform;
MPlugArray plugArrVis;
plugArrTransform.append( fnDagNode.findPlug( "tx" ) );
plugArrTransform.append( fnDagNode.findPlug( "ty" ) );
plugArrTransform.append( fnDagNode.findPlug( "tz" ) );
plugArrTransform.append( fnDagNode.findPlug( "rx" ) );
plugArrTransform.append( fnDagNode.findPlug( "ry" ) );
plugArrTransform.append( fnDagNode.findPlug( "rz" ) );
plugArrTransform.append( fnDagNode.findPlug( "sx" ) );
plugArrTransform.append( fnDagNode.findPlug( "sy" ) );
plugArrTransform.append( fnDagNode.findPlug( "sz" ) );
plugArrVis.append( fnDagNode.findPlug( "v" ) );
if( bMatrixType )
{
if( plugsHasConnection( plugArrVis ) )
{
objectKeyData.numAttr++;
objectKeyData.namesAttribute.append( "visibility" );
}
if( plugsHasConnection( plugArrTransform ) )
{
objectKeyData.numAttr += 9;
objectKeyData.namesAttribute.append( "translateX" );
objectKeyData.namesAttribute.append( "translateY" );
objectKeyData.namesAttribute.append( "translateZ" );
objectKeyData.namesAttribute.append( "rotateX" );
objectKeyData.namesAttribute.append( "rotateY" );
objectKeyData.namesAttribute.append( "rotateZ" );
objectKeyData.namesAttribute.append( "scaleX" );
objectKeyData.namesAttribute.append( "scaleY" );
objectKeyData.namesAttribute.append( "scaleZ" );
}
}
else
{
MPlugArray plugArr;
for( unsigned int j=0; j< plugArrTransform.length(); j++ )
{
MPlug& plug = plugArrTransform[j];
plug.connectedTo( plugArr, true, false );
if( !plugArr.length() )
{
MPlug plugParent = plug.parent( &status );
if( !status ) continue;
plugParent.connectedTo( plugArr, true, false );
if( !plugArr.length() ) continue;
}
objectKeyData.numAttr++;
objectKeyData.namesAttribute.append( MFnAttribute( plug.attribute() ).name() );
}
plugArrVis[0].connectedTo( plugArr, true, false );
if( plugArr.length() )
{
objectKeyData.numAttr++;
objectKeyData.namesAttribute.append( MFnAttribute( plugArrVis[0].attribute() ).name() );
}
}
objectKeyData.dArrValuesArray.clear();
return MS::kSuccess;
}
示例6: processUpstreamNode
MStatus polyModifierCmd::processUpstreamNode( modifyPolyData& data )
{
MStatus status = MS::kSuccess;
// Declare our function sets - Although dagNodeFn derives from depNodeFn, we need
// both since dagNodeFn can only refer to DAG objects.
// We will use depNodeFn for all times other when dealing
// with the DAG.
//
MFnDependencyNode depNodeFn;
MFnDagNode dagNodeFn;
// Use the selected node's plug connections to find the upstream plug.
// Since we are looking at the selected node's inMesh attribute, it will
// always have only one connection coming in if it has history, and none
// otherwise.
//
// 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.upstreamNodeSrcPlug,
data.meshNodeDestPlug );
}
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" );
data.upstreamNodeSrcPlug = dagNodeFn.findPlug( "outMesh", &status );
// Remove the duplicated transform node (clean up)
//
status = fDagModifier.deleteNode( data.upstreamNodeTransform );
MCheckStatus( status, "deleteNode" );
// Perform the DAG delete node
//
//.........这里部分代码省略.........