Force Maya to load all references in an open file

70 views
Skip to first unread message

Steve Davy

unread,
Jan 14, 2025, 7:51:14 PMJan 14
to Maya Group
Does anyone know a way to force Maya to load all nested references in a file that's already open?

This has been an issue that's bugged me for decades.

When using a lot of nested references it seems like you can only choose to load all references upon opening the file. Once it's already open, references that contain child references within them have to be loaded by hand. In other words, once you've opened the file I'm not aware of any way to tell Maya to load a top level reference AND all of its children in one go. 

It can be a huge time waster when needing to load and unload things from an open file for workflow reasons. Currently working on such a file and spending half my time twirling carrots and having to check boxes and wait for things to load. 🙁

joiec...@gmail.com

unread,
Jan 15, 2025, 6:55:39 AMJan 15
to maya_he3d
Correct me if I'm wrong, but if you unload a top reference, that doesn't unload its children, only the top node is unloaded. So if you reload the top node again, all children are loaded too.
Also you can check the MEL commands for file loading and see if there is any flags for you: https://help.autodesk.com/cloudhelp/CHS/MayaCRE-Tech-Docs/Commands/file.html

stephenkmann

unread,
Jan 15, 2025, 1:39:42 PMJan 15
to maya...@googlegroups.com
nested reference have been a real nitemare for me.. 

I've been working on and off on an importer for all references. and I haven't found a way to list ALL references when they are nested. only the top nodes..

so. if you want to import. and also load.. you could try this:



all_ref_paths = cmds.file(q=True, reference=True) or []  # Get a list of all top-level references in the scene.

for ref_path in all_ref_paths:
    print(ref_path)
    isLoaded  = cmds.referenceQuery(ref_path, isLoaded=True)
    print(isLoaded)
    if cmds.referenceQuery(ref_path, isLoaded=True) == True:  # Only import it if it's
        print (ref_path)
        cmds.file(ref_path, importReference=True)  #import the reference

        new_ref_paths = cmds.file(q=True, reference=True)  # If the reference had any nested references they will now become top-level references, so recollect them.
        if new_ref_paths:
            for new_ref_path in new_ref_paths:
                if new_ref_path not in all_ref_paths:  # Only add on ones that we don't already have.
                    all_ref_paths.append(new_ref_path)

    else:
        cmds.file(ref_path, loadReference=True)  # Load the reference
        


but I'm assuming you want to keep the refs in tact. 


Normally I never ever work with nested references... as they've almost always caused naming issues. 
(just running into a system where the artists are using nested references right now , and trying to fix it all) 

hth
-=s




--
You received this message because you are subscribed to the Google Groups "maya_he3d" group.
To unsubscribe from this group and stop receiving emails from it, send an email to maya_he3d+...@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/maya_he3d/7d256853-f693-4ad9-9258-f3fb3cec1c7an%40googlegroups.com.


--

steve davy

unread,
Jan 16, 2025, 8:32:03 PMJan 16
to maya_he3d
I assume that's an import script then (my Python reading no so good)? For the time being I do need to keep references live.

Nested references can be a minefield and not for the faint of heart. It does depend on meticulous naming, using namespaces, and keeping files clean. In other words, not appropriate for most team production scenarios 😉

But over the years I've managed to leverage 3 or 4 levels of referencing to create some very complex scenes where there's a lot of instancing and randomization required. It's kind of a hacky way of creating modular procedural systems that are built up into larger assets as you move downstream. I should really learn Houdini as I think this is much easier in that program and such things can be built inside a single file versus having to constantly edit and load external files with Maya referencing (maybe BiFrost can do this now?).

I'm currently using this approach to create a rig for an opening book with 300 pages, which then requires six book assets in the animation, so a total of 1,800 unique pages. All with a simple single bend deformer on a root page rig —no dynamics required, and the animation file remains incredibly light.

Fortunately I'm working solo at the moment so can leverage my OCD to make it work. :D

Steve Davy

unread,
Jan 17, 2025, 2:01:40 AMJan 17
to maya...@googlegroups.com
That is correct.

However I often have scenarios where I want to open a file with only top level references loaded, or even no references, and then selectively load assets into the open file as needed.

In that scenario loading the top references usually will not automatically also load their children.

There doesn't seem to be any feature to control this. There needs to be a "load all children" RMB option or similar, in the way that you collapse/expand or collapse all/expand all a node hierarchy in the hypergraph.


From: maya...@googlegroups.com <maya...@googlegroups.com> on behalf of joiec...@gmail.com <joiec...@gmail.com>
Sent: Wednesday, January 15, 2025 3:55 AM
To: maya_he3d <maya...@googlegroups.com>
Subject: [maya_he3d] Re: Force Maya to load all references in an open file
 

