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


C++ MFnDependencyNode类代码示例

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


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

示例1: cacheMeshData

MStatus polyModifierCmd::cacheMeshData()
{
	MStatus status = MS::kSuccess;

	MFnDependencyNode depNodeFn;
	MFnDagNode dagNodeFn;

	MObject meshNode = fDagPath.node();
	MObject dupMeshNode;
	MPlug dupMeshNodeOutMeshPlug;

	// Duplicate the mesh
	//
	dagNodeFn.setObject( meshNode );
	dupMeshNode = dagNodeFn.duplicate();

	MDagPath dupMeshDagPath;
	MDagPath::getAPathTo( dupMeshNode, dupMeshDagPath );
	dupMeshDagPath.extendToShape();

	depNodeFn.setObject( dupMeshDagPath.node() );
	dupMeshNodeOutMeshPlug = depNodeFn.findPlug( "outMesh", &status );
	MCheckStatus( status, "Could not retrieve outMesh" );

	// Retrieve the meshData
	//
	status = dupMeshNodeOutMeshPlug.getValue( fMeshData );
	MCheckStatus( status, "Could not retrieve meshData" );

	// Delete the duplicated node
	//
	MGlobal::deleteNode( dupMeshNode );

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

示例2: setZeroTweaks

//############################################### tima:
bool polyModifierCmd::setZeroTweaks()
{
	MFnNumericData numDataFn;
	MObject nullVector;
	MFnDependencyNode depNodeFn;

	numDataFn.create( MFnNumericData::k3Float );
	numDataFn.setData( 0, 0, 0 );
	nullVector = numDataFn.object();

	MObject object = fDagPath.node();
	depNodeFn.setObject( object);
	MPlug meshTweakPlug = depNodeFn.findPlug( "pnts" );
	MPlug tweak;

	unsigned numTweaks = fTweakIndexArray.length();

	if( !meshTweakPlug.isNull() )
	{
		for( unsigned i = 0; i < numTweaks; i++ )
		{
			tweak = meshTweakPlug.elementByLogicalIndex( fTweakIndexArray[i] );
			tweak.setValue( nullVector );
		}
	}
	
	return true;
}
开发者ID:AlbertR,项目名称:cgru170,代码行数:29,代码来源:polyModifierCmd.cpp

示例3: dData

bool
PxrUsdMayaWriteUtil::ReadMayaAttribute(
        const MFnDependencyNode& depNode,
        const MString& name,
        VtVec3fArray* 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::kVectorArrayData)) ) {

            MFnVectorArrayData dData(dataObj, &status);
            if (status == MS::kSuccess) {
                MVectorArray arrayValues = dData.array();
                size_t numValues = arrayValues.length();
                val->resize(numValues);
                for (size_t i = 0; i < numValues; ++i) {
                    (*val)[i].Set(
                            arrayValues[i][0],
                            arrayValues[i][1],
                            arrayValues[i][2]);
                }
                return true;
            }
        }
    }

    return false;
}
开发者ID:MWDD,项目名称:USD,代码行数:34,代码来源:writeUtil.cpp

示例4: dagFn

void EntityNode::UnloadArt()
{
    MStatus stat;

    // remove anything currently imported/referenced
    MFnDagNode dagFn( thisMObject() );
    while( dagFn.childCount() )
    {
        stat = MGlobal::deleteNode( dagFn.child( 0 ) );
        MContinueErr( stat, ("Unable to delete" + dagFn.fullPathName() ).asChar() );
    }

    ClearInstances();

    MObjectArray forDelete;
    GetImportNodes( forDelete );
    MFnDependencyNode depFn;

    u32 num = forDelete.length();
    for( u32 i = 0; i < num; ++i )
    {
        MObject& node = forDelete[i];

        MObjectHandle handle( node );
        if( !handle.isValid() )
            continue;

        depFn.setObject( node );

        stat = MGlobal::deleteNode( node );
        MContinueErr( stat, ("Unable to delete" + depFn.name() ).asChar() );
    }

    forDelete.clear();
}
开发者ID:,项目名称:,代码行数:35,代码来源:

示例5: ExtractAttribute

void ExtractAttribute(MFnDependencyNode& fn, std::string name, SMatAttrib& attrib)
{
	MPlug p;

	// extract attribute color
	std::string r = name + "R";
	std::string g = name + "G";
	std::string b = name + "B";

	p = fn.findPlug(r.c_str());	p.getValue(attrib.color[0]);
	p = fn.findPlug(g.c_str());	p.getValue(attrib.color[1]);
	p = fn.findPlug(b.c_str());	p.getValue(attrib.color[2]);

	// extract attribute texture
	MString texname;

	p = fn.findPlug(name.c_str());
	
	MPlugArray plugs;
	p.connectedTo(plugs,true,true);

	for(int i = 0; i != plugs.length(); ++i)
	{
		if (plugs[i].node().apiType() == MFn::kFileTexture) 
		{
			MFnDependencyNode fnDep(plugs[i].node());
			texname = fnDep.name();
			break;
		}
	}

	attrib.textureID = GetTextureID( texname );
}
开发者ID:shikui08,项目名称:character-system,代码行数:33,代码来源:Material.cpp

