def get_node_in_namespace_hierarchy(node, namespace=None, shape=False):
"""Searches a namespace and all nested namespaces for the given node.
:param node: Name of the node.
:param namespace: Root namespace
:param shape: True to get the shape node, False to get the transform.
:return: The node in the proper namespace.
"""
if shape and node and cmds.objExists(node):
node = get_shape(node)
if node and cmds.objExists(node):
return node
if node and namespace:
# See if it exists in the namespace or any child namespaces
namespaces = [namespace.replace(':', ''),]
namespaces += cmds.namespaceInfo(namespace, r=True, lon=True) or []
for namespace in namespaces:
namespaced_node = '{0}:{1}'.format(namespace, node)
if shape:
namespaced_node = get_shape(namespaced_node)
if namespaced_node and cmds.objExists(namespaced_node):
return namespaced_node
return None
评论列表
文章目录