pymel.core.system.namespaceInfo¶
- namespaceInfo(*args, **kwargs)¶
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.
- Modifications:
- returns an empty list when the result is None
- returns wrapped classes for listOnlyDependencyNodes
Flags:
Long Name / Short Name Argument Types Properties absoluteName / an bool 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:ballis an absolute namespace name while ns:ballis 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 bool 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:ballis 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 bool Display the name of the current namespace. dagPath / dp bool 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 bool 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:ballis a full name, whereas :ns:ballis 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 bool 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 bool Returns true if the namespace is root(:), false if not. listNamespace / ls bool List the contents of the namespace. listOnlyDependencyNodes / lod bool List all dependency nodes in the namespace. listOnlyNamespaces / lon bool List all namespaces in the namespace. parent / p bool 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 bool Can be specified with ‘listNamespace’, ‘listOnlyNamespaces’ or ‘listOnlyDependencyNode’ to cause the listing to recursively include any child namespaces of the namespaces; shortName / sn bool 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 have multiple arguments, passed either as a tuple or a list. Derived from mel command maya.cmds.namespaceInfo
Example:
import pymel.core as pm # List the contents of the current namespace # pm.namespaceInfo( listNamespace=True ) # Result: [u'CubeCompass', u'CustomGPUCacheFilter', u'DefaultAllLightsFilter', u'DefaultAllLightsFilter1', u'DefaultAllLightsFilter2', u'DefaultAllLightsFilter6', u'DefaultAllRenderClassificationsFilter', u'DefaultAllRenderClassificationsFilter1', u'DefaultAllRenderNodesFilter', u'DefaultAllShadingNodesFilter', u'DefaultBakeSetsFilter', u'DefaultBakeSetsFilter2', u'DefaultBasicRenderNodesFilter', u'DefaultCameraShapesFilter', u'DefaultCameraShapesFilter1', u'DefaultCameraShapesFilter4', u'DefaultCameraShapesImagePlanesFilter', u'DefaultCameraShapesImagePlanesFilter3', u'DefaultContainerFilter', u'DefaultContainerNodeFilter', u'DefaultExclLightShapesFilter', u'DefaultGeometryFilter', u'DefaultHiddenAttributesFilter', u'DefaultIkHandlesFilter', u'DefaultImagePlanesFilter', u'DefaultImagePlanesFilter1', u'DefaultImagePlanesFilter4', u'DefaultJointsFilter', u'DefaultLightLinkingLightFilter', u'DefaultLightShapesFilter', u'DefaultLightShapesPostProcsFilter', u'DefaultLightShapesPostProcsFilter1', u'DefaultLightShapesPostProcsFilter2', u'DefaultLightShapesTexturesFilter', u'DefaultLightShapesTexturesFilter1', u'DefaultLightsAndOpticalFXFilter', u'DefaultLightsAndOpticalFXFilter4', u'DefaultMaterialsAndShaderGlowFilter', u'DefaultMaterialsAndShaderGlowFilter6', u'DefaultMaterialsFilter', u'DefaultMaterialsFilter1', u'DefaultMaterialsFilter2', u'DefaultMaterialsFilter8', u'DefaultMaterialsTexturesLightShapesFilter', u'DefaultMaterialsTexturesLightShapesFilter1', u'DefaultMrContourContrastFilter', u'DefaultMrContourOutputFilter', u'DefaultMrContourShaderFilter', u'DefaultMrContourStoreFilter', u'DefaultMrDataConversionFilter', u'DefaultMrDisplacementFilter', u'DefaultMrEmitterFilter', u'DefaultMrEnvironmentFilter', u'DefaultMrGeometryFilter', u'DefaultMrLensFilter', u'DefaultMrLightFilter', u'DefaultMrLightmapFilter', u'DefaultMrMaterialFilter', u'DefaultMrMiscFilter', u'DefaultMrNodesFilter', u'DefaultMrOutputFilter', u'DefaultMrPhotonFilter', u'DefaultMrPhotonVolumeFilter', u'DefaultMrSampleCompositingFilter', u'DefaultMrShadowFilter', u'DefaultMrStateFilter', u'DefaultMrTextureFilter', u'DefaultMrVolumeFilter', u'DefaultNURBSObjectsFilter', u'DefaultNoShaderGlowFilter', u'DefaultNonExclLightShapesFilter', u'DefaultOpticalFXFilter', u'DefaultOpticalFXFilter1', u'DefaultOpticalFXFilter5', u'DefaultPolygonObjectsFilter', u'DefaultPostProcFilter', u'DefaultRenderUtilitiesFilter', u'DefaultRenderUtilitiesFilter5', u'DefaultRenderingFilter', u'DefaultSGLightShapesFilter', u'DefaultSGLightShapesTexturesFilter', u'DefaultSetsFilter', u'DefaultShaderGlowFilter', u'DefaultShaderGlowFilter1', u'DefaultShaderGlowFilter2', u'DefaultShaderGlowFilter8', u'DefaultShadingGroupsAndMaterialsFilter', u'DefaultShadingGroupsFilter', u'DefaultShadingGroupsFilter1', u'DefaultShadingGroupsFilter2', u'DefaultShadingGroupsFilter3', u'DefaultShadingGroupsFilter4', u'DefaultShadingGroupsFilter5', u'DefaultShadingGroupsFilter6', u'DefaultShadingGroupsFilter7', u'DefaultShadingGroupsFilter8', u'DefaultSubdivObjectsFilter', u'DefaultTextures2dFilter', u'DefaultTextures3dFilter', u'DefaultTexturesFilter', u'DefaultTexturesFilter1', u'DefaultTexturesFilter7', u'DefaultTexturesSGFilter', u'DefaultUsesImageFileFilter', u'Manipulator1', u'UI', u'UniversalManip', u'animCurveFilter', u'animLayersFilter', u'characterPartition', u'characterSetsFilter', u'clipsFilter', u'clusterSetsFilter', u'defaultCreaseDataSet', u'defaultHardwareRenderGlobals', u'defaultLayer', u'defaultLightList1', u'defaultLightSet', u'defaultObjectSet', u'defaultRenderGlobals', u'defaultRenderLayer', u'defaultRenderLayerFilter', u'defaultRenderQuality', u'defaultRenderUtilityList1', u'defaultRenderingList1', u'defaultResolution', u'defaultSetFilter', u'defaultShaderList1', u'defaultTextureList1', u'defaultViewColorManager', u'deformerSetsFilter', u'dof1', u'drivenKeyFilter', u'dynController1', u'dynamicFilter', u'expressionFilter', u'front', u'frontShape', u'globalCacheControl', u'groundPlane', u'groundPlane_transform', u'hardwareRenderGlobals', u'hardwareRenderingGlobals', u'hyperGraphInfo', u'hyperGraphLayout', u'ikSystem', u'initialMaterialInfo', u'initialParticleSE', u'initialShadingGroup', u'jointClusterSetsFilter', u'keyableFilter', u'lambert1', u'latticeSetsFilter', u'layerManager', u'layersFilter', u'lightLinker1', u'lightLinkingObjectFilter', u'lightList1', u'lightSetFilter', u'lightSetFilter1', u'nonLinearSetsFilter', u'notAnimLayersFilter', u'objectAttrFilter1', u'objectAttrFilter2', u'objectAttrFilter3', u'objectAttrFilter4', u'objectAttrFilter5', u'objectAttrFilter6', u'objectAttrFilter7', u'objectAttrFilter8', u'objectFilter17', u'objectFilter18', u'objectFilter19', u'objectFilter20', u'objectFilter21', u'objectNameFilter1', u'objectNameFilter2', u'objectNameFilter3', u'objectNameFilter4', u'objectScriptFilter1', u'objectScriptFilter2', u'objectScriptFilter3', u'objectScriptFilter4', u'objectScriptFilter5', u'objectScriptFilter6', u'objectScriptFilter7', u'objectScriptFilter8', u'objectScriptFilter9', u'objectScriptFilter10', u'objectTypeFilter1', u'objectTypeFilter2', u'objectTypeFilter3', u'objectTypeFilter4', u'objectTypeFilter5', u'objectTypeFilter6', u'objectTypeFilter7', u'objectTypeFilter8', u'objectTypeFilter9', u'objectTypeFilter10', u'objectTypeFilter11', u'objectTypeFilter12', u'objectTypeFilter13', u'objectTypeFilter14', u'objectTypeFilter15', u'objectTypeFilter16', u'objectTypeFilter17', u'objectTypeFilter18', u'objectTypeFilter19', u'objectTypeFilter20', u'objectTypeFilter21', u'objectTypeFilter22', u'objectTypeFilter23', u'objectTypeFilter24', u'objectTypeFilter25', u'objectTypeFilter26', u'objectTypeFilter27', u'objectTypeFilter28', u'objectTypeFilter29', u'objectTypeFilter30', u'objectTypeFilter31', u'objectTypeFilter32', u'objectTypeFilter33', u'objectTypeFilter34', u'objectTypeFilter35', u'objectTypeFilter36', u'objectTypeFilter37', u'objectTypeFilter38', u'objectTypeFilter39', u'objectTypeFilter40', u'objectTypeFilter41', u'objectTypeFilter42', u'objectTypeFilter43', u'objectTypeFilter44', u'objectTypeFilter45', u'objectTypeFilter46', u'objectTypeFilter47', u'objectTypeFilter48', u'objectTypeFilter49', u'objectTypeFilter50', u'objectTypeFilter51', u'objectTypeFilter52', u'objectTypeFilter67', u'objectTypeFilter68', u'objectTypeFilter69', u'objectTypeFilter70', u'objectTypeFilter71', u'objectTypeFilter72', u'objectTypeFilter73', u'objectTypeFilter74', u'objectTypeFilter75', u'objectTypeFilter76', u'objectTypeFilter77', u'objectTypeFilter78', u'objectTypeFilter79', u'otherDeformerSetsFilter', u'particleCloud1', u'partitionFilter', u'persp', u'perspShape', u'polyMergeEdgeToolDefaults', u'polyMergeFaceToolDefaults', u'postProcessList1', u'publishedFilter', u'relationshipPanel1LeftAttrFilter', u'relationshipPanel1RightAttrFilter', u'renderGlobalsList1', u'renderLayerFilter', u'renderLayerManager', u'renderPartition', u'renderPassSetsFilter', u'renderPassesFilter', u'renderableObjectSetFilter', u'renderableObjectSetFilter1', u'renderableObjectSetFilter2', u'renderableObjectShapeFilter', u'renderableObjectShapeFilter1', u'renderableObjectShapeFilter2', u'renderableObjectsAndSetsFilter', u'renderableObjectsAndSetsFilter1', u'renderingSetsFilter', u'rotateFilter', u'scaleFilter', u'scaleRotateTranslateFilter', u'selectionListOperator1', u'selectionListOperator2', u'selectionListOperator3', u'selectionListOperator4', u'selectionListOperator5', u'selectionListOperator6', u'selectionListOperator7', u'selectionListOperator8', u'selectionListOperator9', u'selectionListOperator10', u'selectionListOperator11', u'selectionListOperator12', u'selectionListOperator13', u'selectionListOperator14', u'selectionListOperator15', u'selectionListOperator16', u'selectionListOperator17', u'selectionListOperator18', u'selectionListOperator19', u'selectionListOperator20', u'selectionListOperator21', u'selectionListOperator22', u'selectionListOperator23', u'selectionListOperator24', u'selectionListOperator25', u'selectionListOperator26', u'selectionListOperator27', u'selectionListOperator28', u'selectionListOperator29', u'selectionListOperator30', u'selectionListOperator57', u'selectionListOperator58', u'selectionListOperator59', u'selectionListOperator60', u'selectionListOperator61', u'selectionListOperator62', u'selectionListOperator63', u'selectionListOperator64', u'selectionListOperator65', u'selectionListOperator66', u'sequenceManager1', u'shaderGlow1', u'shared', u'side', u'sideShape', u'skinClusterSetsFilter', u'strokeGlobals', u'time1', u'top', u'topShape', u'translateFilter', u'world'] # # List the parent of the current namespace # pm.namespaceInfo( parent=True ) # Result: u'' # # List the parent of the current namespace with short name # pm.namespaceInfo( parent=True, shortName=True ) # Result: u'' # # Determine if the current namespace is root # pm.namespaceInfo( rootNamespace=True ) # List the parent of the current namespace with absolute name # pm.namespaceInfo( parent=True, absoluteName=True ) # List dependency nodes including internal nodes # pm.namespaceInfo(listOnlyDependencyNodes = True, internal = True); # samples of query info of specified namespace pm.namespace( set =":" ) pm.namespace( add ="sample" ) pm.namespace( set =":sample" ) pm.namespace( add ="sun" ) # List the contents of the specified namespace # pm.namespaceInfo( ":sample", listNamespace=True ) # Result: sample:sun # List the parent of the specified namespace # pm.namespaceInfo( ":sample:sun", parent=True ) # result: sample # List the parent of the specified namespace with baseName name # pm.namespaceInfo( ":sample:sun", parent=True, baseName=True ) # result: sample # Determine if the specified namespace is root # pm.namespaceInfo( ":", isRootNamespace=True ) # result: True # List the parent of the specified namespace with absolute name # pm.namespaceInfo( ":sample:sun", parent=True, absoluteName=True ) # result: :sample # List dependency nodes including internal nodes # pm.namespaceInfo( ":sample", listOnlyNamespaces = True ) # result: sample:sun # Query the namespace name and have it returned in different formats # pm.namespaceInfo( ":sample:sun", baseName = True ) # result: "sun" pm.namespaceInfo( ":sample:sun", fullName = True ) # result: "sample:sun" pm.namespaceInfo( "sample:sun", absoluteName = True ) # result: ":sample:sun"