Пример #1
0
        public static void initialize()
        {
            MFnNumericAttribute nAttr = new MFnNumericAttribute();
            MFnMatrixAttribute nMAttr = new MFnMatrixAttribute();
            //MFnTypedAttribute nTAttr;
            MFnGenericAttribute nGAttr = new MFnGenericAttribute();

            // Input Attributes
            //
            aAngle = nAttr.create("angle", "ang", MFnNumericData.Type.kFloat);
            nAttr.setDefault(30.0f);
            nAttr.setMin(0.0f);
            nAttr.setMax(100.0f);
            nAttr.isKeyable = true;
            nAttr.isStorable = true;
            nAttr.isReadable = true;
            nAttr.isWritable = true;

            aColor1 = nAttr.createColor("walkableColor", "w");
            nAttr.setDefault(0.0f, 1.0f, 0.0f);
            nAttr.isKeyable = true;
            nAttr.isStorable = true;
            nAttr.isUsedAsColor = true;
            nAttr.isReadable = true;
            nAttr.isWritable = true;

            aColor2 = nAttr.createColor("nonWalkableColor", "nw");
            nAttr.setDefault(1.0f, 0.0f, 0.0f);
            nAttr.isKeyable = true;
            nAttr.isStorable = true;
            nAttr.isUsedAsColor = true;
            nAttr.isReadable = true;
            nAttr.isWritable = true;

            // Surface Normal supplied by the render sampler

            aTriangleNormalCamera = nAttr.createPoint("triangleNormalCamera", "n");
            nAttr.isStorable = false;
            nAttr.isHidden = true;
            nAttr.isReadable = true;
            nAttr.isWritable = true;

            //View matrix from the camera into world space

            aMatrixEyeToWorld = nMAttr.create("matrixEyeToWorld", "mew",
                                                MFnMatrixAttribute.Type.kFloat);
            nAttr.isHidden = true;
            nMAttr.isWritable = true;

            // Output Attributes

            aOutColor = nAttr.createColor("outColor", "oc");
            nAttr.isStorable = false;
            nAttr.isHidden = false;
            nAttr.isReadable = true;
            nAttr.isWritable = false;

            //dummy plug for forcing evaluation

            aDirtyShaderAttr = nGAttr.create("dirtyShaderPlug", "dsp");
            nGAttr.isArray = true;
            nGAttr.isHidden = false;
            nGAttr.usesArrayDataBuilder = true;
            nGAttr.isReadable = false;
            nGAttr.isStorable = true;
            nGAttr.indexMatters = false;
            nGAttr.addAccept(MFnData.Type.kMesh);

            //Add attribues
            addAttribute(aAngle);
            addAttribute(aColor1);
            addAttribute(aColor2);
            addAttribute(aTriangleNormalCamera);
            addAttribute(aOutColor);
            addAttribute(aMatrixEyeToWorld);
            addAttribute(aDirtyShaderAttr);

            attributeAffects(aAngle, aOutColor);
            attributeAffects(aColor1, aOutColor);
            attributeAffects(aColor2, aOutColor);
            attributeAffects(aTriangleNormalCamera, aOutColor);
            attributeAffects(aDirtyShaderAttr, aOutColor);
        }
Пример #2
0
        public static void initialize()
        //
        //	Description:
        //		Initializes the attributes for this node.
        //
        {
            MFnNumericAttribute nAttr  = new MFnNumericAttribute();
            MFnMatrixAttribute  nMAttr = new MFnMatrixAttribute();
            //MFnTypedAttribute nTAttr;
            MFnGenericAttribute nGAttr = new MFnGenericAttribute();


            // Input Attributes
            //
            aAngle = nAttr.create("angle", "ang", MFnNumericData.Type.kFloat);
            nAttr.setDefault(30.0f);
            nAttr.setMin(0.0f);
            nAttr.setMax(100.0f);
            nAttr.isKeyable  = true;
            nAttr.isStorable = true;
            nAttr.isReadable = true;
            nAttr.isWritable = true;

            aColor1 = nAttr.createColor("walkableColor", "w");
            nAttr.setDefault(0.0f, 1.0f, 0.0f);
            nAttr.isKeyable     = true;
            nAttr.isStorable    = true;
            nAttr.isUsedAsColor = true;
            nAttr.isReadable    = true;
            nAttr.isWritable    = true;

            aColor2 = nAttr.createColor("nonWalkableColor", "nw");
            nAttr.setDefault(1.0f, 0.0f, 0.0f);
            nAttr.isKeyable     = true;
            nAttr.isStorable    = true;
            nAttr.isUsedAsColor = true;
            nAttr.isReadable    = true;
            nAttr.isWritable    = true;


            // Surface Normal supplied by the render sampler

            aTriangleNormalCamera = nAttr.createPoint("triangleNormalCamera", "n");
            nAttr.isStorable      = false;
            nAttr.isHidden        = true;
            nAttr.isReadable      = true;
            nAttr.isWritable      = true;

            //View matrix from the camera into world space

            aMatrixEyeToWorld = nMAttr.create("matrixEyeToWorld", "mew",
                                              MFnMatrixAttribute.Type.kFloat);
            nAttr.isHidden    = true;
            nMAttr.isWritable = true;

            // Output Attributes

            aOutColor        = nAttr.createColor("outColor", "oc");
            nAttr.isStorable = false;
            nAttr.isHidden   = false;
            nAttr.isReadable = true;
            nAttr.isWritable = false;

            //dummy plug for forcing evaluation

            aDirtyShaderAttr            = nGAttr.create("dirtyShaderPlug", "dsp");
            nGAttr.isArray              = true;
            nGAttr.isHidden             = false;
            nGAttr.usesArrayDataBuilder = true;
            nGAttr.isReadable           = false;
            nGAttr.isStorable           = true;
            nGAttr.indexMatters         = false;
            nGAttr.addAccept(MFnData.Type.kMesh);

            //Add attribues
            addAttribute(aAngle);
            addAttribute(aColor1);
            addAttribute(aColor2);
            addAttribute(aTriangleNormalCamera);
            addAttribute(aOutColor);
            addAttribute(aMatrixEyeToWorld);
            addAttribute(aDirtyShaderAttr);

            attributeAffects(aAngle, aOutColor);
            attributeAffects(aColor1, aOutColor);
            attributeAffects(aColor2, aOutColor);
            attributeAffects(aTriangleNormalCamera, aOutColor);
            attributeAffects(aDirtyShaderAttr, aOutColor);
        }