示例#1
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to MeshController class. Instances of MeshController will use these attributes to create plugs
        for use in the compute() method.
        """
        tAttr = om2.MFnTypedAttribute()
        nAttr = om2.MFnNumericAttribute()

        MeshController.inIndexList = tAttr.create("indexList", "index",
                                                  om2.MFnData.kString)
        INPUT_ATTR(tAttr)

        MeshController.inOffset = nAttr.create("offset", "offset",
                                               om2.MFnNumericData.kFloat, 0.0)
        INPUT_ATTR(nAttr)

        MeshController.inMesh = tAttr.create("controlMesh", "controlMesh",
                                             om2.MFnData.kMesh)
        INPUT_ATTR(tAttr)

        MeshController.inColor = nAttr.createColor("color", "color")
        nAttr.default = (1.0, 0.455, 0.086)
        INPUT_ATTR(nAttr)

        MeshController.addAttribute(MeshController.inIndexList)
        MeshController.addAttribute(MeshController.inOffset)
        MeshController.addAttribute(MeshController.inMesh)
        MeshController.addAttribute(MeshController.inColor)
示例#2
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to VectorToEuler class. Instances of VectorToEuler will use these attributes to create plugs
        for use in the compute() method.
        """
        uAttr = om2.MFnUnitAttribute()
        nAttr = om2.MFnNumericAttribute()

        VectorToEuler.inVector = nAttr.createPoint("vector", "vec")
        INPUT_ATTR(nAttr)

        VectorToEuler.outEulerX = uAttr.create("outEulerX", "oex",
                                               om2.MFnUnitAttribute.kAngle,
                                               0.0)
        VectorToEuler.outEulerY = uAttr.create("outEulerY", "oey",
                                               om2.MFnUnitAttribute.kAngle,
                                               0.0)
        VectorToEuler.outEulerZ = uAttr.create("outEulerZ", "oez",
                                               om2.MFnUnitAttribute.kAngle,
                                               0.0)
        VectorToEuler.outEuler = nAttr.create("outEuler", "oe",
                                              VectorToEuler.outEulerX,
                                              VectorToEuler.outEulerY,
                                              VectorToEuler.outEulerZ)
        OUTPUT_ATTR(nAttr)

        VectorToEuler.addAttribute(VectorToEuler.inVector)
        VectorToEuler.addAttribute(VectorToEuler.outEuler)
        VectorToEuler.attributeAffects(VectorToEuler.inVector,
                                       VectorToEuler.outEuler)
示例#3
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to DistributeAlongSurface class. Instances of DistributeAlongSurface will use these attributes to create plugs
        for use in the compute() method.
        """
        tAttr = om2.MFnTypedAttribute()
        nAttr = om2.MFnNumericAttribute()
        uAttr = om2.MFnUnitAttribute()

        FindParamFromLength.inCurve = tAttr.create("inputCurve", "icrv",
                                                   om2.MFnData.kNurbsCurve)
        INPUT_ATTR(tAttr)

        FindParamFromLength.inArcLength = uAttr.create(
            "arcLength", "length", om2.MFnUnitAttribute.kDistance, 0.0)
        INPUT_ATTR(uAttr)

        FindParamFromLength.outParam = nAttr.create("outParam", "param",
                                                    om2.MFnNumericData.kFloat,
                                                    0.0)
        OUTPUT_ATTR(nAttr)

        FindParamFromLength.addAttribute(FindParamFromLength.inCurve)
        FindParamFromLength.addAttribute(FindParamFromLength.inArcLength)
        FindParamFromLength.addAttribute(FindParamFromLength.outParam)
        FindParamFromLength.attributeAffects(FindParamFromLength.inCurve,
                                             FindParamFromLength.outParam)
        FindParamFromLength.attributeAffects(FindParamFromLength.inArcLength,
                                             FindParamFromLength.outParam)
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to DecomposeRowMatrix class. Instances of DecomposeRowMatrix will use these attributes to create plugs
        for use in the compute() method.
        """
        nAttr = om2.MFnNumericAttribute()
        mAttr = om2.MFnMatrixAttribute()

        DecomposeRowMatrix.inMatrix = mAttr.create(
            "inputMatrix", "im", om2.MFnMatrixAttribute.kFloat)
        INPUT_ATTR(mAttr)

        DecomposeRowMatrix.inNormalizeOutput = nAttr.create(
            "normalizeOutput", "no", om2.MFnNumericData.kBoolean, False)
        INPUT_ATTR(nAttr)

        DecomposeRowMatrix.outRow1 = nAttr.createPoint("row1", "r1")
        OUTPUT_ATTR(nAttr)

        DecomposeRowMatrix.outRow2 = nAttr.createPoint("row2", "r2")
        OUTPUT_ATTR(nAttr)

        DecomposeRowMatrix.outRow3 = nAttr.createPoint("row3", "r3")
        OUTPUT_ATTR(nAttr)

        DecomposeRowMatrix.outRow4 = nAttr.createPoint("row4", "r4")
        OUTPUT_ATTR(nAttr)

        DecomposeRowMatrix.addAttribute(DecomposeRowMatrix.inMatrix)
        DecomposeRowMatrix.addAttribute(DecomposeRowMatrix.inNormalizeOutput)
        DecomposeRowMatrix.addAttribute(DecomposeRowMatrix.outRow1)
        DecomposeRowMatrix.addAttribute(DecomposeRowMatrix.outRow2)
        DecomposeRowMatrix.addAttribute(DecomposeRowMatrix.outRow3)
        DecomposeRowMatrix.addAttribute(DecomposeRowMatrix.outRow4)
        DecomposeRowMatrix.attributeAffects(DecomposeRowMatrix.inMatrix,
                                            DecomposeRowMatrix.outRow1)
        DecomposeRowMatrix.attributeAffects(
            DecomposeRowMatrix.inNormalizeOutput, DecomposeRowMatrix.outRow1)
        DecomposeRowMatrix.attributeAffects(DecomposeRowMatrix.inMatrix,
                                            DecomposeRowMatrix.outRow2)
        DecomposeRowMatrix.attributeAffects(
            DecomposeRowMatrix.inNormalizeOutput, DecomposeRowMatrix.outRow2)
        DecomposeRowMatrix.attributeAffects(DecomposeRowMatrix.inMatrix,
                                            DecomposeRowMatrix.outRow3)
        DecomposeRowMatrix.attributeAffects(
            DecomposeRowMatrix.inNormalizeOutput, DecomposeRowMatrix.outRow3)
        DecomposeRowMatrix.attributeAffects(DecomposeRowMatrix.inMatrix,
                                            DecomposeRowMatrix.outRow4)
        DecomposeRowMatrix.attributeAffects(
            DecomposeRowMatrix.inNormalizeOutput, DecomposeRowMatrix.outRow4)
示例#5
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to AngularScalarMath class. Instances of AngularScalarMath will use these attributes to create plugs
        for use in the compute() method.
        """
        uAttr = om2.MFnUnitAttribute()
        nAttr = om2.MFnNumericAttribute()
        eAttr = om2.MFnEnumAttribute()

        AngularScalarMath.inAngle = uAttr.create("angle", "angle",
                                                 om2.MFnUnitAttribute.kAngle,
                                                 0.0)
        INPUT_ATTR(uAttr)

        AngularScalarMath.inScalar = nAttr.create("scalar", "scalar",
                                                  om2.MFnNumericData.kDouble,
                                                  0.0)
        INPUT_ATTR(nAttr)

        AngularScalarMath.inOperation = eAttr.create("operation", "operation",
                                                     0)
        eAttr.addField("No Operation", 0)
        eAttr.addField("Add", 1)
        eAttr.addField("Subtract", 2)
        eAttr.addField("Multiply", 3)
        eAttr.addField("Divide", 4)
        eAttr.addField("Power", 5)
        eAttr.addField("Min", 6)
        eAttr.addField("Max", 7)
        INPUT_ATTR(eAttr)

        AngularScalarMath.outAngle = uAttr.create("outAngle", "oa",
                                                  om2.MFnUnitAttribute.kAngle,
                                                  0.0)
        OUTPUT_ATTR(uAttr)

        AngularScalarMath.addAttribute(AngularScalarMath.inOperation)
        AngularScalarMath.addAttribute(AngularScalarMath.inAngle)
        AngularScalarMath.addAttribute(AngularScalarMath.inScalar)
        AngularScalarMath.addAttribute(AngularScalarMath.outAngle)
        AngularScalarMath.attributeAffects(AngularScalarMath.inAngle,
                                           AngularScalarMath.outAngle)
        AngularScalarMath.attributeAffects(AngularScalarMath.inScalar,
                                           AngularScalarMath.outAngle)
        AngularScalarMath.attributeAffects(AngularScalarMath.inOperation,
                                           AngularScalarMath.outAngle)
示例#6
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to TestNode class. Instances of TestNode will use these attributes to create plugs
        for use in the compute() method.
        """
        nAttr = om2.MFnNumericAttribute()

        TestNode.inAttr = nAttr.createPoint("inAttr", "ina")
        INPUT_ATTR(nAttr)

        TestNode.outAttr = nAttr.createPoint("outAttr", "outa")
        OUTPUT_ATTR(nAttr)

        TestNode.addAttribute(TestNode.inAttr)
        TestNode.addAttribute(TestNode.outAttr)
        TestNode.attributeAffects(TestNode.inAttr, TestNode.outAttr)
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to DoubleToAngle class. Instances of DoubleToAngle will use these attributes to create plugs
        for use in the compute() method.
        """
        nAttr = om2.MFnNumericAttribute()
        uAttr = om2.MFnUnitAttribute()

        DoubleToAngle.inDouble = nAttr.create("double", "double",
                                              om2.MFnNumericData.kDouble, 0.0)
        INPUT_ATTR(nAttr)

        DoubleToAngle.outAngle = uAttr.create("outAngle", "oa",
                                              om2.MFnUnitAttribute.kAngle, 0.0)
        OUTPUT_ATTR(uAttr)

        DoubleToAngle.addAttribute(DoubleToAngle.inDouble)
        DoubleToAngle.addAttribute(DoubleToAngle.outAngle)
        DoubleToAngle.attributeAffects(DoubleToAngle.inDouble,
                                       DoubleToAngle.outAngle)
示例#8
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to TestLocator class. Instances of TestLocator will use these attributes to create plugs
        for use in the compute() method.
        """
        nAttr = om2.MFnNumericAttribute()

        TestLocator.inSize = nAttr.create("size", "size", om2.MFnNumericData.kDouble, 1.0)
        INPUT_ATTR(nAttr)

        TestLocator.inAttr = nAttr.createPoint("inAttr", "inAttr")
        INPUT_ATTR(nAttr)

        TestLocator.outAttr = nAttr.createPoint("outAttr", "outAttr")
        OUTPUT_ATTR(nAttr)

        TestLocator.addAttribute(TestLocator.inSize)
        TestLocator.addAttribute(TestLocator.inAttr)
        TestLocator.addAttribute(TestLocator.outAttr)
        TestLocator.attributeAffects(TestLocator.inAttr, TestLocator.outAttr)
