Edit reference paths

You can edit reference paths using the Reference Editor. You can also customize the Unresolved Name field so that it includes a specified prefix.

To edit a reference path

  1. Open the Reference Editor by selecting File > Reference Editor.
  2. In the Unresolved Name field, type the new path or enter an environment variable, and then click Reload to load the reference from that location.

    If Maya cannot find the referenced file in the specified location, it looks in several default locations to find the file.

Customize the Unresolved name with a prefix

You use the following Python script to customize the Unresolved name field so that, instead of the absolute path, the file path is displayed with a prefix of your choice.

import os.path
import maya.cmds as cmds
import maya.mel as mel
import maya.OpenMaya as OpenMaya
mel.eval('string $MyScenes; putenv $MyScenes "C:/Documents and Settings/admin/My Documents/maya/projects/default/scenes/"')
def foo(retCode, fileObject, clientData):
     print "Callback was given %s" % fileObject.rawFullName()
     rel = "$MyScenes/"
     rel = rel + (os.path.basename(fileObject.rawFullName()))
     print "Callback changed this to %s" % rel
     fileObject.setRawFullName(rel)
     OpenMaya.MScriptUtil.setBool(retCode, True)
id = OpenMaya.MSceneMessage.addCheckFileCallback(OpenMaya.MSceneMessage.kBeforeReferenceCheck, foo)
# for deleting the callback 
OpenMaya.MMessage.removeCallback(id)

Related topics