• google
  • linkedin
  • skype
  • youtube
Namespace remover

Namespace remover

This small script will help you to get rid of annoying namespaces that looks like a garbage in the Namespace editor in case if you have many imported objects without namespace organizing. If you sure that your objects in the scene has unique names and there will no name clashes after namespace removing – do it without any doubts.

Just paste the code below in the Script Editor and run it:

import maya.cmds as cmds
nsp = cmds.namespaceInfo( lon=1, r=1 )
nsp.remove( 'UI' )
nsp.remove( 'shared' )

for n in nsp[::-1]:
    try:
        cmds.namespace( mv=( n, ':' ), f=1 )
        cmds.namespace( rm=n )
    except RuntimeError:
        pass

Leave a reply