Beispiel #1
0
"""
Contains all context command functions (previously 'ctx').
"""

import pymel.internal.factories as _factories
_factories.createFunctions(__name__)
Beispiel #2
0
"""
Functions which are not listed in the maya documentation, such as commands created by plugins,
as well as the name parsing classes `DependNodeName`, `DagNodeName`, and `AttributeName`.
"""

import re
import pymel.internal.pmcmds as cmds
import pymel.internal.factories as _factories
_factories.createFunctions( __name__ )


#--------------------------
# Object Wrapper Classes
#--------------------------

class NameParser(unicode):
    PARENT_SEP = '|'

    def __new__(cls, strObj):
        """Casts a string to a pymel class. Use this function if you are unsure which class is the right one to use
        for your object."""

        # the if statement was failing for some types (ex: pymel.node.Vertex),
        # so forcing into unicode string:
        if cls is not NameParser:
            newcls = cls
        else:
            newcls = _getParserClass(strObj)
        self = super(NameParser, cls).__new__(newcls, strObj)
        return self
Beispiel #3
0
            """
            if kwargs.get( 'query', kwargs.get('q', False) and len(args)==1) :
    
                # Fix the big with upVector, worldUpVector, and aimVector
                attrs = [
                'upVector', 'u',
                'worldUpVector', 'wu',
                'aimVector', 'a' ]
    
                for attr in attrs:
                    if attr in kwargs:
                        return _general.datatypes.Vector( _general.getAttr(str(args[0]) + "." + attr ) )
            return constraintWithWeightSyntax(*args, **kwargs)
        constraintWithVectorFix.__doc__ += constraintWithWeightSyntax.__doc__
        constraint = constraintWithVectorFix

    constraint.__name__ = func.__name__
    return constraint

for contstraintCmdName in ('''aimConstraint geometryConstraint normalConstraint
                              orientConstraint parentConstraint pointConstraint
                              pointOnPolyConstraint poleVectorConstraint
                              scaleConstraint tangentConstraint''').split():
    cmd = getattr(cmds, contstraintCmdName, None)
    if cmd:
        globals()[contstraintCmdName] = _constraint(cmd)

_factories.createFunctions( __name__, _general.PyNode )