Go to: Synopsis. Return value. Related. Flags. Python examples.
namespaceInfo(
string
, [absoluteName=boolean], [baseName=boolean], [currentNamespace=boolean], [dagPath=boolean], [fullName=boolean], [internal=boolean], [isRootNamespace=string], [listNamespace=boolean], [listOnlyDependencyNodes=boolean], [listOnlyNamespaces=boolean], [parent=boolean], [recurse=boolean], [shortName=boolean])
Note: Strings representing object names and arguments must be separated by commas. This is not depicted in the synopsis.
namespaceInfo is undoable, NOT queryable, and NOT editable.
This command displays information about a namespace. The target namespace can optionally be specified on the command line.
If no namespace is specified, the command will display information about the current namespace.
A namespace is a simple grouping of objects under a given name.
Each item in a namespace can then be identified by its own name, along
with what namespace it belongs to. Namespaces can contain other
namespaces like sets, with the restriction that all namespaces
are disjoint.
Namespaces are primarily used to resolve name-clash issues in Maya,
where a new object has the same name as an existing object
(from importing a file, for example).
Using namespaces, you can have two objects with the same name, as long as
they are contained in different namespaces.
Note that namespaces are a simple grouping of names, so
they do not effect selection, the DAG, the Dependency Graph, or any other
aspect of Maya. All namespace names are colon-separated.
The namespace format flags are: "baseName"("shortName"), "fullName" and "absoluteName".
The flags are used in conjunction with the main query flags to specify the desired namespace format of the returned result. They can also be used to return the different formats of a specified namespace.
By default, when no format is specified, the result will be returned as a full name.
namespace
absoluteName, baseName, currentNamespace, dagPath, fullName, internal, isRootNamespace, listNamespace, listOnlyDependencyNodes, listOnlyNamespaces, parent, recurse, shortName
Long name (short name) |
Argument types |
Properties |
|
absoluteName(an)
|
boolean
|
|
|
This is a general flag which can be used to specify the desired format for
the namespace(s) returned by the command.
The absolute name of the namespace is a full namespace path, starting from the root namespace ":"
and including all parent namespaces. For example ":ns:ball" is an absolute namespace
name while "ns:ball" is not.
The absolute namespace name is invariant and is not affected by the current namespace or
relative namespace modes.
See also other format modifiers 'baseName', 'fullName', etc
|
|
baseName(bn)
|
boolean
|
|
|
This is a general flag which can be used to specify the desired format for
the namespace(s) returned by the command. The base name of the namespace
contains only the leaf level name and does not contain its parent namespace(s).
For example the base name of an object named "ns:ball" is "ball".
This mode will always return the base name in the same manner, and is not affected by the
current namespace or relative namespace mode.
See also other format modifiers 'absoluteName', 'fullName', etc
The flag 'shortName' is a synonym for 'baseName'.
|
|
currentNamespace(cur)
|
boolean
|
|
|
Display the name of the current namespace.
|
|
dagPath(dp)
|
boolean
|
|
|
This flag modifies the 'listNamespace' and
'listOnlyDependencyNodes' flags to indicate that the names
of any dag objects returned will include as much of the dag path
as is necessary to make the names unique. If this flag is not
present, the names returned will not include any dag paths.
|
|
fullName(fn)
|
boolean
|
|
|
This is a general flag which can be used to specify the desired format for
the namespace(s) returned by the command. The full name of the namespace
contains both the namespace path and the base name, but without the leading colon representing
the root namespace.
For example "ns:ball" is a full name, whereas ":ns:ball" is an absolute name.
This mode is affected by the current namespace and relative namespace modes.
See also other format modifiers 'baseName', 'absoluteName', etc.
|
|
internal(int)
|
boolean
|
|
|
This flag is used together with the 'listOnlyDependencyNodes' flag.
When this flag is set, the returned list will
include internal nodes (for example itemFilters) that are not listed by default.
|
|
isRootNamespace(ir)
|
string
|
|
|
Returns true if the namespace is root(":"), false if not.
|
|
listNamespace(ls)
|
boolean
|
|
|
List the contents of the namespace.
|
|
listOnlyDependencyNodes(lod)
|
boolean
|
|
|
List all dependency nodes in the namespace.
|
|
listOnlyNamespaces(lon)
|
boolean
|
|
|
List all namespaces in the namespace.
|
|
parent(p)
|
boolean
|
|
|
Display the parent of the namespace.
By default, the list returned will not include internal nodes (such as itemFilters).
To include the internal nodes, use the 'internal' flag.
|
|
recurse(r)
|
boolean
|
|
|
Can be specified with 'listNamespace', 'listOnlyNamespaces'
or 'listOnlyDependencyNode' to cause the listing to recursively
include any child namespaces of the namespaces;
|
|
shortName(sn)
|
boolean
|
|
|
This flag is deprecated and may be removed in future releases of Maya.
It is a synonym for the baseName flag. Please use the baseName flag instead.
|
|
Flag can appear in Create mode of command
|
Flag can appear in Edit mode of command
|
Flag can appear in Query mode of command
|
Flag can have multiple arguments, passed either as a tuple or a list.
|
import maya.cmds as cmds
# List the contents of the current namespace
#
cmds.namespaceInfo( listNamespace=True )
# List the parent of the current namespace
#
cmds.namespaceInfo( parent=True )
# List the parent of the current namespace with short name
#
cmds.namespaceInfo( parent=True, shortName=True )
# Determine if the current namespace is root
#
cmds.namespaceInfo( rootNamespace=True )
# List the parent of the current namespace with absolute name
#
cmds.namespaceInfo( parent=True, absoluteName=True )
# List dependency nodes including internal nodes
#
cmds.namespaceInfo(listOnlyDependencyNodes = True, internal = True);
# samples of query info of specified namespace
cmds.namespace( set =":" )
cmds.namespace( add ="sample" )
cmds.namespace( set =":sample" )
cmds.namespace( add ="sun" )
# List the contents of the specified namespace
#
cmds.namespaceInfo( ":sample", listNamespace=True )
# Result: sample:sun
# List the parent of the specified namespace
#
cmds.namespaceInfo( ":sample:sun", parent=True )
# result: sample
# List the parent of the specified namespace with baseName name
#
cmds.namespaceInfo( ":sample:sun", parent=True, baseName=True )
# result: sample
# Determine if the specified namespace is root
#
cmds.namespaceInfo( ":", isRootNamespace=True )
# result: True
# List the parent of the specified namespace with absolute name
#
cmds.namespaceInfo( ":sample:sun", parent=True, absoluteName=True )
# result: :sample
# List dependency nodes including internal nodes
#
cmds.namespaceInfo( ":sample", listOnlyNamespaces = True )
# result: sample:sun
# Query the namespace name and have it returned in different formats
#
cmds.namespaceInfo( ":sample:sun", baseName = True )
# result: "sun"
cmds.namespaceInfo( ":sample:sun", fullName = True )
# result: "sample:sun"
cmds.namespaceInfo( "sample:sun", absoluteName = True )
# result: ":sample:sun"