示例#9
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to DebugMatrix class. Instances of DebugMatrix will use these attributes to create plugs
        for use in the compute() method.
        """
        mAttr = om2.MFnMatrixAttribute()
        nAttr = om2.MFnNumericAttribute()

        DebugMatrix.inMatrix = mAttr.create("matrixInput", "mtxi",
                                            om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)
        mAttr.storable = False
        mAttr.keyable = True

        DebugMatrix.inNameColor = nAttr.createColor("nameColor", "nColor")
        nAttr.default = (DebugMatrix.fNameColor.r, DebugMatrix.fNameColor.g,
                         DebugMatrix.fNameColor.b)
        INPUT_ATTR(nAttr)

        DebugMatrix.inMtxColor = nAttr.createColor("matrixColor", "mColor")
        nAttr.default = (DebugMatrix.fMtxColor.r, DebugMatrix.fMtxColor.g,
                         DebugMatrix.fMtxColor.b)
        INPUT_ATTR(nAttr)

        DebugMatrix.inDistance = nAttr.create("distance", "dist",
                                              om2.MFnNumericData.kFloat, 0.0)
        INPUT_ATTR(nAttr)

        DebugMatrix.inLineHeight = nAttr.create("lineHeight", "lHeight",
                                                om2.MFnNumericData.kFloat, 0.7)
        nAttr.setMin(0.001)
        nAttr.setMax(2.0)
        INPUT_ATTR(nAttr)

        DebugMatrix.addAttribute(DebugMatrix.inMatrix)
        DebugMatrix.addAttribute(DebugMatrix.inNameColor)
        DebugMatrix.addAttribute(DebugMatrix.inMtxColor)
        DebugMatrix.addAttribute(DebugMatrix.inDistance)
        DebugMatrix.addAttribute(DebugMatrix.inLineHeight)
示例#10
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to DistributeAlongSurface class. Instances of DistributeAlongSurface will use these attributes to create plugs
        for use in the compute() method.
        """
        tAttr = om2.MFnTypedAttribute()
        eAttr = om2.MFnEnumAttribute()
        nAttr = om2.MFnNumericAttribute()
        mAttr = om2.MFnMatrixAttribute()

        DistributeAlongSurface.inSurface = tAttr.create("inputSurface", "isurf", om2.MFnData.kNurbsSurface)
        INPUT_ATTR(tAttr)

        DistributeAlongSurface.inDistributeAlong = eAttr.create("distributeAlong", "da", 0)
        eAttr.addField("U", 0)
        eAttr.addField("V", 1)
        INPUT_ATTR(eAttr)

        DistributeAlongSurface.inDisplace = nAttr.create("displaceTangent", "dtan", om2.MFnNumericData.kFloat, 0.0)
        nAttr.setMin(0.0)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        DistributeAlongSurface.inAlwaysUniform = nAttr.create("alwaysUniform", "auni", om2.MFnNumericData.kBoolean, False)
        INPUT_ATTR(nAttr)

        DistributeAlongSurface.outTransform = mAttr.create("outputTransform", "ot", om2.MFnMatrixAttribute.kDouble)
        mAttr.array = True
        OUTPUT_ATTR(mAttr)

        DistributeAlongSurface.addAttribute(DistributeAlongSurface.inSurface)
        DistributeAlongSurface.addAttribute(DistributeAlongSurface.inDistributeAlong)
        DistributeAlongSurface.addAttribute(DistributeAlongSurface.inDisplace)
        DistributeAlongSurface.addAttribute(DistributeAlongSurface.inAlwaysUniform)
        DistributeAlongSurface.addAttribute(DistributeAlongSurface.outTransform)
        DistributeAlongSurface.attributeAffects(DistributeAlongSurface.inSurface, DistributeAlongSurface.outTransform)
        DistributeAlongSurface.attributeAffects(DistributeAlongSurface.inDistributeAlong, DistributeAlongSurface.outTransform)
        DistributeAlongSurface.attributeAffects(DistributeAlongSurface.inDisplace, DistributeAlongSurface.outTransform)
        DistributeAlongSurface.attributeAffects(DistributeAlongSurface.inAlwaysUniform, DistributeAlongSurface.outTransform)
    def initialize(cls):
        numeric_attr = om.MFnNumericAttribute()

        cls.multiplier_obj = numeric_attr.create("multiplier", "mul",
                                                 om.MFnNumericData.kInt, 2)
        numeric_attr.keyable = True
        numeric_attr.readable = False

        cls.multiplicand_obj = numeric_attr.create("multiplicand", "mulc",
                                                   om.MFnNumericData.kDouble,
                                                   0.0)
        numeric_attr.keyable = True
        numeric_attr.readable = False

        cls.product_obj = numeric_attr.create("product", "prod",
                                              om.MFnNumericData.kDouble, 0.0)
        numeric_attr.writable = False

        cls.addAttribute(cls.multiplier_obj)
        cls.addAttribute(cls.multiplicand_obj)
        cls.addAttribute(cls.product_obj)

        cls.attributeAffects(cls.multiplier_obj, cls.product_obj)
        cls.attributeAffects(cls.multiplicand_obj, cls.product_obj)
