Change(replace) file within reference

怎甘沉沦 提交于 2020-03-06 04:37:05

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!