Skip to content

Instantly share code, notes, and snippets.

@Roumenov
Created July 5, 2021 21:07
Show Gist options
  • Save Roumenov/d8fc4dfefde0eca52f88aaa49634d568 to your computer and use it in GitHub Desktop.
Save Roumenov/d8fc4dfefde0eca52f88aaa49634d568 to your computer and use it in GitHub Desktop.
because the replace_target_reference() function wasn't well thought out
import pymel.core as pm
import vo_maya.core.vo_export as voe
reload(voe)
#replace namespace
voe.replace_target_namespace("mesh", "r")
voe.replace_target_namespace("rig", "r")
voe.replace_target_namespace("char", "r")
refs = pm.listReferences()
print refs
badpath = r'/Art_sourcefiles/Characters/scenes/Rigs/Baptiste/Baptiste_RIG.ma'
goodpath = r'/PotionomicsSourceAssets/Art_sourcefiles/Characters/scenes/Rigs/baptiste_rig.mb'
def fix_bapt_refs(refs, goodpath, badpath):
for reference in refs:
if reference.path.abspath() == os.path.abspath(badpath):
reference.replaceWith(goodpath)
else:
pass
fix_bapt_refs(refs, goodpath, badpath)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment