本文整理汇总了C++中MFnDependencyNode::hasAttribute方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnDependencyNode::hasAttribute方法的具体用法?C++ MFnDependencyNode::hasAttribute怎么用?C++ MFnDependencyNode::hasAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnDependencyNode
的用法示例。
在下文中一共展示了MFnDependencyNode::hasAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: doIt
MStatus testGlassCmd::doIt(const MArgList &args)
{
MStatus stat=MStatus::kSuccess;
MSelectionList list;
MFnDependencyNode meshDependFn;
MFnDependencyNode materialDependFn;
MDGModifier dgMod;
//create a new material node, here is the test glass node
MObject testGNode=dgMod.createNode(testGlassNode::id);
materialDependFn.setObject(testGNode);
MString testName=materialDependFn.name();
MGlobal::displayInfo(testName+" god, please give me the node first time");
//find the mesh node(s) from selected object(s)
//create a new "yafaray material" attribute if the mesh node(s) dont have
//then conect the material node to the mesh node(s)
MGlobal::getActiveSelectionList( list );
MItSelectionList iter( list, MFn::kMesh );
for( ; !iter.isDone(); iter.next())
{
MObject meshDependNode;
MFnNumericAttribute numAttr;
iter.getDependNode( meshDependNode );
meshDependFn.setObject( meshDependNode );
//MString dependName=dependFn.name();
//MGlobal::displayInfo(dependName+" is here\n");
if( !meshDependFn.hasAttribute("YafarayMaterial") )
{
MObject attrYafarayMaterial=numAttr.create("YafarayMaterial","yama",MFnNumericData::kBoolean);
numAttr.setDefault( true );
numAttr.setStorable( true );
meshDependFn.addAttribute(attrYafarayMaterial,MFnDependencyNode::kLocalDynamicAttr);
}
//find the source plug and the result plug, then connect them
//if the result plug as already had a sourse plug connected to it, disconnect first
MPlug glassPlug=materialDependFn.findPlug("OutGlass");
MPlug meshPlug=meshDependFn.findPlug("YafarayMaterial");
MPlugArray srcMeshPlug;
if(meshPlug.connectedTo(srcMeshPlug, true, false))
{
MPlug srcPlug;
//if(srcMeshPlug.length!=0)
//{
srcPlug=srcMeshPlug[0];
//}
dgMod.disconnect(srcPlug, meshPlug);
}
dgMod.connect(glassPlug,meshPlug);
}
dgMod.doIt();
//why still cant got the name here?
MGlobal::displayInfo(testName+" god, please give me the node second time");
return stat;
}