Create namespaces

 
 
 

You can create namespaces in the Namespace Editor as well as when you reference or import a file into your scene. When you create a namespace during file referencing or importing, the file name is used as the namespace by default.

You can also create namespaces from the command line using the -namespace -add "newNs" MEL command.

After you create a namespace you can edit it using the Namespace Editor. See Edit namespaces.

Create namespaces using the Namespace Editor

To create a namespace using the Namespace Editor

  1. Open the Namespace Editor by selecting Window > General Editors > Namespace Editor.

    The Namespace Editor appears.

  2. Click New.

    Maya creates a new namespace.

  3. To rename the new namespace, double-click it.

    The Rename Namespace window appears.

  4. In the Rename Namespace window type a new name, and then click OK.

Create namespaces when referencing or importing

When you are creating a file reference or importing a file, you can create the namespace used by the referenced and imported objects.

NoteThe Reference Options window and the Import Options window have the same settings for creating namespaces. This procedure can be used for creating namespaces when importing files by referring to the Import Options window rather than the Reference Options windows.

To create a namespace during file referencing or importing

  1. In the parent file, select File > Create Reference > .

    The Reference Options window appears.

  2. In the Namespace Options, turn on Use namespaces.
  3. Specify how the namespaces are generated by selecting one of the following:
    • Use selected namespace as parent and add new namespace (file name) to prefix the namespace with the filename.
    • Use selected namespace as parent and add new namespace string to prefix the namespace with a text string. Type your string in the field provided.
    • Merge into selected namespace and rename incoming objects that match to merge the object's namespace with an existing namespace.

      In the case where duplicate namespaces occur, the namespaces are merged and duplicate object names are incrementally suffixed with a number. Use this option to avoid an accumulation of new namespaces each time your referenced or imported objects have the same namespace.

  4. If you want to specify a unique name or text string rather than the filename for the namespace, select New Namespace String , and then type your string in the field that appears.
  5. Click Reference.

    A File Browser appears.

  6. Navigate to the file you want to reference and then click Reference.

    The file is referenced into the parent scene. If you open the Outliner, you can see that the object names for the referenced objects are all prefixed with either the referenced file's name or your namespace text string.

You can edit namespaces using the Namespace Editor, Reference Editor or by using MEL commands. For more information see Namespace Editor Overview, Reference Editor overview, and Work with file references.

Create namespaces from the command line

You can use the following MEL commands to create namespaces in the command line. -add "newNS"flag with -namespace command to create a namespaces in the command line:

You can also create namespaces when renaming nodes by specifying the namespace name of the new node.

For example:

rename "ns1:obj1" ":newNs2:obj1" creates a new newNs2, namespace if it doesn't already exist.

Related topics

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