示例6: destFn

    //---------------------------------------------------
    bool DagHelper::connectToList ( const MPlug& source, const MObject& destination, const MString& destinationAttribute, int* _index )
    {
        MStatus status;
        MFnDependencyNode destFn ( destination );
        MPlug dest = destFn.findPlug ( destinationAttribute, &status );

        if ( status != MStatus::kSuccess ) return false;

        if ( !dest.isArray() ) return false;

        int index = ( _index != NULL ) ? *_index : -1;

        if ( index < 0 )
        {
            index = getNextAvailableIndex ( dest, ( int ) dest.evaluateNumElements() );

            if ( _index != NULL ) *_index = index;
        }

        MPlug d = dest.elementByLogicalIndex ( index );

        MDGModifier modifier;
        modifier.connect ( source, d );
        status = modifier.doIt();
        return status == MStatus::kSuccess;
    }
开发者ID:3dfreeman,项目名称:OpenCOLLADA,代码行数:27,代码来源:COLLADAMayaDagHelper.cpp

示例7: parseAttributes

	void AttributeParser::parseAttributes(MFnDependencyNode & fnNode, AttributeParser & parser)
	{
		MStatus status;
		unsigned int attrCount = fnNode.attributeCount(&status);
        if (!status) return;
        std::set<String> parsedAttributes;
		for (unsigned int attrIndex = 0; attrIndex < attrCount; ++attrIndex)
		{
			MObject attrObject = fnNode.attribute(attrIndex, &status);
            if (!status) continue;

			MFnAttribute fnAttr(attrObject, &status);
			if (!status) continue;

			MString attrName = fnAttr.name(&status);
            if (!status) continue;

            // Don't parse the same attribute twice.
            // This can happen with compound attributes.
            String attrNameStr = attrName.asChar();
            if (parsedAttributes.find(attrNameStr) != parsedAttributes.end()) {
                continue;
            }
            parsedAttributes.insert(attrNameStr);

			parser.parseAttribute(fnNode, attrObject, parsedAttributes);
		}
	}
开发者ID:dabiaoluo,项目名称:OpenCOLLADA,代码行数:28,代码来源:COLLADAMayaAttributeParser.cpp

示例8: collectNodeState

// --------------------------------------------------------------------------------------------
void polyModifierCmd::collectNodeState()
// --------------------------------------------------------------------------------------------
{
	MStatus status;

	// Collect node state information on the given polyMeshShape
	//
	// - HasHistory (Construction History exists)
	// - HasTweaks
	// - HasRecordHistory (Construction History is turned on)
	//
	fDagPath.extendToShape();
	MObject meshNodeShape = fDagPath.node();

	MFnDependencyNode depNodeFn;
	depNodeFn.setObject( meshNodeShape );

	MPlug inMeshPlug = depNodeFn.findPlug( "inMesh" );
	fHasHistory = inMeshPlug.isConnected();

	// Tweaks exist only if the multi "pnts" attribute contains plugs
	// which contain non-zero tweak values. Use false, until proven true
	// search algorithm.
	//
	fHasTweaks = false;
	MPlug tweakPlug = depNodeFn.findPlug( "pnts" );
	if( !tweakPlug.isNull() )
	{
		// ASSERT: tweakPlug should be an array plug!
		//
		MAssert( (tweakPlug.isArray()),
				 "tweakPlug.isArray() -- tweakPlug is not an array plug" );

		MPlug tweak;
		MFloatVector tweakData;
		int i;
		int numElements = tweakPlug.numElements();

		for( i = 0; i < numElements; i++ )
		{
			tweak = tweakPlug.elementByPhysicalIndex( i, &status );
			if( status == MS::kSuccess && !tweak.isNull() )
			{
				getFloat3PlugValue( tweak, tweakData );
				if( 0 != tweakData.x ||
					0 != tweakData.y ||
					0 != tweakData.z )
				{
					fHasTweaks = true;
					break;
				}
			}
		}
	}

	int result;
	MGlobal::executeCommand( "constructionHistory -q -tgl", result );
	fHasRecordHistory = (0 != result);
}
开发者ID:Byron,项目名称:bsuite,代码行数:60,代码来源:polyModifierCmd.cpp

示例9: addParameter

