protected void getAddAttrCmds(MObject node, MStringArray cmds) { // // Run through the node's attributes. // MFnDependencyNode nodeFn = new MFnDependencyNode(node); uint numAttrs = nodeFn.attributeCount; uint i; for (i = 0; i < numAttrs; i++) { // // Use the attribute ordering which Maya uses when doing I/O. // MObject attr = nodeFn.reorderedAttribute(i); // // If this attribute has been added since the node was created, // then we may want to write out an addAttr statement for it. // if (nodeFn.isNewAttribute(attr)) { MFnAttribute attrFn = new MFnAttribute(attr); // // If the attribute has a parent then ignore it because it will // be processed when we process the parent. // bool bFound; attrFn.parent(out bFound); if ( !bFound ) { // // If the attribute is a compound, then we can do its entire // tree at once. // try { MFnCompoundAttribute cAttrFn = new MFnCompoundAttribute(attr); MStringArray newCmds = new MStringArray(); cAttrFn.getAddAttrCmds(newCmds); uint numCommands = newCmds.length; int c; for (c = 0; c < numCommands; c++) { if (newCmds[c] != "") cmds.append(newCmds[c]); } } catch (Exception) { string newCmd = attrFn.getAddAttrCmd(); if (newCmd != "") cmds.append(newCmd); } } } } }