There may be situations where you need to remove nodes from a particular namespace and subsequently remove the reserved namespace from the scene. These situations might be as follows:
- You imported the reference file directly into your parent scene and plan to export selected nodes to a new file or reference.
- You need to clear a namespace currently in use so the file can be referenced by other users without introducing namespace conflicts. This is a good practice if you are exporting a file that may contain unwanted, reserved namespaces.
When removing namespaces, you have the option to merge referenced or imported object namespaces with a namespace that exists in the parent scene. When duplicate namespaces occur, the namespaces are merged and duplicate object names are incrementally suffixed with a number.
You can remove namespaces using the Namespace Editor or by using MEL commands.
Remove namespaces using the Namespace Editor
- Determine the namespace for a node by selecting any object/node that uses the namespace.
The namespace for the object/node appears highlighted in the Channel Box and Outliner. For example, an object’s name with an assigned namespace can appear as follows:
spaceJunk:pSphere1
- In the
Namespace Editor, select the namespace you want to remove.
- Click
Delete.
If the namespace you want to remove contains nodes, the Delete: namespace window appears.
- In the
Delete: namespace window, click one of the following:
- Merge with Root to merge the namespace and move the nodes contained by the deleted namespace to the root namespace.
- Merge with Parent to merge the namespace and move the nodes contained by the deleted namespace to an immediate parent namespace.
- Delete to delete the namespace and the nodes contained by the namespace.
Remove namespaces using MEL commands
The next two procedures show you how to remove nodes from an existing namespace in a scene using the namespace MEL command. You can remove the namespace and its contents, or remove that namespace and merge its contents with a root or parent namespace.
To remove a specified namespace for all nodes in a scene
- Determine the namespace for a node by selecting any object/node that uses the namespace.
The namespace for the object/node appears in the Channel Box, Outliner, or other editor when it is selected. An object’s name with an assigned namespace would appear as follows:
spaceJunk:pSphere1
In this example, the namespace is called spaceJunk.
- In the
Command Line, do the following:
- To remove the
spaceJunk namespace and merge any nodes that reside within the
spaceJunk namespace with the root namespace, type:
namespace -mergeNamespaceWithRoot -removeNamespace "spaceJunk";
- To remove the
spaceJunk namespace and merge any nodes that reside within the
spaceJunk namespace with a parent namespace, type:
namespace -mergeNamespaceWithParent -removeNamespace "spaceJunk";
- To move any nodes that reside within the
spaceJunk namespace so they reside in the default namespace.
namespace -mv “spaceJunk” “:” -f
Any nodes that had the spaceJunk namespace now have no namespace specified. That is, the : specifies the default namespace and the -f flag forces the command even if it produces naming conflicts. As a result, nodes with identical names will be assigned an incremental number.
- To remove the
spaceJunk namespace and merge any nodes that reside within the
spaceJunk namespace with the root namespace, type:
To remove a reserved namespace from a file
- You should know the name of the reserved namespace prior to removing it. For more information on determining the namespaces in the scene, see namespace MEL command. In this example, the namespace to be removed is called spaceJunk.
- In the
Command Line, type the following text string to remove the reserved
spaceJunk namespace from the scene.
namespace -rm “spaceJunk”
Note:Namespaces cannot be named so they conflict with any existing namespaces currently in use within the scene.