Skip to content

Instantly share code, notes, and snippets.

@lclibardi
Created March 21, 2018 19:02
Show Gist options
  • Save lclibardi/4610390cd764f8bb644808b346995902 to your computer and use it in GitHub Desktop.
Save lclibardi/4610390cd764f8bb644808b346995902 to your computer and use it in GitHub Desktop.
Recursively import all nested references in a Maya scene.
// IMPORT ONLY TOP LEVEL REFERENCES
string $references[] = `ls -type "reference"`;
for ( $r in $references)
{
string $ref = `referenceQuery -filename $r`;
file -importReference $ref;
}
// RECURSIVELY IMPORT ALL REFERENCES
{
string $topLevelReferences[] = `file -q -r`;
do {
string $topLevelReferences[] = `file -q -r`;
for ($ref in $topLevelReferences){
file -importReference $ref;
}
}
while (size(`file -q -r`) > 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment