本文整理汇总了C++中MFnDependencyNode::attributeCount方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnDependencyNode::attributeCount方法的具体用法?C++ MFnDependencyNode::attributeCount怎么用?C++ MFnDependencyNode::attributeCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnDependencyNode
的用法示例。
在下文中一共展示了MFnDependencyNode::attributeCount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: parseAttributes
MStatus AttributeParser::parseAttributes(MFnDependencyNode & fnNode, AttributeParser & parser)
{
MStatus status;
unsigned int attrCount = fnNode.attributeCount(&status);
for (unsigned int attrIndex = 0; attrIndex < attrCount; ++attrIndex)
{
MObject attrObject = fnNode.attribute(attrIndex, &status);
MFnAttribute fnAttr(attrObject, &status);
if (!status) continue;
MString attrName = fnAttr.name(&status);
if (!parser.onBeforeAttribute(fnNode, attrObject))
continue;
parser.parseAttribute(fnNode, attrObject);
//if (!parser.onAfterAttribute(fnNode, attrObject))
// continue;
parser.onAfterAttribute(fnNode, attrObject);
}
return MS::kSuccess;
}
示例3: updateRuleFiles
MStatus PRTAttrs::updateRuleFiles(MFnDependencyNode & node, MString & rulePkg) {
PRTNode* prtNode = (PRTNode*)node.userNode();
MStatus stat;
std::string utf8Path(rulePkg.asUTF8());
std::vector<char> percentEncodedPath(2*utf8Path.size()+1);
size_t len = percentEncodedPath.size();
prt::StringUtils::percentEncode(utf8Path.c_str(), &percentEncodedPath[0], &len);
if(len > percentEncodedPath.size()+1){
percentEncodedPath.resize(len);
prt::StringUtils::percentEncode(utf8Path.c_str(), &percentEncodedPath[0], &len);
}
std::string uri(FILE_PREFIX);
uri.append(&percentEncodedPath[0]);
prtNode->mLRulePkg = uri;
if(prtNode->mCreatedInteractively) {
int count = (int)node.attributeCount(&stat);
MCHECK(stat);
MObjectArray attrs;
for(int i = 0; i < count; i++) {
MObject attr = node.attribute(i, &stat);
if(stat != MS::kSuccess) continue;
attrs.append(attr);
}
for(unsigned int i = 0; i < attrs.length(); i++) {
MPlug plug(node.object(), attrs[i]);
MString name = plug.partialName();
if(prtNode->mBriefName2prtAttr.count(name.asWChar()))
node.removeAttribute(attrs[i]);
}
prtNode->destroyEnums();
} else {
node.removeAttribute(node.attribute(NAME_GENERATE, &stat));
MCHECK(stat);
}
prtNode->mRuleFile.clear();
prtNode->mStartRule.clear();
MString unpackDir = MGlobal::executeCommandStringResult("workspace -q -fullName");
unpackDir += "/assets";
prt::Status resolveMapStatus = prt::STATUS_UNSPECIFIED_ERROR;
std::wstring utf16URI;
utf16URI.resize(uri.size()+1);
len = utf16URI.size();
if(prt::StringUtils::toUTF16FromUTF8(uri.c_str(), &utf16URI[0], &len)) {
utf16URI.resize(len);
prt::StringUtils::toUTF16FromUTF8(uri.c_str(), &utf16URI[0], &len);
}
prtNode->mResolveMap = prt::createResolveMap(utf16URI.c_str(), unpackDir.asWChar(), &resolveMapStatus);
if(resolveMapStatus == prt::STATUS_OK) {
size_t nKeys;
const wchar_t * const* keys = prtNode->mResolveMap->getKeys(&nKeys);
std::wstring sCGB(L".cgb");
for(size_t k = 0; k < nKeys; k++) {
std::wstring key = std::wstring(keys[k]);
if(std::equal(sCGB.rbegin(), sCGB.rend(), key.rbegin())) {
prtNode->mRuleFile = key;
break;
}
}
} else {
prtNode->mResolveMap = 0;
}
if(prtNode->mRuleFile.length() > 0)
updateStartRules(node);
return MS::kSuccess;
}