public static void RenameDagList(MDagPath[] dagList, string formatStr) { MDagModifier dagModifier = new MDagModifier(); for (int i = 0; i < dagList.Length; i++) { dagModifier.renameNode(dagList[i].node, string.Format(formatStr, i)); } dagModifier.doIt(); }
override public void redoIt() { _dagModifier.doIt(); var dagFn = new MFnDagNode(_transform); _shape = dagFn.child(0); _dagModifier.renameNode(_shape, "motionCameraShape"); _dagModifier.doIt(); }
private void renameNodes(MObject transform, string baseName) { // Rename the transform to something we know no node will be using. dagMod.renameNode(transform, "polyPrimitiveCmdTemp"); // Rename the mesh to the same thing but with 'Shape' on the end. MFnDagNode dagFn = new MFnDagNode(transform); dagMod.renameNode(dagFn.child(0), "polyPrimitiveCmdTempShape"); // Now that they are in the 'something/somethingShape' format, any // changes we make to the name of the transform will automatically be // propagated to the shape as well. // // Maya will replace the '#' in the string below with a number which // ensures uniqueness. string transformName = baseName + "#"; dagMod.renameNode(transform, transformName); }
public override void doIt(MArgList argl) { MGlobal.displayInfo("Hello World\n"); _dagModifier = new MDagModifier(); _transform = _dagModifier.createNode("camera"); _dagModifier.renameNode(_transform, "motionCamera"); redoIt(); }