Skip to content

Instantly share code, notes, and snippets.

@patwooky
Created September 20, 2016 09:47
Show Gist options
  • Save patwooky/a89fe1edd8f859fac8f7c74a33749d8b to your computer and use it in GitHub Desktop.
Save patwooky/a89fe1edd8f859fac8f7c74a33749d8b to your computer and use it in GitHub Desktop.
this code swaps an existing reference file with another user defined file
'''
Written by: Patrick Woo
[email protected]
Run this bit of code in a python tab in Maya
Description:
this code swaps an existing reference file with another user file defined in the replaceFileFullPath variable.
the user just needs to select an object belonging to the referenced file
usage:
- select object(s) that belongs to a referenced file (referenced into the scene)
- change the replaceFileFullPath to hold the full path to an existing maya file in your hard-drive
'''
from maya.cmds import file as mcfile
replaceFileFullPath = r'E:\jobs\vhq_pipeline\maya\lodSwap\resource\LODTest - from Chris Yao_20160906\Trees_LODTest_mod_lod100.ma'
for x in ls(sl=True):
print mcfile(replaceFileFullPath, loadReference=x.referenceFile().refNode.name(), returnNewNodes=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment