In maya help there is one specific flag "buildLoadSettings" for file command. It allows to load information about the scene without loading the actual scene into maya.
cmds.file( myFile, o=1, bls=True )
And it nicely prints out all the references. But how can I actually get those references? Anything, a file would be nice.
Because querying for references give me just the references in the scene. And since "buildLoadSettings" does not load any nodes I cannot get any info about anything.
This is from help:
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"
But what the hell is "implicitLoadSettings" and how can I get information from it?
implicitLoadSettings
is a temp string saved by Maya, which is primarily intended for internal use within the Preload Reference Editor (see the link below).
You can read back your implicitLoadSettings
with the selLoadSettings
command:
http://download.autodesk.com/us/maya/2010help/CommandsPython/selLoadSettings.html
Basic example:
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)