Specifying what is referenced into scene on load


#1

Hi all,

I have 2 maya files “scene_A” and “scene_B” and both scenes contain a reference to “reference_file_1”.

I want to create a UI to make opening files easier, where you can choose to open either scene_A or scene_B, but where you can also choose the reference scene that gets referenced in, so that instead of “reference_file_1” opening every time, you can for example specify “reference_file_4”.

So when using the file command, is it possible to specify the file which the scene references in? Or is this information stored in the scene so that you can only change the reference after the scene has already loaded in?

It works if I load the file first and then on the next line replace the reference, but I just wondered if you could do it in a single command.

Thanks.


#2

…I just wondered if you could do it in a single command.
Taking a look through Maya python docs for cmds.file(), I couldn’t find any flags for updating reference paths during file open. I did spot this loadReferenceDepth(lrd) flag though:

cmds.file("...", open=True, loadReferenceDepth="none")

With this, you could specify to not load references when you open the scene. Then, as you suggested, you could update the reference path and load.