Change(replace) file within reference

2019-08-24 00:00发布

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 )

标签: python maya
1条回答
女痞
2楼-- · 2019-08-24 00:31

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).

查看更多
登录 后发表回答