示例#12
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to EulerToVector class. Instances of EulerToVector will use these attributes to create plugs
        for use in the compute() method.
        """
        uAttr = om2.MFnUnitAttribute()
        nAttr = om2.MFnNumericAttribute()

        EulerToVector.inEulerX = uAttr.create("eulerX", "ex",
                                              om2.MFnUnitAttribute.kAngle, 0.0)
        EulerToVector.inEulerY = uAttr.create("eulerY", "ey",
                                              om2.MFnUnitAttribute.kAngle, 0.0)
        EulerToVector.inEulerZ = uAttr.create("eulerZ", "ez",
                                              om2.MFnUnitAttribute.kAngle, 0.0)
        EulerToVector.inEuler = nAttr.create("euler", "e",
                                             EulerToVector.inEulerX,
                                             EulerToVector.inEulerY,
                                             EulerToVector.inEulerZ)
        INPUT_ATTR(nAttr)

        EulerToVector.inToDegrees = nAttr.create("convertToDegrees", "todeg",
                                                 om2.MFnNumericData.kBoolean,
                                                 True)
        INPUT_ATTR(nAttr)

        EulerToVector.outVector = nAttr.createPoint("outVector", "ov")
        OUTPUT_ATTR(nAttr)

        EulerToVector.addAttribute(EulerToVector.inEuler)
        EulerToVector.addAttribute(EulerToVector.inToDegrees)
        EulerToVector.addAttribute(EulerToVector.outVector)
        EulerToVector.attributeAffects(EulerToVector.inEuler,
                                       EulerToVector.outVector)
        EulerToVector.attributeAffects(EulerToVector.inToDegrees,
                                       EulerToVector.outVector)
示例#13
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to SpaceConstraint class. Instances of SpaceConstraint will use these attributes to create plugs
        for use in the compute() method.
        """
        mAttr = om2.MFnMatrixAttribute()
        nAttr = om2.MFnNumericAttribute()
        uAttr = om2.MFnUnitAttribute()

        SpaceConstraint.inSpace = nAttr.create("space", "space",
                                               om2.MFnNumericData.kShort, 0)
        nAttr.setMin(0)
        INPUT_ATTR(nAttr)

        SpaceConstraint.inOffset = mAttr.create("offset", "offset",
                                                om2.MFnMatrixAttribute.kDouble)
        mAttr.array = True
        INPUT_ATTR(mAttr)

        SpaceConstraint.inOffsetMatches = mAttr.create(
            "offsetMatch", "offm", om2.MFnMatrixAttribute.kDouble)
        mAttr.array = True
        INPUT_ATTR(mAttr)

        SpaceConstraint.inTarget = mAttr.create("target", "target",
                                                om2.MFnMatrixAttribute.kDouble)
        mAttr.array = True
        INPUT_ATTR(mAttr)

        SpaceConstraint.inAutoFillOff = nAttr.create(
            "autoFillOffsets", "afoff", om2.MFnNumericData.kBoolean, True)
        INPUT_ATTR(nAttr)

        SpaceConstraint.inSpaceMatch = nAttr.create(
            "spaceMatch", "spaceMatch", om2.MFnNumericData.kBoolean, True)
        INPUT_ATTR(nAttr)

        SpaceConstraint.outConstTrans = nAttr.createPoint(
            "constraintTranslate", "ctrans")
        OUTPUT_ATTR(nAttr)

        rotX = uAttr.create("constraintRotateX", "crotx",
                            om2.MFnUnitAttribute.kAngle, 0.0)
        rotY = uAttr.create("constraintRotateY", "croty",
                            om2.MFnUnitAttribute.kAngle, 0.0)
        rotZ = uAttr.create("constraintRotateZ", "crotz",
                            om2.MFnUnitAttribute.kAngle, 0.0)
        SpaceConstraint.outConstRot = nAttr.create("constraintRotate", "crot",
                                                   rotX, rotY, rotZ)
        OUTPUT_ATTR(nAttr)

        SpaceConstraint.outConstSca = nAttr.createPoint(
            "constraintScale", "csca")
        nAttr.default = (1.0, 1.0, 1.0)
        OUTPUT_ATTR(nAttr)

        SpaceConstraint.addAttribute(SpaceConstraint.inSpace)
        SpaceConstraint.addAttribute(SpaceConstraint.inAutoFillOff)
        SpaceConstraint.addAttribute(SpaceConstraint.inSpaceMatch)
        SpaceConstraint.addAttribute(SpaceConstraint.inOffset)
        SpaceConstraint.addAttribute(SpaceConstraint.inOffsetMatches)
        SpaceConstraint.addAttribute(SpaceConstraint.inTarget)
        SpaceConstraint.addAttribute(SpaceConstraint.outConstTrans)
        SpaceConstraint.addAttribute(SpaceConstraint.outConstRot)
        SpaceConstraint.addAttribute(SpaceConstraint.outConstSca)
        SpaceConstraint.attributeAffects(SpaceConstraint.inSpace,
                                         SpaceConstraint.outConstTrans)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffset,
                                         SpaceConstraint.outConstTrans)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffsetMatches,
                                         SpaceConstraint.outConstTrans)
        SpaceConstraint.attributeAffects(SpaceConstraint.inTarget,
                                         SpaceConstraint.outConstTrans)
        SpaceConstraint.attributeAffects(SpaceConstraint.inSpace,
                                         SpaceConstraint.outConstRot)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffset,
                                         SpaceConstraint.outConstRot)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffsetMatches,
                                         SpaceConstraint.outConstRot)
        SpaceConstraint.attributeAffects(SpaceConstraint.inTarget,
                                         SpaceConstraint.outConstRot)
        SpaceConstraint.attributeAffects(SpaceConstraint.inSpace, rotX)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffset, rotX)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffsetMatches, rotX)
        SpaceConstraint.attributeAffects(SpaceConstraint.inTarget, rotX)
        SpaceConstraint.attributeAffects(SpaceConstraint.inSpace, rotY)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffset, rotY)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffsetMatches, rotY)
        SpaceConstraint.attributeAffects(SpaceConstraint.inTarget, rotY)
        SpaceConstraint.attributeAffects(SpaceConstraint.inSpace, rotZ)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffset, rotZ)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffsetMatches, rotZ)
        SpaceConstraint.attributeAffects(SpaceConstraint.inTarget, rotZ)
        SpaceConstraint.attributeAffects(SpaceConstraint.inSpace,
                                         SpaceConstraint.outConstSca)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffset,
                                         SpaceConstraint.outConstSca)
        SpaceConstraint.attributeAffects(SpaceConstraint.inOffsetMatches,
                                         SpaceConstraint.outConstSca)
        SpaceConstraint.attributeAffects(SpaceConstraint.inTarget,
                                         SpaceConstraint.outConstSca)
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to PoleVectorConstraint class. Instances of PoleVectorConstraint will use these attributes to create plugs
        for use in the compute() method.
        """
        mAttr = om2.MFnMatrixAttribute()
        nAttr = om2.MFnNumericAttribute()

        PoleVectorConstraint.inRootWMtx = mAttr.create(
            "rootWorldMatrix", "rootm", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        PoleVectorConstraint.inTargetWMtx = mAttr.create(
            "targetWorldMatrix", "tgtm", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        PoleVectorConstraint.inTargetWeight = nAttr.create(
            "targetWeight", "tw", om2.MFnNumericData.kDouble, 1.0)
        nAttr.setMin(0.0)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        PoleVectorConstraint.inConstParInvMtx = mAttr.create(
            "constraintParentInverseMatrix", "cpim",
            om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        PoleVectorConstraint.inRestPosition = nAttr.createPoint(
            "restPosition", "rest")
        nAttr.writable = True
        nAttr.readable = True
        nAttr.storable = True
        nAttr.keyable = False

        PoleVectorConstraint.inNormalizeOutput = nAttr.create(
            "normalizeOutput", "normalize", om2.MFnNumericData.kBoolean, False)
        INPUT_ATTR(nAttr)

        PoleVectorConstraint.outConstraint = nAttr.createPoint(
            "constraint", "const")
        OUTPUT_ATTR(nAttr)

        PoleVectorConstraint.addAttribute(PoleVectorConstraint.inRootWMtx)
        PoleVectorConstraint.addAttribute(PoleVectorConstraint.inTargetWMtx)
        PoleVectorConstraint.addAttribute(PoleVectorConstraint.inTargetWeight)
        PoleVectorConstraint.addAttribute(
            PoleVectorConstraint.inConstParInvMtx)
        PoleVectorConstraint.addAttribute(PoleVectorConstraint.inRestPosition)
        PoleVectorConstraint.addAttribute(
            PoleVectorConstraint.inNormalizeOutput)
        PoleVectorConstraint.addAttribute(PoleVectorConstraint.outConstraint)
        PoleVectorConstraint.attributeAffects(
            PoleVectorConstraint.inRootWMtx,
            PoleVectorConstraint.outConstraint)
        PoleVectorConstraint.attributeAffects(
            PoleVectorConstraint.inTargetWMtx,
            PoleVectorConstraint.outConstraint)
        PoleVectorConstraint.attributeAffects(
            PoleVectorConstraint.inTargetWeight,
            PoleVectorConstraint.outConstraint)
        PoleVectorConstraint.attributeAffects(
            PoleVectorConstraint.inConstParInvMtx,
            PoleVectorConstraint.outConstraint)
        PoleVectorConstraint.attributeAffects(
            PoleVectorConstraint.inRestPosition,
            PoleVectorConstraint.outConstraint)
        PoleVectorConstraint.attributeAffects(
            PoleVectorConstraint.inNormalizeOutput,
            PoleVectorConstraint.outConstraint)
示例#15
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to TwistExtractor class. Instances of TwistExtractor will use these attributes to create plugs
        for use in the compute() method.
        """
        uAttr = om2.MFnUnitAttribute()
        nAttr = om2.MFnNumericAttribute()
        eAttr = om2.MFnEnumAttribute()

        rotX = uAttr.create("rotationX", "rotx", om2.MFnUnitAttribute.kAngle,
                            0.0)
        rotY = uAttr.create("rotationY", "roty", om2.MFnUnitAttribute.kAngle,
                            0.0)
        rotZ = uAttr.create("rotationZ", "rotz", om2.MFnUnitAttribute.kAngle,
                            0.0)
        TwistExtractor.inRotation = nAttr.create("rotation", "rot", rotX, rotY,
                                                 rotZ)
        INPUT_ATTR(nAttr)

        TwistExtractor.inRotationOrder = eAttr.create("rotationOrder", "roo",
                                                      0)
        # eAttr.addField("Twist First (zyx)", 5)
        # eAttr.addField("Twist Last (xyz)", 0)
        # INPUT_ATTR(eAttr)
        eAttr.addField("xyz", 0)
        eAttr.addField("yzx", 1)
        eAttr.addField("zxy", 2)
        eAttr.addField("xzy", 3)
        eAttr.addField("yxz", 4)
        eAttr.addField("zyx", 5)
        INPUT_ATTR(eAttr)

        TwistExtractor.inUseUpVec = nAttr.create("useUpVector", "useup",
                                                 om2.MFnNumericData.kBoolean,
                                                 False)
        INPUT_ATTR(nAttr)

        TwistExtractor.inUpVec = nAttr.createPoint("upVector", "upVector")
        nAttr.default = (0.0, 1.0, 0.0)
        INPUT_ATTR(nAttr)

        TwistExtractor.inInvTwist = nAttr.create("inverseTwist", "itwist",
                                                 om2.MFnNumericData.kBoolean,
                                                 False)
        INPUT_ATTR(nAttr)

        TwistExtractor.inRevDist = nAttr.create("reverseDistribution", "rdist",
                                                om2.MFnNumericData.kBoolean,
                                                False)
        INPUT_ATTR(nAttr)

        TwistExtractor.outTwist = uAttr.create("twist", "twist",
                                               om2.MFnUnitAttribute.kAngle,
                                               0.0)
        OUTPUT_ATTR(uAttr)

        TwistExtractor.outTwistDist = uAttr.create("twistDistribution",
                                                   "twistd",
                                                   om2.MFnUnitAttribute.kAngle,
                                                   0.0)
        uAttr.array = True
        OUTPUT_ATTR(uAttr)

        TwistExtractor.addAttribute(TwistExtractor.inRotation)
        TwistExtractor.addAttribute(TwistExtractor.inRotationOrder)
        TwistExtractor.addAttribute(TwistExtractor.inUseUpVec)
        TwistExtractor.addAttribute(TwistExtractor.inUpVec)
        TwistExtractor.addAttribute(TwistExtractor.inInvTwist)
        TwistExtractor.addAttribute(TwistExtractor.inRevDist)
        TwistExtractor.addAttribute(TwistExtractor.outTwist)
        TwistExtractor.addAttribute(TwistExtractor.outTwistDist)
        TwistExtractor.attributeAffects(rotX, TwistExtractor.outTwist)
        TwistExtractor.attributeAffects(rotY, TwistExtractor.outTwist)
        TwistExtractor.attributeAffects(rotZ, TwistExtractor.outTwist)
        TwistExtractor.attributeAffects(TwistExtractor.inRotationOrder,
                                        TwistExtractor.outTwist)
        TwistExtractor.attributeAffects(TwistExtractor.inUseUpVec,
                                        TwistExtractor.outTwist)
        TwistExtractor.attributeAffects(TwistExtractor.inUpVec,
                                        TwistExtractor.outTwist)
        TwistExtractor.attributeAffects(TwistExtractor.inInvTwist,
                                        TwistExtractor.outTwist)
        TwistExtractor.attributeAffects(rotX, TwistExtractor.outTwistDist)
        TwistExtractor.attributeAffects(rotY, TwistExtractor.outTwistDist)
        TwistExtractor.attributeAffects(rotZ, TwistExtractor.outTwistDist)
        TwistExtractor.attributeAffects(TwistExtractor.inRotationOrder,
                                        TwistExtractor.outTwistDist)
        TwistExtractor.attributeAffects(TwistExtractor.inUseUpVec,
                                        TwistExtractor.outTwistDist)
        TwistExtractor.attributeAffects(TwistExtractor.inUpVec,
                                        TwistExtractor.outTwistDist)
        TwistExtractor.attributeAffects(TwistExtractor.inInvTwist,
                                        TwistExtractor.outTwistDist)
        TwistExtractor.attributeAffects(TwistExtractor.inRevDist,
                                        TwistExtractor.outTwistDist)
