Beispiel #1
0
    def Init(cls):
        attrMsg = MFnMessageAttribute()

        cls.controlA = attrMsg.create("controlA", "ca")
        cls.controlB = attrMsg.create("controlB", "cb")
        cls.addAttribute(cls.controlA)
        cls.addAttribute(cls.controlB)

        attrEnum = MFnEnumAttribute()
        cls.axis = attrEnum.create("axis", "ax")
        attrEnum.addField('x', 0)
        attrEnum.addField('y', 1)
        attrEnum.addField('z', 2)
        attrEnum.setDefault('x')
        attrEnum.setKeyable(False)
        attrEnum.setChannelBox(True)

        cls.addAttribute(cls.axis)

        cls.axis = attrEnum.create("flipAxes", "flax")
        for n, thisAxes in enumerate(cls.FLIP_AXES):
            if thisAxes:
                enumStr = ''.join([ax.asName() for ax in thisAxes])
            else:
                enumStr = 'none'

            attrEnum.addField(enumStr, n)

        attrEnum.setKeyable(False)
        attrEnum.setChannelBox(True)

        cls.addAttribute(cls.axis)

        numAttr = MFnNumericAttribute()
        cls.neverDoT = numAttr.create("neverDoT", "nvt",
                                      MFnNumericData.kBoolean)
        cls.neverDoR = numAttr.create("neverDoR", "nvr",
                                      MFnNumericData.kBoolean)
        cls.neverDoOther = numAttr.create("neverDoOther", "nvo",
                                          MFnNumericData.kBoolean)

        cls.addAttribute(cls.neverDoT)
        cls.addAttribute(cls.neverDoR)
        cls.addAttribute(cls.neverDoOther)

        cls.worldSpace = numAttr.create("worldSpace", "ws",
                                        MFnNumericData.kBoolean, True)
        cls.addAttribute(cls.worldSpace)
Beispiel #2
0
	def Init( cls ):
		attrMsg = MFnMessageAttribute()

		cls.controlA = attrMsg.create( "controlA", "ca" )
		cls.controlB = attrMsg.create( "controlB", "cb" )
		cls.addAttribute( cls.controlA )
		cls.addAttribute( cls.controlB )

		attrEnum = MFnEnumAttribute()
		cls.axis = attrEnum.create( "axis", "ax" )
		attrEnum.addField( 'x', 0 )
		attrEnum.addField( 'y', 1 )
		attrEnum.addField( 'z', 2 )
		attrEnum.setDefault( 'x' )
		attrEnum.setKeyable( False )
		attrEnum.setChannelBox( True )

		cls.addAttribute( cls.axis )

		cls.axis = attrEnum.create( "flipAxes", "flax" )
		for n, thisAxes in enumerate( cls.FLIP_AXES ):
			if thisAxes:
				enumStr = ''.join( [ ax.asName() for ax in thisAxes ] )
			else:
				enumStr = 'none'

			attrEnum.addField( enumStr, n )

		attrEnum.setKeyable( False )
		attrEnum.setChannelBox( True )

		cls.addAttribute( cls.axis )

		numAttr = MFnNumericAttribute()
		cls.neverDoT = numAttr.create( "neverDoT", "nvt", MFnNumericData.kBoolean )
		cls.neverDoR = numAttr.create( "neverDoR", "nvr", MFnNumericData.kBoolean )
		cls.neverDoOther = numAttr.create( "neverDoOther", "nvo", MFnNumericData.kBoolean )

		cls.addAttribute( cls.neverDoT )
		cls.addAttribute( cls.neverDoR )
		cls.addAttribute( cls.neverDoOther )

		cls.worldSpace = numAttr.create( "worldSpace", "ws", MFnNumericData.kBoolean, True )
		cls.addAttribute( cls.worldSpace )
