本文整理汇总了C++中MFnDependencyNode::getConnections方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnDependencyNode::getConnections方法的具体用法?C++ MFnDependencyNode::getConnections怎么用?C++ MFnDependencyNode::getConnections使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnDependencyNode
的用法示例。
在下文中一共展示了MFnDependencyNode::getConnections方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: isConnected
bool isConnected(const char *attrName, MFnDependencyNode& depFn, bool dest, bool primaryChild = false)
{
MStatus stat;
MPlugArray pa;
depFn.getConnections(pa);
for (uint pId = 0; pId < pa.length(); pId++)
{
if (dest)
{
if (!pa[pId].isDestination())
continue;
}
else{
if (!pa[pId].isSource())
continue;
}
MPlug plug = pa[pId];
if (primaryChild)
while (plug.isChild())
plug = plug.parent();
if (plug.isElement())
plug = plug.array();
if ((getAttributeNameFromPlug(plug) == attrName))
return true;
}
return false;
}
示例2: isConnected
bool isConnected(const char *attrName, MFnDependencyNode& depFn, bool dest, bool primaryChild = false)
{
MStatus stat;
MPlugArray pa;
depFn.getConnections(pa);
std::vector<std::string> stringParts;
pystring::split(attrName, stringParts, ".");
MString attName = attrName;
if (stringParts.size() > 1)
attName = stringParts.back().c_str();
if (pystring::endswith(attrName, "]"))
{
int found = attName.rindex('[');
if (found >= 0)
attName = attName.substring(0, found-1);
}
for (uint pId = 0; pId < pa.length(); pId++)
{
if (dest)
{
if (!pa[pId].isDestination())
continue;
}
else
{
if (!pa[pId].isSource())
continue;
}
MPlug plug = pa[pId];
if (primaryChild)
while (plug.isChild())
plug = plug.parent();
MString plugName = plug.name();
if (plug.isElement())
plug = plug.array();
MString attNameFromPlug = getAttributeNameFromPlug(plug);
if ((attNameFromPlug == attName))
return true;
}
return false;
}
示例3: printShadingData
void exportTerrain::printShadingData(const MFnMesh& theMesh, MString texture)
{
MObjectArray shaders;
MIntArray indices;
MPlug tPlug;
MPlugArray connections,inConnections;
MObject node,shaderObject;
MFnDependencyNode dpNode;
MStatus status;
int i,j;
theMesh.getConnectedShaders(0 , shaders, indices);
fout << "Shading Data:" << endl;
//Will assume that only one shader is used, and therefore only prints
//data for the first index;
//Assuming only one shader
dpNode.setObject( shaders[0] );
dpNode.getConnections(connections);
for(i=0;i < connections.length();++i){
connections[i].connectedTo(inConnections,true,true);
for(j=0;j<inConnections.length();++j){
node = inConnections[j].node();
dpNode.setObject(node);
if(node.hasFn(MFn::kLambert) ){
shaderObject = node;
}
}
}
MFnLambertShader shader(shaderObject, &status);
if(!status){
status.perror("Unable to create MFnLambertShader!");
return;
}
//Collect all the data
fout << "Diffuse_Color: " << (shader.diffuseCoeff(&status)*(MColor(1.0,1.0,1.0) )*shader.color(&status)) *
(MColor(1.0,1.0,1.0) - shader.transparency(&status) )<< endl;
fout << "Ambient: " << shader.ambientColor(&status) << endl;
fout << "Emmision_Color: " << shader.incandescence(&status) << endl;
if(shaderObject.hasFn(MFn::kBlinn) ){
MFnBlinnShader blinn(shaderObject);
fout << "Specular_Color: " << blinn.specularColor() << endl;
fout << "Shininess: " << blinn.eccentricity() << endl;
}
else if(shaderObject.hasFn(MFn::kPhong) ){
MFnPhongShader phong(shaderObject);
fout << "Specular_Color: " << phong.specularColor() << endl;
fout << "Shininess: " << phong.cosPower() << endl;
}
else{
fout << "Specular_Color: " << MColor() << endl;
fout << "Shininess: " << double(0) << endl;
}
fout << "Texture: " << texture << endl;
}