PyMel:
This will filter the edits by type, and by namespace:import pymel.core as pm def removeRefEditCmd(editCommand, namespace=None): """ Tool to remove reference edits. editCommand : string : Valid values are: "addAttr", "connectAttr", "deleteAttr", "disconnectAttr", "parent", "setAttr", "lock" and "unlock". namespace : bool\string : Default None. If None, act on all references in the scene. Otherwise a valid namespace (without semicolon ":") """ allRefs = pm.getReferences() for r in allRefs: ref = allRefs[r] if namespace and namespace != ref.fullNamespace: continue edits = ref.getReferenceEdits(editCommand=editCommand) if edits: print "Found %s edits in: %s"%(editCommand, r) ref.unload() ref.removeReferenceEdits(editCommand=editCommand, force=True, successfulEdits=True, failedEdits=True) ref.load() for es in edits: print "\t", es print "\tRemoved the above %s edits"%editCommand removeRefEditCmd(editCommand="disconnectAttr")Here's another way, to only do on certain attrs on certain nodes in a certain namespace:
import pymel.core as pm nodes = pm.ls("namespace:nodePfx_*.translate") for node in nodes: pm.referenceEdit( node, editCommand='setAttr', removeEdits=True, failedEdits=True, successfulEdits=True )
Python
(Slightly older)Note, this can print a LOT of stuff depending on what's changed in the reference:
# Python Code import maya.cmds as mc allRefs = mc.file(query=True, reference=True) for ref in allRefs: refNode = mc.file(ref, query=True, referenceNode=True) print refNode, ref editStrings = mc.referenceQuery(ref, topReference=True, editStrings=True, successfulEdits=True) for es in editStrings: print "\t", es # Remove all edits: mc.file(unloadReference=refNode) mc.file(cleanReference=refNode) mc.file(loadReference=refNode)
This tip comes from over at the Maya Station blog:
If you have made changes to your reference file which has then caused incorrect results, For example making changes to an expression then saving the reference file causes you to lose your expression information; simply reloading the reference file will not be enough to get the original data back.
You will need to remove the wrong edits. In order to do this you need to unload your reference from the Reference Editor, and then go to Reference Editor ->List Reference Edits. In the window that pops up select the wrong edits and click on Remove Selected Edits. Once this is done you can Reload you reference, through the reference editor.