just in case someone needs a flexible python script to remove certain edits:
def removeRefedits(attr='fileTextureName',edit_command =
'setAttr',mode='remove',refNode='ani:*RN*',unloadRef=True ):
'''
removes certain refedits - refnodes need to be unload before running the
script
@refNode is important to search in the right refNodes - please adjust for
current shot/asset you're working 'MDL:*RN*', 'ani:*RN*'
'''
if mode == 'return':
fileNodes = []
refs = cmds.ls(refNode)
for ref in refs:
#print ref
nodes = cmds.referenceQuery( ref, editNodes=True )
attr_types = cmds.referenceQuery( ref, editAttrs=True )
if mode == 'remove':
fileNodes = []
for node in nodes:
if 'file' in node:
fileNodes.append(node)
#print node
if mode == 'remove':
if unloadRef==True:
cmds.file(unloadReference=ref)
for fNode in fileNodes:
cmds.referenceEdit( fNode+'.'+attr, failedEdits=True,
successfulEdits=True, removeEdits=True, editCommand=edit_command)
print 'removed refedits from',fNode
if unloadRef==True:
cmds.file(loadReference=ref)
if mode == 'return':
if attr == 'fileTextureName':
if fileNodes:
return fileNodes
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/097224c0-4309-4845-9e6a-00c15b1198b9%40googlegroups.com.