This commit is contained in:
2025-04-17 04:52:48 +08:00
commit 9985b73dc1
3708 changed files with 2387532 additions and 0 deletions

View File

@ -0,0 +1,26 @@
import maya.cmds as cmds
def remove_namespaces(node):
try:
# Note rsplit instead of split
namespace, name = node.rsplit(":", 1)
except:
namespace, name = None, node
if namespace:
try:
cmds.rename(node, name)
except RuntimeError:
# Can't remove namespaces from read-only nodes
# E.g. namespaces embedded in references
pass
def deleteNamespace():
for node in cmds.ls(sl=1):
# Remove namespaces of all children first
for descendent in cmds.listRelatives(node, allDescendents=True):
remove_namespaces(descendent)
# Finally, remove namespace from current selection
remove_namespaces(node)