示例#16
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to DebugVector class. Instances of DebugVector will use these attributes to create plugs
        for use in the compute() method.
        """
        eAttr = om2.MFnEnumAttribute()
        nAttr = om2.MFnNumericAttribute()

        DebugVector.inLineWidth = nAttr.create("lineWidth", "lw",
                                               om2.MFnNumericData.kFloat, 3.0)
        nAttr.setMin(1.0)
        nAttr.setSoftMax(5.0)
        INPUT_ATTR(nAttr)

        DebugVector.inColor = nAttr.createColor("color", "color")
        nAttr.default = (1.0, 1.0, 0.0)
        INPUT_ATTR(nAttr)

        DebugVector.inTipSize = nAttr.create("tipSize", "tipSize",
                                             om2.MFnNumericData.kFloat, 0.1)
        nAttr.setMin(0.1)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        DebugVector.inSubdivisions = nAttr.create("subdivisions", "subd",
                                                  om2.MFnNumericData.kInt, 4)
        nAttr.setMin(2)
        nAttr.setMax(12)
        INPUT_ATTR(nAttr)

        DebugVector.inRadius = nAttr.create("radius", "radius",
                                            om2.MFnNumericData.kFloat, 1.0)
        nAttr.setMin(0.0)
        nAttr.setSoftMax(5.0)
        INPUT_ATTR(nAttr)

        DebugVector.inXRay = nAttr.create("XRay", "xray",
                                          om2.MFnNumericData.kBoolean, False)
        INPUT_ATTR(nAttr)

        DebugVector.inDashed = nAttr.create("dashed", "dashed",
                                            om2.MFnNumericData.kBoolean, False)
        INPUT_ATTR(nAttr)

        DebugVector.inOperation = eAttr.create("operation", "op", 0)
        eAttr.addField("No Operation", 0)
        eAttr.addField("Add", 1)
        eAttr.addField("Subtract", 2)
        eAttr.addField("Cross Product", 3)
        eAttr.addField("Vector Project", 4)
        INPUT_ATTR(eAttr)

        DebugVector.inVec1 = nAttr.createPoint("vector1", "v1")
        INPUT_ATTR(nAttr)

        DebugVector.inVec2 = nAttr.createPoint("vector2", "v2")
        INPUT_ATTR(nAttr)

        DebugVector.inNormalize = nAttr.create("normalizeOutput", "no",
                                               om2.MFnNumericData.kBoolean,
                                               False)
        INPUT_ATTR(nAttr)

        DebugVector.outVector = nAttr.createPoint("outVector", "ov")
        OUTPUT_ATTR(nAttr)

        DebugVector.addAttribute(DebugVector.inLineWidth)
        DebugVector.addAttribute(DebugVector.inColor)
        DebugVector.addAttribute(DebugVector.inTipSize)
        DebugVector.addAttribute(DebugVector.inSubdivisions)
        DebugVector.addAttribute(DebugVector.inRadius)
        DebugVector.addAttribute(DebugVector.inXRay)
        DebugVector.addAttribute(DebugVector.inDashed)
        DebugVector.addAttribute(DebugVector.inOperation)
        DebugVector.addAttribute(DebugVector.inVec1)
        DebugVector.addAttribute(DebugVector.inVec2)
        DebugVector.addAttribute(DebugVector.inNormalize)
        DebugVector.addAttribute(DebugVector.outVector)
        DebugVector.attributeAffects(DebugVector.inOperation,
                                     DebugVector.outVector)
        DebugVector.attributeAffects(DebugVector.inVec1, DebugVector.outVector)
        DebugVector.attributeAffects(DebugVector.inVec2, DebugVector.outVector)
        DebugVector.attributeAffects(DebugVector.inNormalize,
                                     DebugVector.outVector)
示例#17
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to QuadraticCurve class. Instances of QuadraticCurve will use these attributes to create plugs
        for use in the compute() method.
        """
        mAttr = om2.MFnMatrixAttribute()
        nAttr = om2.MFnNumericAttribute()
        uAttr = om2.MFnUnitAttribute()
        tAttr = om2.MFnTypedAttribute()

        QuadraticCurve.inControlPoints = mAttr.create(
            "controlPoints", "cp", om2.MFnMatrixAttribute.kDouble)
        mAttr.array = True
        INPUT_ATTR(mAttr)

        QuadraticCurve.inEnableTwist = nAttr.create(
            "enableTwist", "etw", om2.MFnNumericData.kBoolean, False)
        INPUT_ATTR(nAttr)

        QuadraticCurve.inStartUpObj = mAttr.create(
            "startUpObjectMatrix", "suom", om2.MFnMatrixAttribute.kFloat)
        INPUT_ATTR(mAttr)

        QuadraticCurve.inEndUpObj = mAttr.create("endUpObjectMatrix", "euom",
                                                 om2.MFnMatrixAttribute.kFloat)
        INPUT_ATTR(mAttr)

        QuadraticCurve.inLockLength = nAttr.create("lockLength", "locklen",
                                                   om2.MFnNumericData.kFloat,
                                                   0.0)
        nAttr.setMin(0.0)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        QuadraticCurve.inRestLength = nAttr.create("restLength", "rlength",
                                                   om2.MFnNumericData.kFloat,
                                                   0.0)
        nAttr.setMin(0.0)
        INPUT_ATTR(nAttr)

        QuadraticCurve.inSlide = nAttr.create("slide", "slide",
                                              om2.MFnNumericData.kFloat, 0.0)
        nAttr.setMin(0.0)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        QuadraticCurve.inPreferredAngle = uAttr.create(
            "preferredAngle", "pangle", om2.MFnUnitAttribute.kAngle)
        uAttr.setMin(0.0)
        uAttr.setMax(om2.MAngle(360.0, om2.MAngle.kDegrees).asRadians())
        INPUT_ATTR(uAttr)

        QuadraticCurve.outTransforms = mAttr.create(
            "outTransforms", "otrans", om2.MFnMatrixAttribute.kDouble)
        mAttr.array = True
        OUTPUT_ATTR(mAttr)

        QuadraticCurve.outCurve = tAttr.create("outCurve", "ocrv",
                                               om2.MFnData.kNurbsCurve)
        OUTPUT_ATTR(tAttr)

        QuadraticCurve.addAttribute(QuadraticCurve.inControlPoints)
        QuadraticCurve.addAttribute(QuadraticCurve.inEnableTwist)
        QuadraticCurve.addAttribute(QuadraticCurve.inStartUpObj)
        QuadraticCurve.addAttribute(QuadraticCurve.inEndUpObj)
        QuadraticCurve.addAttribute(QuadraticCurve.inLockLength)
        QuadraticCurve.addAttribute(QuadraticCurve.inRestLength)
        QuadraticCurve.addAttribute(QuadraticCurve.inSlide)
        QuadraticCurve.addAttribute(QuadraticCurve.inPreferredAngle)
        QuadraticCurve.addAttribute(QuadraticCurve.outTransforms)
        QuadraticCurve.addAttribute(QuadraticCurve.outCurve)
        QuadraticCurve.attributeAffects(QuadraticCurve.inControlPoints,
                                        QuadraticCurve.outCurve)
        QuadraticCurve.attributeAffects(QuadraticCurve.inControlPoints,
                                        QuadraticCurve.outTransforms)
        QuadraticCurve.attributeAffects(QuadraticCurve.inEnableTwist,
                                        QuadraticCurve.outTransforms)
        QuadraticCurve.attributeAffects(QuadraticCurve.inStartUpObj,
                                        QuadraticCurve.outTransforms)
        QuadraticCurve.attributeAffects(QuadraticCurve.inEndUpObj,
                                        QuadraticCurve.outTransforms)
        QuadraticCurve.attributeAffects(QuadraticCurve.inLockLength,
                                        QuadraticCurve.outTransforms)
        QuadraticCurve.attributeAffects(QuadraticCurve.inRestLength,
                                        QuadraticCurve.outTransforms)
        QuadraticCurve.attributeAffects(QuadraticCurve.inSlide,
                                        QuadraticCurve.outTransforms)
        QuadraticCurve.attributeAffects(QuadraticCurve.inPreferredAngle,
                                        QuadraticCurve.outTransforms)