MStatus PRTAttrs::addParameter(MFnDependencyNode & node, MObject & attr, MFnAttribute& tAttr) {
	if(!(node.hasAttribute(tAttr.shortName()))) {
		MCHECK(tAttr.setKeyable (true));
		MCHECK(tAttr.setHidden(false));
		MCHECK(tAttr.setStorable(true));
		MCHECK(node.addAttribute(attr));
	}
	return MS::kSuccess;
}
开发者ID:Esri,项目名称:esri-cityengine-sdk,代码行数:9,代码来源:PRTAttrs.cpp

示例10: node

 //---------------------------
 String DocumentExporter::dagPathToColladaName ( const MDagPath& dagPath )
 {
     // Get a COLLADA suitable node name from a DAG path
     // For import/export symmetry, this should be exactly the
     // Maya node name. If we include any more of the path, we'll
     // get viral node names after repeated import/export.
     MFnDependencyNode node ( dagPath.node() );
     return mayaNameToColladaName ( node.name(), true );
 }
开发者ID:cuigrey,项目名称:OpenCOLLADA,代码行数:10,代码来源:COLLADAMayaDocumentExporter.cpp

示例11: depNode

std::string CMayaNode::GetName()
{
    MStatus status;
    MFnDependencyNode	depNode (m_dagPath.node(), &status);
    if (status != MS::kSuccess)
        return "";

    return depNode.name ().asChar();
}
开发者ID:BGCX261,项目名称:zombigame-svn-to-git,代码行数:9,代码来源:MayaNode.cpp

示例12: fnDep

void Exporter::extractColor(Color& tempcolor, MFnDependencyNode& fn, MString name)
{
	MPlug p;

	MString r = name;
	r += "R";
	MString g = name;
	g += "G";
	MString b = name;
	b += "B";
	MString a = name;
	a += "A";

	p = fn.findPlug(r.asChar());
	p.getValue(tempcolor.r);
	p = fn.findPlug(g.asChar());
	p.getValue(tempcolor.g);
	p = fn.findPlug(b.asChar());
	p.getValue(tempcolor.b);
	p = fn.findPlug(a.asChar());
	p.getValue(tempcolor.a);
	p = fn.findPlug(name.asChar());

	MPlugArray connections;
	p.connectedTo(connections, true, false);

	int debug = connections.length();

	for (int i = 0; i != connections.length(); ++i)
	{
		// if file texture found
		if (connections[i].node().apiType() == MFn::kFileTexture)
		{
			// bind a function set to it ....
			MFnDependencyNode fnDep(connections[i].node());

			// to get the node name
			tempcolor.texfileInternal = fnDep.name().asChar();
			MPlug filename = fnDep.findPlug("ftn");

			//sparar hela s�kv�gen till texturen
			tempcolor.texfileExternal = filename.asString().asChar();

			//kopierar texturfiler
			std::string base_filename = tempcolor.texfileExternal.substr(tempcolor.texfileExternal.find_last_of("/\\") + 1);

			CopyFile(tempcolor.texfileExternal.c_str(), base_filename.c_str(), false);

			// stop looping
			break;
		}

	}

}
开发者ID:FredrikLindsten,项目名称:Litet-Spel-Grupp-1,代码行数:55,代码来源:Exporter.cpp

示例13: depNodeFn

MStatus polyModifierCmd::processModifierNode( MObject modifierNode,
											  modifyPolyData& data )
{
	MStatus status = MS::kSuccess;

	MFnDependencyNode depNodeFn ( modifierNode );
	data.modifierNodeSrcAttr = depNodeFn.attribute( "outMesh" );
	data.modifierNodeDestAttr = depNodeFn.attribute( "inMesh" );

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

示例14: createExpression

    //---------------------------------------------------
    MObject DagHelper::createExpression ( const MPlug& plug, const MString& expression )
    {
        MFnDependencyNode expressionFn;
        MObject expressionObj = expressionFn.create ( "expression" );
        DagHelper::setPlugValue ( expressionObj, "expression", expression );

        MPlug output = expressionFn.findPlug ( "output" );
        MPlug firstOutput = output.elementByLogicalIndex ( 0 );
        DagHelper::connect ( firstOutput, plug );
        return expressionObj;
    }
开发者ID:3dfreeman,项目名称:OpenCOLLADA,代码行数:12,代码来源:COLLADAMayaDagHelper.cpp

示例15: srcFn

    //---------------------------------------------------
    bool DagHelper::connectToList ( const MObject& source, const MString& sourceAttribute, const MObject& destination, const MString& destinationAttribute, int* index )
    {
        MStatus status;
        MFnDependencyNode srcFn ( source );

        MPlug src = srcFn.findPlug ( sourceAttribute, &status );

        if ( status != MStatus::kSuccess ) return false;

        return connectToList ( src, destination, destinationAttribute, index );
    }
开发者ID:3dfreeman,项目名称:OpenCOLLADA,代码行数:12,代码来源:COLLADAMayaDagHelper.cpp


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