buildLoadSettings,获取引用信息

buildLoadSettings, get information about references

在 maya 帮助中,有一个用于文件命令的特定标志 "buildLoadSettings"。它允许加载有关场景的信息,而无需将实际场景加载到 Maya 中。

cmds.file( myFile, o=1, bls=True )

而且它很好地打印出所有参考文献。但是我怎样才能真正获得这些参考资料呢?什么都有,有文件就好了。

因为查询参考只给我场景中的参考。由于 "buildLoadSettings" 不加载任何节点,因此我无法获得有关任何信息的任何信息。

这来自帮助:

When used with the "o/open" flag it indicates that the specified file should be read for reference hierarchy information only. This information will be stored in temporary load settings under the name "implicitLoadSettings"

但是 "implicitLoadSettings" 到底是什么东西,我怎样才能从中获取信息?

implicitLoadSettings 是 Maya 保存的临时字符串,主要供 Preload Reference Editor 内部使用(参见下面的 link) .

您可以使用 selLoadSettings 命令读回您的 implicitLoadSettingshttp://download.autodesk.com/us/maya/2010help/CommandsPython/selLoadSettings.html

基本示例:

from maya import cmds
cmds.file('/path/to/file_with_references.mb', o=1, bls=1)

nsettings = range(cmds.selLoadSettings(ns=1, q=1))
# cast id numbers to strings and skip id 0
# (id '0' is the base file containg the references)
ids = [str(i) for i in nsettings if i]
print cmds.selLoadSettings(ids, fn=1, q=1)