Exemplo n.º 1
0
    def constrain(self,
                  node_in,
                  constType='point',
                  targetType='constObj',
                  maintainOff=0):
        """
        :param constType: It can bePoint Orient or Parent
        :param targetType: It can be constObj or targetObj
                if targetType is constObj node in object Constrain drawnNode
                if targetType is targetObj drawnNode Constrain node in object
        :param node_in: if it is 1 preserve the constrained object’s position
        :param target: it should be constObj or targetObj
        :param maintainOffset: if it is 1 preserve the constrained
                object’s position
        """
        tempConst = None
        target, constrained, setObjType = self._validate_targetType(
            node_in, targetType)

        if constType is 'point':
            tempConst = pm.pointConstraint(target, constrained, mo=maintainOff)
            if setObjType is 'setConstrainedPoint':
                self._constrainedPoint = tempConst
            else:
                self._targetPoint = tempConst
        elif constType is 'orient':
            tempConst = pm.orienConstraint(target, constrained, mo=maintainOff)
            if setObjType is 'setConstrainedPoint':
                self._constrainedOrient = tempConst
            else:
                self._targetOrient = tempConst
        elif constType is 'parent':
            tempConst = pm.parentConstraint(target,
                                            constrained,
                                            mo=maintainOff)
            if setObjType is 'setConstrainedPoint':
                self._constrainedParent = tempConst
            else:
                self._targetParent = tempConst

        return tempConst
Exemplo n.º 2
0
    def constrain(self, node_in, constType='point',
                  targetType='constObj',
                  maintainOff=0):

        """
        :param constType: It can bePoint Orient or Parent
        :param targetType: It can be constObj or targetObj
                if targetType is constObj node in object Constrain drawnNode
                if targetType is targetObj drawnNode Constrain node in object
        :param node_in: if it is 1 preserve the constrained object’s position
        :param target: it should be constObj or targetObj
        :param maintainOffset: if it is 1 preserve the constrained
                object’s position
        """
        tempConst = None
        target, constrained, setObjType = self._validate_targetType(node_in,
                                                                    targetType)

        if constType is 'point':
            tempConst = pm.pointConstraint(target, constrained, mo=maintainOff)
            if setObjType is 'setConstrainedPoint':
                self._constrainedPoint = tempConst
            else:
                self._targetPoint = tempConst
        elif constType is 'orient':
            tempConst = pm.orienConstraint(target, constrained, mo=maintainOff)
            if setObjType is 'setConstrainedPoint':
                self._constrainedOrient = tempConst
            else:
                self._targetOrient = tempConst
        elif constType is 'parent':
            tempConst = pm.parentConstraint(target, constrained,
                                            mo=maintainOff)
            if setObjType is 'setConstrainedPoint':
                self._constrainedParent = tempConst
            else:
                self._targetParent = tempConst

        return tempConst