Edit namespaces

You can edit namespaces using the Namespace Editor or by using MEL commands. These operations include setting the current namespace and turning on Relative Namespaces mode so that you can refer to namespaces relative to the current namespace.

Set current namespace

Set current namespace using the Namespace Editor

  1. In the Namespace Editor, select the namespace you want to set to current.
  2. Click Set Current.

    The icon indicates that the selected namespace is now the current namespace.

To set the current namespace using a MEL command

  1. In the command line, enter namespace -set “<your namespace>”; .
  2. Press enter.

Set relative namespace mode

You can refer to namespaces relative to the current namespace. This can help streamline the Outliner and allows you to simplify MEL commands by eliminating the need to constantly include the namespace.

For example, if you had a cube in a namespace named cube_space and set the current namespaces to cube_space, you could use the command setAttr pCube1.translateX rather than having to specify setAttr cube_space:pCube1.translateX.

You can use either the Namespace Editor or MEL commands to turn on Relative Namespaces mode.

Use the Namespace Editor to turn on Relative Namespaces mode

  1. In the Namespace Editor, select Options > Relative Namespaces.

    Maya updates the display of all namespaces in the Outliner relative to the current namespace.

To use a MEL command to display namespaces relative to a particular namespace

  1. In the MEL command line, type the following command:
    namespace -set "cube_space"
    

    Replace cube_space with the namespace you want to set to current.

  2. In the MEL command line, type the following command:
    namespace -rel on
    

    Maya displays all the namespaces in the Outliner relative to the namespace set in step 1. If a node is not within that namespace, its name is preceded with “:” followed by its own namespace.

  3. Change the current namespace at any time with the command namespace -set followed by the namespace’s name in quotes (as in step 1). Maya updates the display of all namespaces in the Outliner relative to the new current namespace.
  4. Turn off relative namespaces at any time with the command namespace -rel off.

Related topics