Created
June 22, 2012 20:20
-
-
Save mrmurphy/2974955 to your computer and use it in GitHub Desktop.
Import all references from Maya
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pymel.core as pm | |
def importAllReferences(): | |
print("Importing all references...") | |
done = False | |
while (done == False and (len(pm.listReferences()) != 0)): | |
refs = pm.listReferences() | |
print("Importing " + str(len(refs)) + " references.") | |
for ref in refs: | |
if ref.isLoaded(): | |
done = False | |
ref.importContents() | |
else: | |
done = True | |
print("Done importing references...") | |
return True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! You saved some time for me today :)
for others that find this:
the while statement could be cleaner with:
while not done and (len(pm.listReferences()) != 0):