Exclude attributes from locked references

 
 
 

There are two MEL procedures that you can use to exclude attributes from the Lock option on referenced files. One procedure is used to exclude specific, individual attributes while the other to exclude all attributes of a specified node type. These MEL procedures can be found in the scripts\others folder of your Maya installation directory. The follows sections demonstrate how to use these procedures.

MEL procedure for excluding individual attributes

This example shows you how to create your own MEL procedure to specify which attributes to exclude from 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;
    }
    

    Add or remove any $lockReferenceExcludedAttributes[n] lines as necessary to specify the attributes to exclude using the same syntax as in the above example. Ensure that the array indices [n] are consecutive.

  3. 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 MEL and Expressions.

MEL procedure for excluding attributes by node type

This example shows you how to create your own MEL procedure to specify which attributes get excluded by node type. 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;
    }
    

    Add or remove any $lockReferenceExcludedNodeTypes[n] lines as necessary to specify the attributes by node type using the same syntax as in the above example. Ensure that the array indices [n] are consecutive.

  3. 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.

Related topics

Creative Commons License Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License