Go to: Synopsis. Return value. Keywords. Related. Flags. MEL examples.
referenceEdit [-applyFailedEdits] [-changeEditTarget string string] [-editCommand string] [-failedEdits boolean] [-onReferenceNode string] [-removeEdits] [-successfulEdits boolean]
referenceEdit is NOT undoable, NOT queryable, and NOT editable.
Use this command to remove and change the modifications which have been applied to references. A valid commandTarget is either a reference node, a reference file, a node in a reference, or a plug from a reference. Only modifications that have been made from the currently open scene can be changed or removed. The 'referenceQuery -topReference' command can be used to determine what modifications have been made to a given commandTarget. Additionally only unapplied edits will be affected. Edits are unapplied when the node(s) which they affect are unloaded, or when they could not be successfully applied. By default this command only works on failed edits (this can be adjusted using the "-failedEdits" and "-successfulEdits" flags). Specifying a reference node as the command target is equivalent to specifying every node in the target reference file as a target. In this situation the results may differ depending on whether the target reference is loaded or unloaded. When it is unloaded, edits that affect both a node in the target reference and a node in one of its descendant references may be missed (e.g. those edits may not be removed). This is because when a reference is unloaded Maya no longer retains detailed information about which nodes belong to it. However, edits that only affect nodes in the target reference or in one of its ancestral references should be removed as expected. When the flags -removeEdits and -editCommand are used together, by default all connectAttr edits are removed from the specified source object. To remove only edits that connect to a specific target object, the target object can be passed as an additional argument to the command. This narrows the match criteria, so that only edits that connect the source object to the provided target in this additional argument are removed. See the example below. NOTE: When specifying a plug it is important to use the appropriate long attribute name.None
Long name (short name) | Argument types | Properties | ||
---|---|---|---|---|
-applyFailedEdits(-afe)
|
|
|||
|
||||
-changeEditTarget(-cet)
|
string string
|
|||
|
||||
-failedEdits(-fld)
|
boolean
|
|||
|
||||
-removeEdits(-r)
|
|
|||
|
||||
-successfulEdits(-scs)
|
boolean
|
|||
|
||||
-editCommand(-ec)
|
string
|
|||
|
||||
-onReferenceNode(-orn)
|
string
|
|||
|
Flag can appear in Create mode of command | Flag can appear in Edit mode of command |
Flag can appear in Query mode of command | Flag can be used more than once in a command. |
// // EXAMPLE FOR -removeEdits // // Assume: // main.ma contains a reference to mid.ma. // mid.ma contains a reference to bot.ma. // NOTE: The target reference must be unloaded for the // following commands to work. // Remove all the edits which apply to mid.ma. // This can be done by specifying either the reference // node or the reference file. referenceEdit -removeEdits midRN; referenceEdit -removeEdits "mid.ma"; // Remove all "setAttr" edits which apply to mid.ma. // This can be done by specifying either the reference // node or the reference file. referenceEdit -editCommand "setAttr" -removeEdits midRN; referenceEdit -editCommand "setAttr" -removeEdits "mid.ma"; // Remove all the "parent" edits which apply to mid:pSphere1. referenceEdit -editCommand "parent" -removeEdits mid:pSphere1; // Remove all the "connectAttr" edits which apply to mid:pSphere1.translateX. referenceEdit -editCommand "connectAttr" -removeEdits mid:pSphere1.translateX; // Remove the "connectAttr" edit having mid::pSphere1.translateX as a source and mid:pSphere2.translateX as a destination referenceEdit -failedEdits true -successfulEdits true -editCommand connectAttr -removeEdits "|mid:pSphere1.translateX" "|mid:pSphere2.translateX"; // Remove all the edits which apply to bot.ma and are stored on midRN. // The referenceEdit command is only capable of removing edits which // are stored on a top level reference node. The only edits which // are stored on a top level reference node are those which were made // from the main scene. If the file mid.ma was previously opened and // modifications were made to bot.ma, those edits can only be removed // by opening mid.ma and issuing a referenceEdit command. // referenceEdit -removeEdits mid:botRN; referenceEdit -removeEdits "bot.ma"; // // EXAMPLE FOR -changeEditTarget // string $tempDir = `internalVar -utd`; // Create a reference containing pSphere1. // file -f -new; polySphere -r 1 -sx 20 -sy 20 -ax 0 1 0 -ch 1; file -rename ($tempDir + "ref.ma"); file -f -type "mayaAscii" -save; // Reference the file in and position pSphere1 // file -f -new; file -r -ns "ref" ($tempDir + "ref.ma"); select -r ref:pSphere1; move 5 5 5; file -rename ($tempDir + "top.ma"); file -f -type "mayaAscii" -save; // Later on its determined that pSphere1 is actually // BobMrozowski. // file -f -o ($tempDir + "ref.ma"); rename pSphere1 BobMrozowski; file -f -type "mayaAscii" -save; // Now go to open your main scene again... // file -f -o ($tempDir + "top.ma"); // ... and notice that BobMrozowski is back at // the origin. // // So remap all edits so that anything that used to // affect ref:pSphere1 now affects ref:BobMrozowski... // referenceEdit -changeEditTarget "ref:pSphere1" "ref:BobMrozowski" "refRN"; // ... and then force all previously failing edits affecting // refRN to be re-applied. // referenceEdit -applyFailedEdits "refRN"; // BobMrozowski should now be back at 5 5 5. //