stephenkmann

unread,
Jan 17, 2025, 6:29:36 PMJan 17
to maya...@googlegroups.com
 Just to clarify , I do work with multiple levels of files.. 

but I compress each levels references   ...   ( early in Maya references would totally mess up layers .. and other stuff not related to what you actually want )    
ie:   model ref into rig ->  cleaned/imported rig file --> anm --> cleaned / imported anm file --> lighting 

At bluesky we called this "insulating files"    With each "publish" being a single file that exists to not get messed up.. like   if someone published a new model.. it wouldn't irrevocably mess up a rig. 

-=s







Fred Lewis

unread,
Jan 17, 2025, 9:59:37 PMJan 17
to maya...@googlegroups.com
That seems to be the safe way to do it.  Nested references give me PTSD (from the old days when I was naive enough to try it). And for some reason animators and lighters don't seem to like having extra dependencies and namespaces...  ;)

Anthony Enos

unread,
Jan 17, 2025, 10:17:29 PMJan 17
to maya...@googlegroups.com
Hey Fred! I work the same way Stephen mentions above if I understand correctly. Average is probably 2 layers deep even when working on my own projects, but as many as 5 on occasion, if I remember correctly: model>rig>anim>light>fx

I also publish clean versionless files so it propagates to multiple shots, and always use .ma files just in case anything gets wonky. For me, the time savings more than made up for the occasional reference pain where I'd open a .ma file and have to fix some weird problem with a text editor.

The biggest problems I've encountered with Maya references were when I was constantly updating/replacing them with new versions. Tricking Maya into thinking the file hasn't changed helps a ton.

steve...@gmail.com

unread,
Jan 17, 2025, 10:28:51 PMJan 17
to maya_he3d
I don't know if you remember some of the projects at Eveo Fred (you're probably still in therapy trying to forget them), but I did some nutty stuff with referencing there.

I have a vague memory of even managing to get instancing working with referenced assets and being able to still dial in some randomized behavior with a little utility I wrote in MEL.

In hindsight it doesn't even make sense.

Nor does the fact that the project didn't implode at some point. 😉

Fred Lewis

unread,
Jan 17, 2025, 10:50:28 PMJan 17
to maya...@googlegroups.com
My workflow recently has been to reference model into rig. Then publish the rig (importing and saving a published copy) for the animator . Then animator references published rig. Then animator publishes (importing and saving a published copy) for lighter. This works great as it "insulates" as mentioned.

Yes the PTSD is from Eveo, Steve. 😉

Steve Davy

unread,
Jan 18, 2025, 2:18:47 PMJan 18
to maya...@googlegroups.com
Oh yeah, that's a given with any referencing system — you don't want to be constantly changing the file name.

Of course the ideal is you have version management tools that prevent problems and allow for easy rollback.

When working solo and without such tools I'm just super careful to keep every version of every referenced asset separately so that I can roll back, and after a certain point in the process (e.g. once an asset is in a file and animated), test every last little update before committing to versioning up in the referenced data set.

Render layers and shader assignment are a whole other set of problems, but again with consistency and care it can be managed. Even then Maya won't always play nice, like properly update a value on an attribute that I KNOW has not been adjusted downstream. Workarounds like plugging in constants for color or keyframing/locking are sometimes necessary to kick it in the butt.

Given a Maya scene is basically just one big spreadsheet, it's always a mystery to me how certain things work and others just don't.


From: maya...@googlegroups.com <maya...@googlegroups.com> on behalf of stephenkmann <stephe...@gmail.com>
Sent: Friday, January 17, 2025 3:28 PM
To: maya...@googlegroups.com <maya...@googlegroups.com>
Subject: Re: [maya_he3d] Re: Force Maya to load all references in an open file
 

Steve Davy

unread,
Jan 18, 2025, 2:18:52 PMJan 18
to maya...@googlegroups.com
I don't know if you remember some of the projects at Eveo Fred (you're probably still in therapy trying to forget them), but I did some nutty stuff with referencing there.

I have a vague memory of even managing to get instancing working with referenced assets and being able to still dial in some randomized behavior with a little utility I wrote in MEL.

In hindsight it doesn't even make sense.

Nor does the fact that the project didn't implode at some point. 😉

From: maya...@googlegroups.com <maya...@googlegroups.com> on behalf of Anthony Enos <antho...@gmail.com>
Sent: Friday, January 17, 2025 7:17 PM
To: maya...@googlegroups.com <maya...@googlegroups.com>
Subject: Re: [maya_he3d] Re: Force Maya to load all references in an open file
 
Reply all
Reply to author
Forward
0 new messages