Locking a file reference
 
 
 

You can lock file references to prevent them from being accidentally modified when they are referenced in your scene. You can lock a new file reference by turning on the Lock option in the Create Reference Options window when you first create the file reference. You lock an existing file reference from within the Reference Editor. The Lock option locks all of the nodes and attributes for a file reference.

Locking file references is useful in collaborative work environments when its important to have the nodes and attributes of files locked to avoid accidental modifications by the users that reference the files. When a file reference is locked, a special lock icon appears beside the listed reference within the Reference Editor.

If you reference a file without turning on the Lock option, any pre-existing attributes that were locked in a referenced file remain unchanged. That is, if the file being referenced has pre-existing locked attributes when it gets referenced, they remain locked.

You can load and unload a locked reference file and the locked attributes will remain unchanged. If you need to modify any nodes or attributes on a locked reference file you can unlock and later re-lock the reference file using the Reference Editor.

NoteIt is not possible to save reference edits to a locked file reference. It must first be unlocked.

To lock or unlock an existing file reference

  1. In the Reference Editor, select the file reference you want to lock or unlock by clicking on its name.
  2. In the Reference Editor, do one of the following
    • Select Reference > Lock Reference.
    • Select Reference > Unlock Reference.
    • -click the selected reference and choose Reference > Lock Reference or Unlock Reference from the context sensitive menu that appears.

With the exception of a few specific attributes and node types, all nodes and attributes for a file reference are locked by default. The attributes and node types that are excluded by the Lock option are specified by two MEL procedures. Each procedure outputs a string array that is used by the Lock option to specify the attributes to be excluded. The first procedure specifies which individual attributes to exclude. The second procedure specifies which attributes, by node type, to exclude. That is, the entire set of attributes for a given node type are excluded from locking by simply declaring the node type in the array.

Regardless of which attributes are excluded, the Lock option always locks all of the nodes for the referenced file.

You can override the MEL procedures that ship with Maya by creating your own customized MEL procedures. Your MEL procedures must be named exactly the same as the ones that ship with Maya. You must additionally ensure the files are placed in the Maya script path.

For more information on working with MEL procedures in Maya, see the MEL and Expressions guide. For more information on customizing the lock settings in your particular production environment see below.

Customizing lock settings for file references

The following examples describe the MEL procedures for excluding attributes and attributes by node type that were shipped with Maya. They can be used as the basis for creating your own customized MEL procedures.

NoteWhile these procedures are fully customizable through MEL, users working in a team production environment should be cautious when changing these procedures in mid-production as the change could inadvertently affect the overall pipeline and the data.

Example 1: MEL procedure for excluding attributes

This example shows you how to create your own MEL procedure to specify which attributes get excluded by the file referencing lock operation. The MEL procedure provided in this example is the same procedure that is distributed with Maya.

  1. Create a MEL file using a text editor, and name the MEL file: getLockReferenceExcludedAttributes.mel.
  2. Add the following text to the file, ensuring you follow the exact syntax:
global proc string[] getLockReferenceExcludedAttributes()
{
// Return a string array containing a list of attributes
// to be skipped during locking of a referenced file. The
// listed attributes locked state will remain the same as
// in the referenced file.
string $lockReferenceExcludedAttributes[];
$lockReferenceExcludedAttributes[0] = "visibility";
return $lockReferenceExcludedAttributes;
}
NoteAdd or remove any attributes you want excluded by the locking operation by editing this text as necessary. That is, add or remove any $lockReferenceExcludedAttributes[n] lines as necessary using the same syntax as in the above example, also ensuring the array indices [n] are consecutive.
  1. Save the MEL file and place it in your Maya script path.

    If you named the MEL file exactly the same as the default one that is distributed with Maya, the Lock option uses this new customized script for locking file references the next time Maya starts.

    For more information on sourcing MEL scripts and working with MEL procedures in general, see the MEL and Expressions guide.

Example 2: MEL procedure for excluding node types

This example shows you how to create your own MEL procedure to specify which attributes, by node type, get excluded by the file referencing lock operation. The MEL procedure provided in this example is the same procedure that is distributed with Maya.

  1. Create your MEL file using your favorite text editor, and name the MEL file: getLockReferenceExcludedNodeTypes.mel.
  2. Add the following text to the file, ensuring you follow the exact syntax:
global proc string[] getLockReferenceExcludedNodeTypes()
{
// Return a string array containing a list of node types // whose attributes should be skipped during locking of a // referenced file.
string $lockReferenceExcludedNodeTypes[];
$lockReferenceExcludedNodeTypes[0] = "lightLinker";
$lockReferenceExcludedNodeTypes[1] = "displayLayerManager";
$lockReferenceExcludedNodeTypes[2] = "displayLayer";
$lockReferenceExcludedNodeTypes[3] = "renderLayerManager";
$lockReferenceExcludedNodeTypes[4] = "renderLayer";
return $lockReferenceExcludedNodeTypes;
}
NoteAdd or remove any node types you want excluded by the locking operation by editing this text as necessary. That is, add or remove any $lockReferenceExcludedNodeTypes[n] lines as necessary using the same syntax as in the above example, also ensuring the array indices [n] are consecutive.
  1. Save the MEL file and place it in your Maya script path.

    If you named the MEL file the same as the default one that is shipped with Maya, the Lock option uses this new customized script for locking file references the next time Maya starts.

    For more information on sourcing MEL scripts and working with MEL procedures in general, see the MEL and Expressions guide.