Beispiel #3
0
    def Init(cls):
        attrInWorldMatrix = MFnMatrixAttribute()
        attrInParentMatrixInv = MFnMatrixAttribute()

        attrMirrorAxis = MFnEnumAttribute()
        attrMirrorTranslation = MFnEnumAttribute()

        attrTargetParentMatrixInv = MFnMatrixAttribute()
        targetRotationOrder = MFnNumericAttribute()

        attrOutTranslate = MFnNumericAttribute()
        attrOutTranslateX = MFnUnitAttribute()
        attrOutTranslateY = MFnUnitAttribute()
        attrOutTranslateZ = MFnUnitAttribute()

        attrOutRotate = MFnNumericAttribute()
        attrOutRotateX = MFnUnitAttribute()
        attrOutRotateY = MFnUnitAttribute()
        attrOutRotateZ = MFnUnitAttribute()

        attrTargetJointOrient = MFnNumericAttribute()
        attrTargetJointOrientX = MFnUnitAttribute()
        attrTargetJointOrientY = MFnUnitAttribute()
        attrTargetJointOrientZ = MFnUnitAttribute()

        #create the world matrix
        cls.inWorldMatrix = attrInWorldMatrix.create("inWorldMatrix", "iwm")

        cls.addAttribute(cls.inWorldMatrix)

        #create the local matrix
        cls.inParentMatrixInv = attrInWorldMatrix.create(
            "inParentInverseMatrix", "ipmi")

        cls.addAttribute(cls.inParentMatrixInv)

        #create the mirror axis
        cls.mirrorAxis = attrMirrorAxis.create("mirrorAxis", "m")
        attrMirrorAxis.addField('x', 0)
        attrMirrorAxis.addField('y', 1)
        attrMirrorAxis.addField('z', 2)
        attrMirrorAxis.setDefault('x')
        attrMirrorAxis.setKeyable(False)
        attrMirrorAxis.setChannelBox(True)

        cls.addAttribute(cls.mirrorAxis)

        #create the mirror axis
        cls.mirrorTranslation = attrMirrorTranslation.create(
            "mirrorTranslation", "mt")
        for modeName, modeIdx in zip(cls.MIRROR_MODE_NAMES, cls.MIRROR_MODES):
            attrMirrorTranslation.addField(modeName, modeIdx)

        attrMirrorTranslation.setDefault(cls.MIRROR_DEFAULT)
        attrMirrorTranslation.setKeyable(False)
        attrMirrorTranslation.setChannelBox(True)

        cls.addAttribute(cls.mirrorTranslation)

        #create the out world matrix inverse
        cls.targetParentMatrixInv = attrTargetParentMatrixInv.create(
            "targetParentInverseMatrix", "owm")
        cls.addAttribute(cls.targetParentMatrixInv)

        #create the target rotation order attribute
        cls.targetRotationOrder = targetRotationOrder.create(
            "targetRotationOrder", "troo", MFnNumericData.kInt)
        cls.addAttribute(cls.targetRotationOrder)

        #create the joint orient compensation attributes
        cls.targetJointOrientX = attrTargetJointOrientX.create(
            "targetJointOrientX", "tjox", MFnUnitAttribute.kAngle)
        cls.targetJointOrientY = attrTargetJointOrientY.create(
            "targetJointOrientY", "tjoy", MFnUnitAttribute.kAngle)
        cls.targetJointOrientZ = attrTargetJointOrientZ.create(
            "targetJointOrientZ", "tjoz", MFnUnitAttribute.kAngle)
        cls.targetJointOrient = attrTargetJointOrient.create(
            "targetJointOrient", "tjo", cls.targetJointOrientX,
            cls.targetJointOrientY, cls.targetJointOrientZ)
        cls.addAttribute(cls.targetJointOrient)

        #create the out translate attributes
        cls.outTranslateX = attrOutTranslateX.create(
            "outTranslateX", "otx", MFnUnitAttribute.kDistance)
        cls.outTranslateY = attrOutTranslateY.create(
            "outTranslateY", "oty", MFnUnitAttribute.kDistance)
        cls.outTranslateZ = attrOutTranslateZ.create(
            "outTranslateZ", "otz", MFnUnitAttribute.kDistance)
        cls.outTranslate = attrOutTranslate.create("outTranslate", "ot",
                                                   cls.outTranslateX,
                                                   cls.outTranslateY,
                                                   cls.outTranslateZ)
        cls.addAttribute(cls.outTranslate)

        #create the out rotation attributes
        cls.outRotateX = attrOutRotateX.create("outRotateX", "orx",
                                               MFnUnitAttribute.kAngle)
        cls.outRotateY = attrOutRotateY.create("outRotateY", "ory",
                                               MFnUnitAttribute.kAngle)
        cls.outRotateZ = attrOutRotateZ.create("outRotateZ", "orz",
                                               MFnUnitAttribute.kAngle)
        cls.outRotate = attrOutRotate.create("outRotate", "or", cls.outRotateX,
                                             cls.outRotateY, cls.outRotateZ)
        cls.addAttribute(cls.outRotate)

        #setup attribute dependency relationships
        cls.attributeAffects(cls.inWorldMatrix, cls.outTranslate)
        cls.attributeAffects(cls.inWorldMatrix, cls.outRotate)

        cls.attributeAffects(cls.inParentMatrixInv, cls.outTranslate)
        cls.attributeAffects(cls.inParentMatrixInv, cls.outRotate)

        cls.attributeAffects(cls.mirrorAxis, cls.outTranslate)
        cls.attributeAffects(cls.mirrorAxis, cls.outRotate)

        cls.attributeAffects(cls.mirrorTranslation, cls.outTranslate)
        cls.attributeAffects(cls.mirrorTranslation, cls.outRotate)

        cls.attributeAffects(cls.targetParentMatrixInv, cls.outTranslate)
        cls.attributeAffects(cls.targetParentMatrixInv, cls.outRotate)

        cls.attributeAffects(cls.targetRotationOrder, cls.outTranslate)
        cls.attributeAffects(cls.targetRotationOrder, cls.outRotate)

        cls.attributeAffects(cls.targetJointOrient, cls.outRotate)
