pymel.core.other.NameParser

Inheritance diagram of NameParser

class NameParser
addPrefix(prefix)

addPrefixToName

attr(attr)

access to AttributeName of a node. returns an instance of the AttributeName class for the given AttributeName.

>>> NameParser('foo:bar').attr('spangle')
AttributeName(u'foo:bar.spangle')
namespace()

Returns the namespace of the object with trailing colon included

namespaceList()

Useful for cascading references. Returns all of the namespaces of the calling object as a list

stripGivenNamespace(namespace, partial=True)

Returns a new instance of the object with any occurrences of the given namespace removed. The calling instance is unaffected. The given namespace may end with a ‘:’, or not. If partial is True (the default), and the given namespace has parent namespaces (ie, ‘one:two:three’), then any occurrences of any parent namespaces are also stripped - ie, ‘one’ and ‘one:two’ would also be stripped. If it is false, only namespaces

>>> NameParser('foo:bar:top|foo:middle|foo:bar:extra:guy.spangle').stripGivenNamespace('foo:bar')
AttributeName(u'top|middle|extra:guy.spangle')
>>> NameParser('foo:bar:top|foo:middle|foo:bar:extra:guy.spangle').stripGivenNamespace('foo:bar', partial=False)
AttributeName(u'top|foo:middle|extra:guy.spangle')
stripNamespace(levels=0)

Returns a new instance of the object with its namespace removed. The calling instance is unaffected. The optional levels keyword specifies how many levels of cascading namespaces to strip, starting with the topmost (leftmost). The default is 0 which will remove all namespaces.

>>> NameParser('foo:bar.spangle').stripNamespace()
AttributeName(u'bar.spangle')
swapNamespace(prefix)

Returns a new instance of the object with its current namespace replaced with the provided one. The calling instance is unaffected.

Previous topic

pymel.core.other.DependNodeName

Next topic

pymel.core.rendering

Core

Core Modules

Other Modules

This Page