Python maya.OpenMaya.MTypeId() Examples

The following are 2 code examples of maya.OpenMaya.MTypeId(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module maya.OpenMaya , or try the search function .
Example #1
Source File: cmdx.py    From cmdx with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def typeId(self):
        """Return the native maya.api.MTypeId of this node

        Example:
            >>> node = createNode("transform")
            >>> node.typeId == tTransform
            True

        """

        return self._fn.typeId 
Example #2
Source File: cmdx.py    From cmdx with BSD 2-Clause "Simplified" License 5 votes vote down vote up
def createNode(type, name=None, parent=None):
    """Create a new node

    This function forms the basic building block
    with which to create new nodes in Maya.

    .. note:: Missing arguments `shared` and `skipSelect`
    .. tip:: For additional performance, `type` may be given as an MTypeId

    Arguments:
        type (str): Type name of new node, e.g. "transform"
        name (str, optional): Sets the name of the newly-created node
        parent (Node, optional): Specifies the parent in the DAG under which
            the new node belongs

    Example:
        >>> node = createNode("transform")  # Type as string
        >>> node = createNode(tTransform)  # Type as ID

    """

    try:
        with DagModifier() as mod:
            node = mod.createNode(type, name=name, parent=parent)

    except TypeError:
        with DGModifier() as mod:
            node = mod.createNode(type, name=name)

    return node