问题
I need to replace an OLD file with a NEW file within a reference. There is a referenceEdit command but no flags for replacing a file.
so ideally I need sth like:
cmds.referenceQuery( myReference, e=1, file=NEW )
回答1:
You should be able to replace references by using the file
command.
Assuming your reference node's name is known (otherwise you can retrieve it via referenceQuery
) and the name is myReferenceRN
, you can do:
from maya import cmds
cmds.file("/path/to/new/reference/file.mb", loadReference="myReferenceRN")
This will update the file path which myReferenceRN
currently points to, with the one you specify as the first argument of the file
command (in this case, /path/to/new/reference/file.mb
).
来源:https://stackoverflow.com/questions/44703839/changereplace-file-within-reference