本文整理汇总了C++中ShaderNode::addInPlug方法的典型用法代码示例。如果您正苦于以下问题:C++ ShaderNode::addInPlug方法的具体用法?C++ ShaderNode::addInPlug怎么用?C++ ShaderNode::addInPlug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ShaderNode
的用法示例。
在下文中一共展示了ShaderNode::addInPlug方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: mtm_readShaderDefs
bool mtm_readShaderDefs()
{
std::string homeDir = getenv("MTM_HOME");
std::string shaderDefFile = homeDir + "/ressources/shaderDefinitions.txt";
std::ifstream shaderFile(shaderDefFile.c_str());
if( !shaderFile.good())
{
logger.error(MString("Unable to open shaderInfoFile ") + MString(shaderDefFile.c_str()));
shaderFile.close();
return false;
}
String line;
StringArray stringArray;
ShaderNode currentNode;
int lineNumber = -1;
do{
std::getline(shaderFile, line);
lineNumber++;
if( line.length() > 0 )
{
// get rid of any spaces and newlines
line = pystring::strip(line);
if( line.length() == 0)
continue;
line = pystring::replace(line, " ", "");
// filtering comments
if(pystring::startswith(line, "#"))
continue;
if( pystring::count(line, ":") > 0)
{
pystring::split(line, stringArray, ":");
}
if(pystring::startswith(line, "name"))
{
if( stringArray.size() > 1 )
{
currentNode.mayaName = MString(stringArray[1].c_str());
currentNode.mayaTypeName = currentNode.mayaName;
currentNode.internalTypeName = currentNode.mayaName.substring(1,currentNode.mayaName.length() - 1);
}
}
if(pystring::startswith(line, "shader_start"))
{
if( stringArray.size() > 1 )
{
ShaderNode sn;
if(mtm_findShaderNodeByName(stringArray[1], sn))
{
logger.debug(MString("Found parent Node ") + sn.mayaTypeName);
currentNode = sn; // simply copy existing node into this and continue to build
}
}
}
if(pystring::startswith(line, "inatt"))
{
if( stringArray.size() > 3 )
{
currentNode.addInPlug(stringArray[1], stringArray[2], stringArray[3]);
}else{
logger.error(MString("Error: not enough arguments in line ") + lineNumber + "! Expecting 4 Values, got " + (int)stringArray.size());
}
}
if(pystring::startswith(line, "outatt"))
{
if( stringArray.size() > 2 )
{
currentNode.addOutPlug(stringArray[1], stringArray[2]);
}else{
logger.error(MString("Error: not enough arguments in line ") + lineNumber + "! Expecting 3 Values, got " + (int)stringArray.size());
}
}
// there exist some special pass through attributes like displacement in a displacementShader. These are in and output attributes with
// the same name. Bad for me...
if(pystring::startswith(line, "inoutatt"))
{
if( stringArray.size() > 2 )
{
currentNode.addOutPlug(stringArray[1], stringArray[2]);
currentNode.outPlugs[currentNode.outPlugs.size() - 1].isInOut = true;
}else{
logger.error(MString("Error: not enough arguments in line ") + lineNumber + "! Expecting 3 Values, got " + (int)stringArray.size());
}
}
if(pystring::endswith(line, "shader_end"))
{
mtm_ShaderDefinitions.push_back(currentNode);
// clean new node
currentNode = ShaderNode();
}
}
}while(!shaderFile.eof());
//.........这里部分代码省略.........