Beispiel #4
0
	def Init( cls ):
		attrInWorldMatrix = MFnMatrixAttribute()
		attrInParentMatrixInv = MFnMatrixAttribute()

		attrMirrorAxis = MFnEnumAttribute()
		attrMirrorTranslation = MFnEnumAttribute()

		attrTargetParentMatrixInv = MFnMatrixAttribute()
		targetRotationOrder = MFnNumericAttribute()

		attrOutTranslate = MFnNumericAttribute()
		attrOutTranslateX = MFnUnitAttribute()
		attrOutTranslateY = MFnUnitAttribute()
		attrOutTranslateZ = MFnUnitAttribute()

		attrOutRotate = MFnNumericAttribute()
		attrOutRotateX = MFnUnitAttribute()
		attrOutRotateY = MFnUnitAttribute()
		attrOutRotateZ = MFnUnitAttribute()

		attrTargetJointOrient = MFnNumericAttribute()
		attrTargetJointOrientX = MFnUnitAttribute()
		attrTargetJointOrientY = MFnUnitAttribute()
		attrTargetJointOrientZ = MFnUnitAttribute()

		#create the world matrix
		cls.inWorldMatrix = attrInWorldMatrix.create( "inWorldMatrix", "iwm" )

		cls.addAttribute( cls.inWorldMatrix )


		#create the local matrix
		cls.inParentMatrixInv = attrInWorldMatrix.create( "inParentInverseMatrix", "ipmi" )

		cls.addAttribute( cls.inParentMatrixInv )


		#create the mirror axis
		cls.mirrorAxis = attrMirrorAxis.create( "mirrorAxis", "m" )
		attrMirrorAxis.addField( 'x', 0 )
		attrMirrorAxis.addField( 'y', 1 )
		attrMirrorAxis.addField( 'z', 2 )
		attrMirrorAxis.setDefault( 'x' )
		attrMirrorAxis.setKeyable( False )
		attrMirrorAxis.setChannelBox( True )

		cls.addAttribute( cls.mirrorAxis )


		#create the mirror axis
		cls.mirrorTranslation = attrMirrorTranslation.create( "mirrorTranslation", "mt" )
		for modeName, modeIdx in zip( cls.MIRROR_MODE_NAMES, cls.MIRROR_MODES ):
			attrMirrorTranslation.addField( modeName, modeIdx )

		attrMirrorTranslation.setDefault( cls.MIRROR_DEFAULT )
		attrMirrorTranslation.setKeyable( False )
		attrMirrorTranslation.setChannelBox( True )

		cls.addAttribute( cls.mirrorTranslation )


		#create the out world matrix inverse
		cls.targetParentMatrixInv = attrTargetParentMatrixInv.create( "targetParentInverseMatrix", "owm" )
		cls.addAttribute( cls.targetParentMatrixInv )


		#create the target rotation order attribute
		cls.targetRotationOrder = targetRotationOrder.create( "targetRotationOrder", "troo", MFnNumericData.kInt )
		cls.addAttribute( cls.targetRotationOrder )


		#create the joint orient compensation attributes
		cls.targetJointOrientX = attrTargetJointOrientX.create( "targetJointOrientX", "tjox", MFnUnitAttribute.kAngle )
		cls.targetJointOrientY = attrTargetJointOrientY.create( "targetJointOrientY", "tjoy", MFnUnitAttribute.kAngle )
		cls.targetJointOrientZ = attrTargetJointOrientZ.create( "targetJointOrientZ", "tjoz", MFnUnitAttribute.kAngle )
		cls.targetJointOrient = attrTargetJointOrient.create( "targetJointOrient", "tjo", cls.targetJointOrientX, cls.targetJointOrientY, cls.targetJointOrientZ )
		cls.addAttribute( cls.targetJointOrient )


		#create the out translate attributes
		cls.outTranslateX = attrOutTranslateX.create( "outTranslateX", "otx", MFnUnitAttribute.kDistance )
		cls.outTranslateY = attrOutTranslateY.create( "outTranslateY", "oty", MFnUnitAttribute.kDistance )
		cls.outTranslateZ = attrOutTranslateZ.create( "outTranslateZ", "otz", MFnUnitAttribute.kDistance )
		cls.outTranslate = attrOutTranslate.create( "outTranslate", "ot", cls.outTranslateX, cls.outTranslateY, cls.outTranslateZ )
		cls.addAttribute( cls.outTranslate )


		#create the out rotation attributes
		cls.outRotateX = attrOutRotateX.create( "outRotateX", "orx", MFnUnitAttribute.kAngle )
		cls.outRotateY = attrOutRotateY.create( "outRotateY", "ory", MFnUnitAttribute.kAngle )
		cls.outRotateZ = attrOutRotateZ.create( "outRotateZ", "orz", MFnUnitAttribute.kAngle )
		cls.outRotate = attrOutRotate.create( "outRotate", "or", cls.outRotateX, cls.outRotateY, cls.outRotateZ )
		cls.addAttribute( cls.outRotate )


		#setup attribute dependency relationships
		cls.attributeAffects( cls.inWorldMatrix, cls.outTranslate )
		cls.attributeAffects( cls.inWorldMatrix, cls.outRotate )

		cls.attributeAffects( cls.inParentMatrixInv, cls.outTranslate )
		cls.attributeAffects( cls.inParentMatrixInv, cls.outRotate )

		cls.attributeAffects( cls.mirrorAxis, cls.outTranslate )
		cls.attributeAffects( cls.mirrorAxis, cls.outRotate )

		cls.attributeAffects( cls.mirrorTranslation, cls.outTranslate )
		cls.attributeAffects( cls.mirrorTranslation, cls.outRotate )

		cls.attributeAffects( cls.targetParentMatrixInv, cls.outTranslate )
		cls.attributeAffects( cls.targetParentMatrixInv, cls.outRotate )

		cls.attributeAffects( cls.targetRotationOrder, cls.outTranslate )
		cls.attributeAffects( cls.targetRotationOrder, cls.outRotate )

		cls.attributeAffects( cls.targetJointOrient, cls.outRotate )