示例#18
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to BlendTransform class. Instances of BlendTransform will use these attributes to create plugs
        for use in the compute() method.
        """
        nAttr = om2.MFnNumericAttribute()
        uAttr = om2.MFnUnitAttribute()
        cAttr = om2.MFnCompoundAttribute()
        eAttr = om2.MFnEnumAttribute()

        BlendTransform.inBlender = nAttr.create("blender", "blender",
                                                om2.MFnNumericData.kFloat, 0.5)
        nAttr.setMin(0.0)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        BlendTransform.inRotInterp = eAttr.create("rotationInterpolation",
                                                  "roti", 0)
        eAttr.addField("Euler Lerp", 0)
        eAttr.addField("Quaternion Slerp", 1)
        INPUT_ATTR(eAttr)

        BlendTransform.inTrans1 = nAttr.createPoint("translate1", "t1")
        nAttr.array = True
        INPUT_ATTR(nAttr)

        rot1X = uAttr.create("rotate1X", "ro1x", om2.MFnUnitAttribute.kAngle,
                             0.0)
        rot1Y = uAttr.create("rotate1Y", "ro1y", om2.MFnUnitAttribute.kAngle,
                             0.0)
        rot1Z = uAttr.create("rotate1Z", "ro1z", om2.MFnUnitAttribute.kAngle,
                             0.0)
        BlendTransform.inRot1 = nAttr.create("rotate1", "ro1", rot1X, rot1Y,
                                             rot1Z)
        nAttr.array = True
        INPUT_ATTR(nAttr)

        BlendTransform.inSca1 = nAttr.createPoint("scale1", "sca1")
        nAttr.array = True
        INPUT_ATTR(nAttr)

        BlendTransform.inRot1Order = eAttr.create("rotateOrder1", "rro1", 0)
        eAttr.addField("xyz", 0)
        eAttr.addField("yzx", 1)
        eAttr.addField("zxy", 2)
        eAttr.addField("xzy", 3)
        eAttr.addField("yxz", 4)
        eAttr.addField("zyx", 5)
        eAttr.array = True
        INPUT_ATTR(eAttr)

        BlendTransform.inTransform1 = cAttr.create("transform1", "tr1")
        cAttr.addChild(BlendTransform.inTrans1)
        cAttr.addChild(BlendTransform.inRot1)
        cAttr.addChild(BlendTransform.inSca1)
        cAttr.addChild(BlendTransform.inRot1Order)

        BlendTransform.inTrans2 = nAttr.createPoint("translate2", "t2")
        nAttr.array = True
        INPUT_ATTR(nAttr)

        rot2X = uAttr.create("rotate2X", "ro2x", om2.MFnUnitAttribute.kAngle,
                             0.0)
        rot2Y = uAttr.create("rotate2Y", "ro2y", om2.MFnUnitAttribute.kAngle,
                             0.0)
        rot2Z = uAttr.create("rotate2Z", "ro2z", om2.MFnUnitAttribute.kAngle,
                             0.0)
        BlendTransform.inRot2 = nAttr.create("rotate2", "ro2", rot2X, rot2Y,
                                             rot2Z)
        nAttr.array = True
        INPUT_ATTR(nAttr)

        BlendTransform.inSca2 = nAttr.createPoint("scale2", "sca2")
        nAttr.array = True
        INPUT_ATTR(nAttr)

        BlendTransform.inRot2Order = eAttr.create("rotateOrder2", "rro2", 0)
        eAttr.addField("xyz", 0)
        eAttr.addField("yzx", 1)
        eAttr.addField("zxy", 2)
        eAttr.addField("xzy", 3)
        eAttr.addField("yxz", 4)
        eAttr.addField("zyx", 5)
        eAttr.array = True
        INPUT_ATTR(eAttr)

        BlendTransform.inTransform2 = cAttr.create("transform2", "tr2")
        cAttr.addChild(BlendTransform.inTrans2)
        cAttr.addChild(BlendTransform.inRot2)
        cAttr.addChild(BlendTransform.inSca2)
        cAttr.addChild(BlendTransform.inRot2Order)

        BlendTransform.inOutRotOrder = eAttr.create("outRotateOrder", "orro",
                                                    0)
        eAttr.addField("xyz", 0)
        eAttr.addField("yzx", 1)
        eAttr.addField("zxy", 2)
        eAttr.addField("xzy", 3)
        eAttr.addField("yxz", 4)
        eAttr.addField("zyx", 5)
        eAttr.array = True
        INPUT_ATTR(eAttr)

        BlendTransform.outTrans = nAttr.createPoint("outTranslate", "ot")
        nAttr.array = True
        OUTPUT_ATTR(nAttr)

        oRotX = uAttr.create("outRotateX", "orox", om2.MFnUnitAttribute.kAngle,
                             0.0)
        oRotY = uAttr.create("outRotateY", "oroy", om2.MFnUnitAttribute.kAngle,
                             0.0)
        oRotZ = uAttr.create("outRotateZ", "oroz", om2.MFnUnitAttribute.kAngle,
                             0.0)
        BlendTransform.outRot = nAttr.create("outRotate", "oro", oRotX, oRotY,
                                             oRotZ)
        nAttr.array = True
        OUTPUT_ATTR(nAttr)

        BlendTransform.outSca = nAttr.createPoint("outScale", "osca")
        nAttr.array = True
        OUTPUT_ATTR(nAttr)

        BlendTransform.outVis = nAttr.create("visibility", "vis",
                                             om2.MFnNumericData.kBoolean, True)
        OUTPUT_ATTR(nAttr)

        BlendTransform.outRevVis = nAttr.create("reverseVisibility", "rvis",
                                                om2.MFnNumericData.kBoolean,
                                                False)
        OUTPUT_ATTR(nAttr)

        BlendTransform.addAttribute(BlendTransform.inBlender)
        BlendTransform.addAttribute(BlendTransform.inRotInterp)
        BlendTransform.addAttribute(BlendTransform.inTransform1)
        BlendTransform.addAttribute(BlendTransform.inTransform2)
        BlendTransform.addAttribute(BlendTransform.inOutRotOrder)
        BlendTransform.addAttribute(BlendTransform.outTrans)
        BlendTransform.addAttribute(BlendTransform.outRot)
        BlendTransform.addAttribute(BlendTransform.outSca)
        BlendTransform.addAttribute(BlendTransform.outVis)
        BlendTransform.addAttribute(BlendTransform.outRevVis)
        BlendTransform.attributeAffects(BlendTransform.inBlender,
                                        BlendTransform.outTrans)
        BlendTransform.attributeAffects(BlendTransform.inTrans1,
                                        BlendTransform.outTrans)
        BlendTransform.attributeAffects(BlendTransform.inTrans2,
                                        BlendTransform.outTrans)
        BlendTransform.attributeAffects(BlendTransform.inBlender,
                                        BlendTransform.outRot)
        BlendTransform.attributeAffects(BlendTransform.inRotInterp,
                                        BlendTransform.outRot)
        BlendTransform.attributeAffects(BlendTransform.inRot1,
                                        BlendTransform.outRot)
        BlendTransform.attributeAffects(BlendTransform.inRot1Order,
                                        BlendTransform.outRot)
        BlendTransform.attributeAffects(BlendTransform.inRot2,
                                        BlendTransform.outRot)
        BlendTransform.attributeAffects(BlendTransform.inRot2Order,
                                        BlendTransform.outRot)
        BlendTransform.attributeAffects(BlendTransform.inOutRotOrder,
                                        BlendTransform.outRot)
        BlendTransform.attributeAffects(BlendTransform.inBlender,
                                        BlendTransform.outSca)
        BlendTransform.attributeAffects(BlendTransform.inSca1,
                                        BlendTransform.outSca)
        BlendTransform.attributeAffects(BlendTransform.inSca2,
                                        BlendTransform.outSca)
        BlendTransform.attributeAffects(BlendTransform.inBlender,
                                        BlendTransform.outVis)
        BlendTransform.attributeAffects(BlendTransform.inBlender,
                                        BlendTransform.outRevVis)
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to ParentConstraint class. Instances of ParentConstraint will use these attributes to create plugs
        for use in the compute() method.
        """
        mAttr = om2.MFnMatrixAttribute()
        nAttr = om2.MFnNumericAttribute()
        uAttr = om2.MFnUnitAttribute()
        eAttr = om2.MFnEnumAttribute()
        cAttr = om2.MFnCompoundAttribute()

        constJntOriX = uAttr.create("constraintJointOrientX", "cjorx",
                                    om2.MFnUnitAttribute.kAngle, 0.0)
        constJntOriY = uAttr.create("constraintJointOrientY", "cjory",
                                    om2.MFnUnitAttribute.kAngle, 0.0)
        constJntOriZ = uAttr.create("constraintJointOrientZ", "cjorz",
                                    om2.MFnUnitAttribute.kAngle, 0.0)
        ParentConstraint.inConstraintJntOri = nAttr.create(
            "constraintJointOrient", "cjor", constJntOriX, constJntOriY,
            constJntOriZ)
        INPUT_ATTR(nAttr)

        ParentConstraint.inConstraintRotOrder = eAttr.create(
            "constraintRotateOrder", "croo", 0)
        eAttr.addField("xyz", 0)
        eAttr.addField("yzx", 1)
        eAttr.addField("zxy", 2)
        eAttr.addField("xzy", 3)
        eAttr.addField("yxz", 4)
        eAttr.addField("zyx", 5)
        INPUT_ATTR(eAttr)

        ParentConstraint.inConstraintParInvMtx = mAttr.create(
            "constraintParentInverseMatrix", "cpim",
            om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        ParentConstraint.inConstraintParSca = nAttr.createPoint(
            "constraintParentScale", "cps")
        nAttr.default = (1.0, 1.0, 1.0)
        INPUT_ATTR(nAttr)

        ParentConstraint.inTargetWorldMatrix = mAttr.create(
            "targetWorldMatrix", "twmtx", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        ParentConstraint.inTargetOffset = mAttr.create(
            "targetOffset", "toff", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        # targetJntOriX = uAttr.create("targetJointOrientX", "tjorx", om2.MFnUnitAttribute.kAngle, 0.0)
        # targetJntOriY = uAttr.create("targetJointOrientY", "tjory", om2.MFnUnitAttribute.kAngle, 0.0)
        # targetJntOriZ = uAttr.create("targetJointOrientZ", "tjorz", om2.MFnUnitAttribute.kAngle, 0.0)
        # ParentConstraint.inTargetJntOri = nAttr.create("targetJointOrient", "tjor", targetJntOriX, targetJntOriY, targetJntOriZ)
        # INPUT_ATTR(nAttr)

        # ParentConstraint.inTargetRotOrder = eAttr.create("targetRotateOrder", "troo", 0)
        # eAttr.addField("xyz", 0)
        # eAttr.addField("yzx", 1)
        # eAttr.addField("zxy", 2)
        # eAttr.addField("xzy", 3)
        # eAttr.addField("yxz", 4)
        # eAttr.addField("zyx", 5)
        # INPUT_ATTR(eAttr)

        ParentConstraint.inTargetWeight = nAttr.create(
            "targetWeight", "twght", om2.MFnNumericData.kFloat, 1.0)
        INPUT_ATTR(nAttr)

        ParentConstraint.inTargetList = cAttr.create("targetList", "tlist")
        cAttr.addChild(ParentConstraint.inTargetWorldMatrix)
        cAttr.addChild(ParentConstraint.inTargetOffset)
        # cAttr.addChild(ParentConstraint.inTargetJntOri)
        # cAttr.addChild(ParentConstraint.inTargetRotOrder)
        cAttr.addChild(ParentConstraint.inTargetWeight)
        cAttr.array = True

        ParentConstraint.outConstTrans = nAttr.createPoint(
            "constraintTranslate", "ctrans")
        OUTPUT_ATTR(nAttr)

        outConstRotX = uAttr.create("constraintRotateX", "crox",
                                    om2.MFnUnitAttribute.kAngle, 0.0)
        outConstRotY = uAttr.create("constraintRotateY", "croy",
                                    om2.MFnUnitAttribute.kAngle, 0.0)
        outConstRotZ = uAttr.create("constraintRotateZ", "croz",
                                    om2.MFnUnitAttribute.kAngle, 0.0)
        ParentConstraint.outConstRot = nAttr.create("constraintRotate", "cro",
                                                    outConstRotX, outConstRotY,
                                                    outConstRotZ)
        OUTPUT_ATTR(nAttr)

        ParentConstraint.outConstSca = nAttr.createPoint(
            "constraintScale", "csca")
        nAttr.default = (1.0, 1.0, 1.0)
        OUTPUT_ATTR(nAttr)

        ParentConstraint.addAttribute(ParentConstraint.inConstraintJntOri)
        ParentConstraint.addAttribute(ParentConstraint.inConstraintRotOrder)
        ParentConstraint.addAttribute(ParentConstraint.inConstraintParInvMtx)
        ParentConstraint.addAttribute(ParentConstraint.inConstraintParSca)
        ParentConstraint.addAttribute(ParentConstraint.inTargetList)
        ParentConstraint.addAttribute(ParentConstraint.outConstTrans)
        ParentConstraint.addAttribute(ParentConstraint.outConstRot)
        ParentConstraint.addAttribute(ParentConstraint.outConstSca)
        ParentConstraint.attributeAffects(ParentConstraint.inConstraintJntOri,
                                          ParentConstraint.outConstTrans)
        ParentConstraint.attributeAffects(
            ParentConstraint.inConstraintRotOrder,
            ParentConstraint.outConstTrans)
        ParentConstraint.attributeAffects(
            ParentConstraint.inConstraintParInvMtx,
            ParentConstraint.outConstTrans)
        ParentConstraint.attributeAffects(ParentConstraint.inConstraintParSca,
                                          ParentConstraint.outConstTrans)
        ParentConstraint.attributeAffects(ParentConstraint.inTargetWorldMatrix,
                                          ParentConstraint.outConstTrans)
        ParentConstraint.attributeAffects(ParentConstraint.inTargetOffset,
                                          ParentConstraint.outConstTrans)
        # ParentConstraint.attributeAffects(ParentConstraint.inTargetJntOri, ParentConstraint.outConstTrans)
        # ParentConstraint.attributeAffects(ParentConstraint.inTargetRotOrder, ParentConstraint.outConstTrans)
        ParentConstraint.attributeAffects(ParentConstraint.inTargetWeight,
                                          ParentConstraint.outConstTrans)
        ParentConstraint.attributeAffects(ParentConstraint.inConstraintJntOri,
                                          ParentConstraint.outConstRot)
        ParentConstraint.attributeAffects(
            ParentConstraint.inConstraintRotOrder,
            ParentConstraint.outConstRot)
        ParentConstraint.attributeAffects(
            ParentConstraint.inConstraintParInvMtx,
            ParentConstraint.outConstRot)
        ParentConstraint.attributeAffects(ParentConstraint.inConstraintParSca,
                                          ParentConstraint.outConstRot)
        ParentConstraint.attributeAffects(ParentConstraint.inTargetWorldMatrix,
                                          ParentConstraint.outConstRot)
        ParentConstraint.attributeAffects(ParentConstraint.inTargetOffset,
                                          ParentConstraint.outConstRot)
        # ParentConstraint.attributeAffects(ParentConstraint.inTargetJntOri, ParentConstraint.outConstRot)
        # ParentConstraint.attributeAffects(ParentConstraint.inTargetRotOrder, ParentConstraint.outConstRot)
        ParentConstraint.attributeAffects(ParentConstraint.inTargetWeight,
                                          ParentConstraint.outConstRot)
        ParentConstraint.attributeAffects(ParentConstraint.inConstraintJntOri,
                                          ParentConstraint.outConstSca)
        ParentConstraint.attributeAffects(
            ParentConstraint.inConstraintRotOrder,
            ParentConstraint.outConstSca)
        ParentConstraint.attributeAffects(
            ParentConstraint.inConstraintParInvMtx,
            ParentConstraint.outConstSca)
        ParentConstraint.attributeAffects(ParentConstraint.inConstraintParSca,
                                          ParentConstraint.outConstSca)
        ParentConstraint.attributeAffects(ParentConstraint.inTargetWorldMatrix,
                                          ParentConstraint.outConstSca)
        ParentConstraint.attributeAffects(ParentConstraint.inTargetOffset,
                                          ParentConstraint.outConstSca)
        # ParentConstraint.attributeAffects(ParentConstraint.inTargetJntOri, ParentConstraint.outConstSca)
        # ParentConstraint.attributeAffects(ParentConstraint.inTargetRotOrder, ParentConstraint.outConstSca)
        ParentConstraint.attributeAffects(ParentConstraint.inTargetWeight,
                                          ParentConstraint.outConstSca)
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to IKVChain class. Instances of IKVChain will use these attributes to create plugs
        for use in the compute() method.
        """
        mAttr = om2.MFnMatrixAttribute()
        nAttr = om2.MFnNumericAttribute()
        rAttr = om2.MRampAttribute()

        VectorAnglePSD.inBase = mAttr.create("base", "base",
                                             om2.MFnMatrixAttribute.kFloat)
        INPUT_ATTR(mAttr)

        VectorAnglePSD.inSource = mAttr.create("source", "source",
                                               om2.MFnMatrixAttribute.kFloat)
        INPUT_ATTR(mAttr)

        VectorAnglePSD.inTarget = mAttr.create("target", "target",
                                               om2.MFnMatrixAttribute.kFloat)
        mAttr.array = True
        INPUT_ATTR(mAttr)

        VectorAnglePSD.inTargetEnvelope = nAttr.create(
            "targetEnvelope", "te", om2.MFnNumericData.kFloat, 1.0)
        nAttr.setMin(0.0)
        nAttr.setMax(1.0)
        nAttr.array = True
        INPUT_ATTR(nAttr)

        VectorAnglePSD.inTargetFalloff = nAttr.create(
            "targetFalloff", "tf", om2.MFnNumericData.kFloat, 90.0)
        nAttr.setMin(0.0)
        nAttr.setMax(180.0)
        nAttr.array = True
        INPUT_ATTR(nAttr)

        VectorAnglePSD.inRampWeights = rAttr.createCurveRamp(
            "rampWeights", "rw")

        VectorAnglePSD.outWeights = nAttr.create("outWeights", "ow",
                                                 om2.MFnNumericData.kFloat,
                                                 0.0)
        nAttr.array = True
        OUTPUT_ATTR(nAttr)

        VectorAnglePSD.addAttribute(VectorAnglePSD.inBase)
        VectorAnglePSD.addAttribute(VectorAnglePSD.inSource)
        VectorAnglePSD.addAttribute(VectorAnglePSD.inTarget)
        VectorAnglePSD.addAttribute(VectorAnglePSD.inTargetEnvelope)
        VectorAnglePSD.addAttribute(VectorAnglePSD.inTargetFalloff)
        VectorAnglePSD.addAttribute(VectorAnglePSD.inRampWeights)
        VectorAnglePSD.addAttribute(VectorAnglePSD.outWeights)
        VectorAnglePSD.attributeAffects(VectorAnglePSD.inBase,
                                        VectorAnglePSD.outWeights)
        VectorAnglePSD.attributeAffects(VectorAnglePSD.inSource,
                                        VectorAnglePSD.outWeights)
        VectorAnglePSD.attributeAffects(VectorAnglePSD.inTarget,
                                        VectorAnglePSD.outWeights)
        VectorAnglePSD.attributeAffects(VectorAnglePSD.inTargetEnvelope,
                                        VectorAnglePSD.outWeights)
        VectorAnglePSD.attributeAffects(VectorAnglePSD.inTargetFalloff,
                                        VectorAnglePSD.outWeights)
        VectorAnglePSD.attributeAffects(VectorAnglePSD.inRampWeights,
                                        VectorAnglePSD.outWeights)
示例#21
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to IKVChainSolver class. Instances of IKVChainSolver will use these attributes to create plugs
        for use in the compute() method.
        """
        mAttr = om2.MFnMatrixAttribute()
        nAttr = om2.MFnNumericAttribute()
        eAttr = om2.MFnEnumAttribute()
        uAttr = om2.MFnUnitAttribute()

        IKVChainSolver.inRoot = mAttr.create("root", "root",
                                             om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        IKVChainSolver.inHandle = mAttr.create("handle", "handle",
                                               om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        IKVChainSolver.inPoleVector = mAttr.create(
            "poleVector", "pole", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        offX = uAttr.create("offsetX", "offx", om2.MFnUnitAttribute.kAngle,
                            0.0)
        offY = uAttr.create("offsetY", "offy", om2.MFnUnitAttribute.kAngle,
                            0.0)
        offZ = uAttr.create("offsetZ", "offz", om2.MFnUnitAttribute.kAngle,
                            0.0)
        IKVChainSolver.inOffset = nAttr.create("offset", "off", offX, offY,
                                               offZ)
        nAttr.array = True
        INPUT_ATTR(nAttr)

        jntOriX = uAttr.create("jointOrientX", "jox",
                               om2.MFnUnitAttribute.kAngle, 0.0)
        jntOriY = uAttr.create("jointOrientY", "joy",
                               om2.MFnUnitAttribute.kAngle, 0.0)
        jntOriZ = uAttr.create("jointOrientZ", "joz",
                               om2.MFnUnitAttribute.kAngle, 0.0)
        IKVChainSolver.inJntOri = nAttr.create("jointOrient", "jo", jntOriX,
                                               jntOriY, jntOriZ)
        nAttr.array = True
        INPUT_ATTR(nAttr)

        IKVChainSolver.inParInvMtx = mAttr.create(
            "parentInverseMatrix", "pim", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        IKVChainSolver.inRestLenStart = nAttr.create("restLengthStart", "rls",
                                                     om2.MFnNumericData.kFloat,
                                                     1.0)
        # nAttr.setMin(0.001)
        INPUT_ATTR(nAttr)
        nAttr.channelBox = True

        IKVChainSolver.inRestLenEnd = nAttr.create("restLengthEnd", "rle",
                                                   om2.MFnNumericData.kFloat,
                                                   1.0)
        # nAttr.setMin(0.001)
        INPUT_ATTR(nAttr)
        nAttr.channelBox = True

        IKVChainSolver.inPreferredAngle = uAttr.create(
            "preferredAngle", "pa", om2.MFnUnitAttribute.kAngle, 0.0)
        uAttr.setMin(0.0)
        uAttr.setMax(2.0 * math.pi)
        INPUT_ATTR(uAttr)
        uAttr.channelBox = True

        IKVChainSolver.inTwist = uAttr.create("twist", "twist",
                                              om2.MFnUnitAttribute.kAngle, 0.0)
        INPUT_ATTR(uAttr)

        IKVChainSolver.inPvMode = eAttr.create("pvMode", "pvm", 0)
        eAttr.addField("Manual", 0)
        eAttr.addField("Auto", 1)
        INPUT_ATTR(eAttr)

        IKVChainSolver.inHierarchyMode = nAttr.create(
            "hierarchyMode", "hm", om2.MFnNumericData.kBoolean, True)
        INPUT_ATTR(nAttr)

        IKVChainSolver.inFlip = nAttr.create("flipOrientation", "fori",
                                             om2.MFnNumericData.kBoolean,
                                             False)
        INPUT_ATTR(nAttr)
        nAttr.channelBox = True

        IKVChainSolver.inUseScale = nAttr.create("useStretchAsScale", "usca",
                                                 om2.MFnNumericData.kBoolean,
                                                 False)
        INPUT_ATTR(nAttr)

        IKVChainSolver.inCompressionLimit = nAttr.create(
            "compressionLimit", "cl", om2.MFnNumericData.kFloat, 0.1)
        nAttr.setMin(0.001)
        nAttr.setMax(0.4)
        INPUT_ATTR(nAttr)

        IKVChainSolver.inSnapUpVector = nAttr.create("snapUpVector", "supv",
                                                     om2.MFnNumericData.kFloat,
                                                     0.0)
        nAttr.setMin(0.0)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        IKVChainSolver.inSnap = mAttr.create("snap", "snap",
                                             om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        IKVChainSolver.inSoftness = nAttr.create("softness", "soft",
                                                 om2.MFnNumericData.kFloat,
                                                 0.0)
        nAttr.setMin(0.0)
        nAttr.setSoftMax(0.2)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        IKVChainSolver.inStretch = nAttr.create("stretch", "st",
                                                om2.MFnNumericData.kDouble,
                                                0.0)
        nAttr.setMin(0.0)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        IKVChainSolver.inClampStretch = nAttr.create(
            "clampStretch", "cst", om2.MFnNumericData.kDouble, 0.0)
        nAttr.setMin(0.0)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        IKVChainSolver.inClampValue = nAttr.create("clampValue", "cstv",
                                                   om2.MFnNumericData.kDouble,
                                                   1.5)
        nAttr.setMin(1.0)
        nAttr.setSoftMax(1.8)
        INPUT_ATTR(nAttr)

        # IKVChainSolver.inStretchMultStart = nAttr.create("stretchMultStart", "stms", om2.MFnNumericData.kFloat, 1.0)
        # nAttr.setMin(0.001)
        # INPUT_ATTR(nAttr)

        # IKVChainSolver.inStretchMultEnd = nAttr.create("stretchMultEnd", "stme", om2.MFnNumericData.kFloat, 1.0)
        # nAttr.setMin(0.001)
        # INPUT_ATTR(nAttr)

        IKVChainSolver.inSquash = nAttr.create("squash", "sq",
                                               om2.MFnNumericData.kDouble, 0.0)
        nAttr.setMin(0.0)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        startSqX = nAttr.create("squashMultStartX", "sqmsx",
                                om2.MFnNumericData.kFloat, 1.0)
        startSqY = nAttr.create("squashMultStartY", "sqmsy",
                                om2.MFnNumericData.kFloat, 1.0)
        IKVChainSolver.inSquashMultStart = nAttr.create(
            "squashMultStart", "sqms", startSqX, startSqY)
        nAttr.setMin([0.001, 0.001])
        INPUT_ATTR(nAttr)

        endSqX = nAttr.create("squashMultEndX", "sqmex",
                              om2.MFnNumericData.kFloat, 1.0)
        endSqY = nAttr.create("squashMultEndY", "sqmey",
                              om2.MFnNumericData.kFloat, 1.0)
        IKVChainSolver.inSquashMultEnd = nAttr.create("squashMultEnd", "sqme",
                                                      endSqX, endSqY)
        nAttr.setMin([0.001, 0.001])
        INPUT_ATTR(nAttr)

        IKVChainSolver.outChain = mAttr.create("outChain", "oc",
                                               om2.MFnMatrixAttribute.kDouble)
        mAttr.array = True
        OUTPUT_ATTR(mAttr)

        IKVChainSolver.addAttribute(IKVChainSolver.inRoot)
        IKVChainSolver.addAttribute(IKVChainSolver.inHandle)
        IKVChainSolver.addAttribute(IKVChainSolver.inPoleVector)
        IKVChainSolver.addAttribute(IKVChainSolver.inOffset)
        IKVChainSolver.addAttribute(IKVChainSolver.inJntOri)
        IKVChainSolver.addAttribute(IKVChainSolver.inParInvMtx)
        IKVChainSolver.addAttribute(IKVChainSolver.inRestLenStart)
        IKVChainSolver.addAttribute(IKVChainSolver.inRestLenEnd)
        IKVChainSolver.addAttribute(IKVChainSolver.inPreferredAngle)
        IKVChainSolver.addAttribute(IKVChainSolver.inTwist)
        IKVChainSolver.addAttribute(IKVChainSolver.inPvMode)
        IKVChainSolver.addAttribute(IKVChainSolver.inHierarchyMode)
        IKVChainSolver.addAttribute(IKVChainSolver.inFlip)
        IKVChainSolver.addAttribute(IKVChainSolver.inUseScale)
        IKVChainSolver.addAttribute(IKVChainSolver.inCompressionLimit)
        IKVChainSolver.addAttribute(IKVChainSolver.inSnapUpVector)
        IKVChainSolver.addAttribute(IKVChainSolver.inSnap)
        IKVChainSolver.addAttribute(IKVChainSolver.inSoftness)
        IKVChainSolver.addAttribute(IKVChainSolver.inStretch)
        IKVChainSolver.addAttribute(IKVChainSolver.inClampStretch)
        IKVChainSolver.addAttribute(IKVChainSolver.inClampValue)
        # IKVChainSolver.addAttribute(IKVChainSolver.inStretchMultStart)
        # IKVChainSolver.addAttribute(IKVChainSolver.inStretchMultEnd)
        IKVChainSolver.addAttribute(IKVChainSolver.inSquash)
        IKVChainSolver.addAttribute(IKVChainSolver.inSquashMultStart)
        IKVChainSolver.addAttribute(IKVChainSolver.inSquashMultEnd)
        IKVChainSolver.addAttribute(IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inRoot,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inHandle,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inPoleVector,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inOffset,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inJntOri,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inParInvMtx,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inRestLenStart,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inRestLenEnd,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inPreferredAngle,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inTwist,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inPvMode,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inHierarchyMode,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inFlip,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inUseScale,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inCompressionLimit,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inSnapUpVector,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inSnap,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inSoftness,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inStretch,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inClampStretch,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inClampValue,
                                        IKVChainSolver.outChain)
        # IKVChainSolver.attributeAffects(IKVChainSolver.inStretchMultStart, IKVChainSolver.outChain)
        # IKVChainSolver.attributeAffects(IKVChainSolver.inStretchMultEnd, IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inSquash,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inSquashMultStart,
                                        IKVChainSolver.outChain)
        IKVChainSolver.attributeAffects(IKVChainSolver.inSquashMultEnd,
                                        IKVChainSolver.outChain)
示例#22
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to HelperJoint class. Instances of HelperJoint will use these attributes to create plugs
        for use in the compute() method.
        """
        nAttr = om2.MFnNumericAttribute()
        mAttr = om2.MFnMatrixAttribute()
        uAttr = om2.MFnUnitAttribute()
        cAttr = om2.MFnCompoundAttribute()

        HelperJoint.inSource = mAttr.create("source", "s", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        HelperJoint.inSourceParent = mAttr.create("sourceParent", "sp", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        HelperJoint.inParInvMtx = mAttr.create("targetParentInverseMatrix", "tpimtx", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        HelperJoint.inSourceParSca = nAttr.createPoint("sourceParentScale", "spsca")
        nAttr.default = (1.0, 1.0, 1.0)
        INPUT_ATTR(nAttr)

        HelperJoint.inPositionOffset = nAttr.createPoint("positionOffset", "posoff")
        INPUT_ATTR(nAttr)

        rotOffX = uAttr.create("rotationOffsetX", "rotoffx", om2.MFnUnitAttribute.kAngle, 0.0)
        rotOffY = uAttr.create("rotationOffsetY", "rotoffy", om2.MFnUnitAttribute.kAngle, 0.0)
        rotOffZ = uAttr.create("rotationOffsetZ", "rotoffz", om2.MFnUnitAttribute.kAngle, 0.0)
        HelperJoint.inRotationOffset = nAttr.create("rotationOffset", "rotoff", rotOffX, rotOffY, rotOffZ)
        INPUT_ATTR(nAttr)

        HelperJoint.inRotAngle = uAttr.create("rotationAngle", "rotangle", om2.MFnUnitAttribute.kAngle, 0.0)
        INPUT_ATTR(uAttr)

        HelperJoint.inRestAngle = uAttr.create("restAngle", "rang", om2.MFnUnitAttribute.kAngle, 0.0)
        INPUT_ATTR(uAttr)

        HelperJoint.inRotInterp = nAttr.create("rotationInterpolation", "roti", om2.MFnNumericData.kFloat, 0.5)
        nAttr.setMin(0.0)
        nAttr.setMax(1.0)
        INPUT_ATTR(nAttr)

        HelperJoint.inPosMult = nAttr.create("positiveMultiplier", "posmult", om2.MFnNumericData.kFloat, 0.0)
        INPUT_ATTR(nAttr)

        HelperJoint.inNegMult = nAttr.create("negativeMultiplier", "negmult", om2.MFnNumericData.kFloat, 0.0)
        INPUT_ATTR(nAttr)

        HelperJoint.inTargetList = cAttr.create("targetList", "tgtl")
        cAttr.addChild(HelperJoint.inPositionOffset)
        cAttr.addChild(HelperJoint.inRotationOffset)
        cAttr.addChild(HelperJoint.inRotAngle)
        cAttr.addChild(HelperJoint.inRestAngle)
        cAttr.addChild(HelperJoint.inRotInterp)
        cAttr.addChild(HelperJoint.inPosMult)
        cAttr.addChild(HelperJoint.inNegMult)
        cAttr.array = True

        HelperJoint.outTransform = mAttr.create("outTransform", "outtrans", om2.MFnMatrixAttribute.kDouble)
        mAttr.array = True
        OUTPUT_ATTR(mAttr)

        HelperJoint.addAttribute(HelperJoint.inSource)
        HelperJoint.addAttribute(HelperJoint.inSourceParent)
        HelperJoint.addAttribute(HelperJoint.inParInvMtx)
        HelperJoint.addAttribute(HelperJoint.inSourceParSca)
        HelperJoint.addAttribute(HelperJoint.inTargetList)
        HelperJoint.addAttribute(HelperJoint.outTransform)
        HelperJoint.attributeAffects(HelperJoint.inSource, HelperJoint.outTransform)
        HelperJoint.attributeAffects(HelperJoint.inSourceParent, HelperJoint.outTransform)
        HelperJoint.attributeAffects(HelperJoint.inParInvMtx, HelperJoint.outTransform)
        HelperJoint.attributeAffects(HelperJoint.inSourceParSca, HelperJoint.outTransform)
        HelperJoint.attributeAffects(HelperJoint.inPositionOffset, HelperJoint.outTransform)
        HelperJoint.attributeAffects(HelperJoint.inRotationOffset, HelperJoint.outTransform)
        HelperJoint.attributeAffects(HelperJoint.inRotAngle, HelperJoint.outTransform)
        HelperJoint.attributeAffects(HelperJoint.inRestAngle, HelperJoint.outTransform)
        HelperJoint.attributeAffects(HelperJoint.inRotInterp, HelperJoint.outTransform)
        HelperJoint.attributeAffects(HelperJoint.inPosMult, HelperJoint.outTransform)
        HelperJoint.attributeAffects(HelperJoint.inNegMult, HelperJoint.outTransform)
示例#23
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to EulerMath class. Instances of EulerMath will use these attributes to create plugs
        for use in the compute() method.
        """
        eAttr = om2.MFnEnumAttribute()
        uAttr = om2.MFnUnitAttribute()
        nAttr = om2.MFnNumericAttribute()

        EulerMath.inOperation = eAttr.create("operation", "operation", 0)
        eAttr.addField("No Operation", 0)
        eAttr.addField("Add", 1)
        eAttr.addField("Subtract", 2)
        eAttr.addField("Multiply", 3)
        INPUT_ATTR(eAttr)

        EulerMath.inEuler1X = uAttr.create("euler1X", "e1x",
                                           om2.MFnUnitAttribute.kAngle, 0.0)
        EulerMath.inEuler1Y = uAttr.create("euler1Y", "e1y",
                                           om2.MFnUnitAttribute.kAngle, 0.0)
        EulerMath.inEuler1Z = uAttr.create("euler1Z", "e1z",
                                           om2.MFnUnitAttribute.kAngle, 0.0)
        EulerMath.inEuler1 = nAttr.create("euler1", "e1", EulerMath.inEuler1X,
                                          EulerMath.inEuler1Y,
                                          EulerMath.inEuler1Z)
        INPUT_ATTR(nAttr)

        EulerMath.inEuler1RotOrder = eAttr.create("rotateOrderEuler1", "roe1",
                                                  0)
        eAttr.addField("xyz", 0)
        eAttr.addField("yzx", 1)
        eAttr.addField("zxy", 2)
        eAttr.addField("xzy", 3)
        eAttr.addField("yxz", 4)
        eAttr.addField("zyx", 5)
        INPUT_ATTR(eAttr)

        EulerMath.inEuler2X = uAttr.create("euler2X", "e2x",
                                           om2.MFnUnitAttribute.kAngle, 0.0)
        EulerMath.inEuler2Y = uAttr.create("euler2Y", "e2y",
                                           om2.MFnUnitAttribute.kAngle, 0.0)
        EulerMath.inEuler2Z = uAttr.create("euler2Z", "e2z",
                                           om2.MFnUnitAttribute.kAngle, 0.0)
        EulerMath.inEuler2 = nAttr.create("euler2", "e2", EulerMath.inEuler2X,
                                          EulerMath.inEuler2Y,
                                          EulerMath.inEuler2Z)
        INPUT_ATTR(nAttr)

        EulerMath.inEuler2RotOrder = eAttr.create("rotateOrderEuler2", "roe2",
                                                  0)
        eAttr.addField("xyz", 0)
        eAttr.addField("yzx", 1)
        eAttr.addField("zxy", 2)
        eAttr.addField("xzy", 3)
        eAttr.addField("yxz", 4)
        eAttr.addField("zyx", 5)
        INPUT_ATTR(eAttr)

        EulerMath.outEulerX = uAttr.create("outEulerX", "oex",
                                           om2.MFnUnitAttribute.kAngle, 0.0)
        EulerMath.outEulerY = uAttr.create("outEulerY", "oey",
                                           om2.MFnUnitAttribute.kAngle, 0.0)
        EulerMath.outEulerZ = uAttr.create("outEulerZ", "oez",
                                           om2.MFnUnitAttribute.kAngle, 0.0)
        EulerMath.outEuler = nAttr.create("outEuler", "oe",
                                          EulerMath.outEulerX,
                                          EulerMath.outEulerY,
                                          EulerMath.outEulerZ)
        OUTPUT_ATTR(nAttr)

        EulerMath.inResRotOrder = eAttr.create("rotateOrderOutEuler", "rooe",
                                               0)
        eAttr.addField("xyz", 0)
        eAttr.addField("yzx", 1)
        eAttr.addField("zxy", 2)
        eAttr.addField("xzy", 3)
        eAttr.addField("yxz", 4)
        eAttr.addField("zyx", 5)
        INPUT_ATTR(eAttr)

        EulerMath.addAttribute(EulerMath.inOperation)
        EulerMath.addAttribute(EulerMath.inEuler1)
        EulerMath.addAttribute(EulerMath.inEuler1RotOrder)
        EulerMath.addAttribute(EulerMath.inEuler2)
        EulerMath.addAttribute(EulerMath.inEuler2RotOrder)
        EulerMath.addAttribute(EulerMath.inResRotOrder)
        EulerMath.addAttribute(EulerMath.outEuler)
        EulerMath.attributeAffects(EulerMath.inOperation, EulerMath.outEuler)
        EulerMath.attributeAffects(EulerMath.inEuler1, EulerMath.outEuler)
        EulerMath.attributeAffects(EulerMath.inEuler1RotOrder,
                                   EulerMath.outEuler)
        EulerMath.attributeAffects(EulerMath.inEuler2, EulerMath.outEuler)
        EulerMath.attributeAffects(EulerMath.inEuler2RotOrder,
                                   EulerMath.outEuler)
        EulerMath.attributeAffects(EulerMath.inResRotOrder, EulerMath.outEuler)
示例#24
0
    def initialize():
        """
        Defines the set of attributes for this node. The attributes declared in this function are assigned
        as static members to AimConstraint class. Instances of AimConstraint will use these attributes to create plugs
        for use in the compute() method.
        """
        eAttr = om2.MFnEnumAttribute()
        mAttr = om2.MFnMatrixAttribute()
        nAttr = om2.MFnNumericAttribute()
        uAttr = om2.MFnUnitAttribute()

        AimConstraint.inUpVecType = eAttr.create("upVectorType", "upt", 0)
        eAttr.addField("None", 0)
        eAttr.addField("World Up", 1)
        eAttr.addField("Object Up", 2)
        eAttr.addField("Angle Up", 3)
        INPUT_ATTR(eAttr)
        eAttr.channelBox = True

        offsetX = uAttr.create("offsetX", "offsetX",
                               om2.MFnUnitAttribute.kAngle, 0.0)
        offsetY = uAttr.create("offsetY", "offsetY",
                               om2.MFnUnitAttribute.kAngle, 0.0)
        offsetZ = uAttr.create("offsetZ", "offsetZ",
                               om2.MFnUnitAttribute.kAngle, 0.0)
        AimConstraint.inOffset = nAttr.create("offset", "offset", offsetX,
                                              offsetY, offsetZ)
        INPUT_ATTR(nAttr)

        AimConstraint.inWorldUpVector = nAttr.createPoint(
            "worldUpVector", "wuv")
        nAttr.default = (0.0, 1.0, 0.0)
        INPUT_ATTR(nAttr)

        AimConstraint.inWorldUpMtx = mAttr.create(
            "worldUpMatrix", "wum", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        AimConstraint.inAngleUp = uAttr.create("angleUp", "angle",
                                               om2.MFnUnitAttribute.kAngle,
                                               0.0)
        uAttr.setMin(0.0)
        uAttr.setMax(2.0 * math.pi)
        INPUT_ATTR(uAttr)

        AimConstraint.inTargetWMtx = mAttr.create(
            "targetWorldMatrix", "twmtx", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        AimConstraint.inTargetWeight = nAttr.create("targetWeight", "tw",
                                                    om2.MFnNumericData.kDouble,
                                                    1.0)
        INPUT_ATTR(nAttr)

        AimConstraint.inConstWMtx = mAttr.create(
            "constraintWorldMatrix", "cwmtx", om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        AimConstraint.inConstParInvMtx = mAttr.create(
            "constraintParentInverseMatrix", "cpim",
            om2.MFnMatrixAttribute.kDouble)
        INPUT_ATTR(mAttr)

        jntOriX = uAttr.create("constraintJointOrientX", "cjorx",
                               om2.MFnUnitAttribute.kAngle, 0.0)
        jntOriY = uAttr.create("constraintJointOrientY", "cjory",
                               om2.MFnUnitAttribute.kAngle, 0.0)
        jntOriZ = uAttr.create("constraintJointOrientZ", "cjorz",
                               om2.MFnUnitAttribute.kAngle, 0.0)
        AimConstraint.inConstJntOri = nAttr.create("constraintJointOrient",
                                                   "cjor", jntOriX, jntOriY,
                                                   jntOriZ)
        INPUT_ATTR(nAttr)

        AimConstraint.inConstRotOrder = eAttr.create("constraintRotateOrder",
                                                     "cro", 0)
        eAttr.addField("xyz", 0)
        eAttr.addField("yzx", 1)
        eAttr.addField("zxy", 2)
        eAttr.addField("xzy", 3)
        eAttr.addField("yxz", 4)
        eAttr.addField("zyx", 5)
        INPUT_ATTR(eAttr)

        outConstraintX = uAttr.create("constraintX", "cx",
                                      om2.MFnUnitAttribute.kAngle, 0.0)
        outConstraintY = uAttr.create("constraintY", "cy",
                                      om2.MFnUnitAttribute.kAngle, 0.0)
        outConstraintZ = uAttr.create("constraintZ", "cz",
                                      om2.MFnUnitAttribute.kAngle, 0.0)
        AimConstraint.outConstraint = nAttr.create("constraint", "const",
                                                   outConstraintX,
                                                   outConstraintY,
                                                   outConstraintZ)
        OUTPUT_ATTR(nAttr)

        AimConstraint.addAttribute(AimConstraint.inUpVecType)
        AimConstraint.addAttribute(AimConstraint.inOffset)
        AimConstraint.addAttribute(AimConstraint.inWorldUpVector)
        AimConstraint.addAttribute(AimConstraint.inWorldUpMtx)
        AimConstraint.addAttribute(AimConstraint.inAngleUp)
        AimConstraint.addAttribute(AimConstraint.inTargetWMtx)
        AimConstraint.addAttribute(AimConstraint.inTargetWeight)
        AimConstraint.addAttribute(AimConstraint.inConstWMtx)
        AimConstraint.addAttribute(AimConstraint.inConstParInvMtx)
        AimConstraint.addAttribute(AimConstraint.inConstJntOri)
        AimConstraint.addAttribute(AimConstraint.inConstRotOrder)
        AimConstraint.addAttribute(AimConstraint.outConstraint)
        AimConstraint.attributeAffects(AimConstraint.inUpVecType,
                                       AimConstraint.outConstraint)
        AimConstraint.attributeAffects(AimConstraint.inOffset,
                                       AimConstraint.outConstraint)
        AimConstraint.attributeAffects(AimConstraint.inWorldUpVector,
                                       AimConstraint.outConstraint)
        AimConstraint.attributeAffects(AimConstraint.inWorldUpMtx,
                                       AimConstraint.outConstraint)
        AimConstraint.attributeAffects(AimConstraint.inAngleUp,
                                       AimConstraint.outConstraint)
        AimConstraint.attributeAffects(AimConstraint.inTargetWMtx,
                                       AimConstraint.outConstraint)
        AimConstraint.attributeAffects(AimConstraint.inTargetWeight,
                                       AimConstraint.outConstraint)
        AimConstraint.attributeAffects(AimConstraint.inConstWMtx,
                                       AimConstraint.outConstraint)
        AimConstraint.attributeAffects(AimConstraint.inConstParInvMtx,
                                       AimConstraint.outConstraint)
        AimConstraint.attributeAffects(AimConstraint.inConstJntOri,
                                       AimConstraint.outConstraint)
        AimConstraint.attributeAffects(AimConstraint.inConstRotOrder,
                                       AimConstraint.outConstraint)