MStatus sgLockAngleMatrix::initialize() { MStatus status; MFnMatrixAttribute mAttr; MFnNumericAttribute nAttr; MFnEnumAttribute eAttr; aBaseMatrix = mAttr.create( "baseMatrix", "baseMatrix" ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aBaseMatrix ) ); aInputMatrix = mAttr.create( "inputMatrix", "inputMatrix" ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMatrix ) ); aAngleAxis = eAttr.create( "angleAxis", "angleAxis" ); eAttr.addField( " X", 0 );eAttr.addField( " Y", 1 );eAttr.addField( " Z", 2 ); eAttr.addField( "-X", 3 );eAttr.addField( "-Y", 4 );eAttr.addField( "-Z", 5 ); eAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aAngleAxis ) ); aInputAngle = nAttr.create( "inputAngle", "inputAngle", MFnNumericData::kDouble, 45 ); nAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputAngle ) ); aOutputMatrix = mAttr.create( "outputMatrix", "outputMatrix" ); mAttr.setStorable( false ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutputMatrix ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aBaseMatrix, aOutputMatrix ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMatrix, aOutputMatrix ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aAngleAxis, aOutputMatrix ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputAngle, aOutputMatrix ) ); return MS::kSuccess; }
MStatus VolumePushCollider::initialize() { MFnNumericAttribute nAttr; MFnMatrixAttribute mAttr; // inCollider aInCollider = mAttr.create("inCollider", "col"); mAttr.setArray(true); CHECK_MSTATUS(addAttribute(aInCollider)); // inVolume aInVolume = mAttr.create("inVolume", "vol"); mAttr.setArray(true); CHECK_MSTATUS(addAttribute(aInVolume)); // output aOutput = nAttr.create("output", "out", MFnNumericData::kDouble, 0.0); nAttr.setArray(true); nAttr.setReadable(true); nAttr.setWritable(true); nAttr.setHidden(true); CHECK_MSTATUS(addAttribute(aOutput)); attributeAffects(aInCollider, aOutput); attributeAffects(aInVolume, aOutput); return MS::kSuccess; }
MStatus SwirlDeformer::initialize() { MFnMatrixAttribute mAttr; deformSpace = mAttr.create( "deformSpace", "dSp" ); mAttr.setStorable( false ); MFnUnitAttribute unitFn; startDist = unitFn.create( "startDist", "sd", MFnUnitAttribute::kDistance ); unitFn.setDefault( MDistance( 0.0, MDistance::uiUnit() ) ); unitFn.setMin( MDistance( 0.0, MDistance::uiUnit() ) ); unitFn.setKeyable( true ); endDist = unitFn.create( "endDist", "ed", MFnUnitAttribute::kDistance ); unitFn.setDefault( MDistance( 3.0, MDistance::uiUnit() ) ); unitFn.setMin( MDistance( 0.0, MDistance::uiUnit() ) ); unitFn.setKeyable( true ); addAttribute( deformSpace ); addAttribute( startDist ); addAttribute( endDist ); attributeAffects( deformSpace, outputGeom ); attributeAffects( startDist, outputGeom ); attributeAffects( endDist, outputGeom ); return MS::kSuccess; }
MStatus BCIViz::initialize() { MFnNumericAttribute numFn; MFnMatrixAttribute matAttr; MStatus stat; ainput = matAttr.create( "input", "in", MFnMatrixAttribute::kDouble ); matAttr.setStorable(false); matAttr.setWritable(true); matAttr.setConnectable(true); addAttribute(ainput); atargets = matAttr.create( "target", "tgt", MFnMatrixAttribute::kDouble ); matAttr.setStorable(false); matAttr.setWritable(true); matAttr.setArray(true); matAttr.setConnectable(true); addAttribute(atargets); outValue = numFn.create( "outValue", "ov", MFnNumericData::kDouble ); numFn.setStorable(false); numFn.setWritable(false); numFn.setReadable(true); numFn.setArray(true); numFn.setUsesArrayDataBuilder( true ); addAttribute(outValue); attributeAffects(ainput, outValue); attributeAffects(atargets, outValue); return MS::kSuccess; }
MStatus sgBulgeDeformer::initialize() { MStatus status; MFnNumericAttribute nAttr; MFnTypedAttribute tAttr; MFnMatrixAttribute mAttr; MFnCompoundAttribute cAttr; aBulgeWeight = nAttr.create(nameBulgeWeight, nameBulgeWeight, MFnNumericData::kFloat, 1.0); nAttr.setStorable(false); nAttr.setKeyable(true); addAttribute(aBulgeWeight); aBulgeRadius = nAttr.create(nameBulgeRadius, nameBulgeRadius, MFnNumericData::kDouble, 0); nAttr.setMin(0); nAttr.setStorable(false); nAttr.setKeyable(true); addAttribute(aBulgeRadius); aBulgeInputs = cAttr.create(nameBulgeInputs, nameBulgeInputs); aMatrix = mAttr.create(nameMatrix, nameMatrix); aMesh = tAttr.create(nameMesh, nameMesh, MFnData::kMesh ); cAttr.addChild(aMatrix); cAttr.addChild(aMesh); cAttr.setArray(true); addAttribute(aBulgeInputs); attributeAffects(aBulgeWeight, outputGeom); attributeAffects(aBulgeRadius, outputGeom); attributeAffects(aBulgeInputs, outputGeom); return status; }
MStatus transRotateCombineMatrix::initialize() { MStatus status; MFnMatrixAttribute mAttr; aOutputMatrix = mAttr.create( "outputMatrix", "om" ); mAttr.setStorable( false ); status = addAttribute( aOutputMatrix ); CHECK_MSTATUS_AND_RETURN_IT( status ); aOutputInverseMatrix = mAttr.create( "outputInverseMatrix", "oim" ); mAttr.setStorable( false ); status = addAttribute( aOutputInverseMatrix ); CHECK_MSTATUS_AND_RETURN_IT( status ); aInputTransMatrix = mAttr.create( "inputTransMatrix", "itm" ); mAttr.setStorable( true ); status = addAttribute( aInputTransMatrix ); CHECK_MSTATUS_AND_RETURN_IT( status ); status = attributeAffects( aInputTransMatrix, aOutputMatrix ); status = attributeAffects( aInputTransMatrix, aOutputInverseMatrix ); aInputRotateMatrix = mAttr.create( "inputRotateMatrix", "irm" ); mAttr.setStorable( true ); status = addAttribute( aInputRotateMatrix ); CHECK_MSTATUS_AND_RETURN_IT( status ); status = attributeAffects( aInputRotateMatrix, aOutputMatrix ); status = attributeAffects( aInputRotateMatrix, aOutputInverseMatrix ); CHECK_MSTATUS_AND_RETURN_IT( status ); return MS::kSuccess; }
MStatus inverseSkinCluster::initialize() { MStatus status; MFnNumericAttribute nAttr; MFnMatrixAttribute mAttr; MFnMessageAttribute msgAttr; MFnTypedAttribute tAttr; aInMesh = tAttr.create( "inMesh", "inMesh", MFnData::kMesh ); tAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInMesh ) ); aGeomMatrix = mAttr.create( "geomMatrix", "geomMatrix" ); tAttr.setCached( false ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGeomMatrix ) ); aMatrix = mAttr.create( "matrix", "matrix" ); mAttr.setArray( true ); mAttr.setStorable( true ); mAttr.setUsesArrayDataBuilder( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aMatrix ) ); aBindPreMatrix = mAttr.create( "bindPreMatrix", "bindPreMatrix" ); mAttr.setArray( true ); mAttr.setStorable( true ); mAttr.setUsesArrayDataBuilder( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aBindPreMatrix ) ); aUpdateMatrix = nAttr.create( "updateMatrix", "updateMatrix", MFnNumericData::kBoolean, false ); nAttr.setStorable( false ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aUpdateMatrix ) ); aTargetSkinCluster = msgAttr.create( "targetSkinCluster", "targetSkinCluster" ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aTargetSkinCluster ) ); aUpdateWeightList = nAttr.create( "updateWeightList", "updateWeightList", MFnNumericData::kBoolean, false ); nAttr.setStorable( false ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aUpdateWeightList ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInMesh, outputGeom ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGeomMatrix, outputGeom ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aMatrix, outputGeom ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aBindPreMatrix, outputGeom ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aUpdateMatrix, outputGeom ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aUpdateWeightList, outputGeom ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aTargetSkinCluster, outputGeom ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aMatrix, outputGeom ) ); return MS::kSuccess; }
MStatus offset::initialize() { // local attribute initialization MFnMatrixAttribute mAttr; offsetMatrix=mAttr.create( "locateMatrix", "lm"); mAttr.setStorable(false); mAttr.setConnectable(true); // deformation attributes addAttribute( offsetMatrix); attributeAffects( offset::offsetMatrix, offset::outputGeom ); return MStatus::kSuccess; }
MStatus sgMeshIntersect::initialize() { MStatus status; MFnNumericAttribute nAttr; MFnTypedAttribute tAttr; MFnMatrixAttribute mAttr; aPointSourceX = nAttr.create( "pointSourceX", "psx", MFnNumericData::kDouble, 0.0 ); aPointSourceY = nAttr.create( "pointSourceY", "psy", MFnNumericData::kDouble, 0.0 ); aPointSourceZ = nAttr.create( "pointSourceZ", "psz", MFnNumericData::kDouble, 0.0 ); aPointSource = nAttr.create( "pointSource", "ps", aPointSourceX, aPointSourceY, aPointSourceZ ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aPointSource ) ); aPointDestX = nAttr.create( "pointDestX", "pdx", MFnNumericData::kDouble, 0.0 ); aPointDestY = nAttr.create( "pointDestY", "pdy", MFnNumericData::kDouble, 0.0 ); aPointDestZ = nAttr.create( "pointDestZ", "pdz", MFnNumericData::kDouble, 0.0 ); aPointDest = nAttr.create( "pointDest", "pd", aPointDestX, aPointDestY, aPointDestZ ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aPointDest ) ); aInputMesh = tAttr.create( "inputMesh", "inMesh", MFnData::kMesh ); tAttr.setCached( false ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMesh ) ); aInputMeshMatrix = mAttr.create( "inputMeshMatrix", "inMatrix" ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMeshMatrix ) ); aParentInverseMatrix = mAttr.create( "parentInverseMatrix", "pim" ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aParentInverseMatrix ) ); aOutPointX = nAttr.create( "outPointX", "opx", MFnNumericData::kDouble, 0.0 ); aOutPointY = nAttr.create( "outPointY", "opy", MFnNumericData::kDouble, 0.0 ); aOutPointZ = nAttr.create( "outPointZ", "opz", MFnNumericData::kDouble, 0.0 ); aOutPoint = nAttr.create( "outPoint", "op", aOutPointX, aOutPointY, aOutPointZ ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutPoint ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aPointSource, aOutPoint ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aPointDest, aOutPoint ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMesh, aOutPoint ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMeshMatrix, aOutPoint ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aParentInverseMatrix, aOutPoint ) ); m_nodeNumber = 0; return MS::kSuccess; }
MStatus sphericalBlendShapeVisualizer::initialize() { MStatus status; MFnMatrixAttribute mAttr; MFnEnumAttribute eAttr; aSpaceMatrix = mAttr.create("spaceMatrix", "spaceMatrix", MFnMatrixAttribute::kDouble, &status); CHECK_MSTATUS_AND_RETURN_IT(status); aPoleAxis = eAttr.create("poleAxis", "poleAxis", 1, &status); CHECK_MSTATUS_AND_RETURN_IT(status); eAttr.addField("+X", 0); eAttr.addField("+Y", 1); eAttr.addField("+Z", 2); eAttr.addField("-X", 3); eAttr.addField("-Y", 4); eAttr.addField("-Z", 5); eAttr.setDefault(1); eAttr.setKeyable(true); eAttr.setStorable(true); eAttr.setWritable(true); aSeamAxis = eAttr.create("seamAxis", "seamAxis", 0, &status); CHECK_MSTATUS_AND_RETURN_IT(status); eAttr.addField("+X", 0); eAttr.addField("+Y", 1); eAttr.addField("+Z", 2); eAttr.addField("-X", 3); eAttr.addField("-Y", 4); eAttr.addField("-Z", 5); eAttr.setDefault(0); eAttr.setKeyable(true); eAttr.setStorable(true); eAttr.setWritable(true); addAttribute(aSpaceMatrix); addAttribute(aPoleAxis); addAttribute(aSeamAxis); return MS::kSuccess; }
MStatus matrixFromPolygon::initialize() { MStatus status; MFnNumericAttribute nAttr; MFnMatrixAttribute mAttr; MFnTypedAttribute tAttr; aOutputMatrix = mAttr.create( "outputMatrix", "outputMatrix" ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutputMatrix ) ); aInputMesh = tAttr.create( "inputMesh", "inputMesh", MFnData::kMesh ); tAttr.setStorable( true ); tAttr.setCached( false ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMesh ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMesh, aOutputMatrix ) ); aInputMeshMatrix = mAttr.create( "inputMeshMatrix", "inputMeshMatrix" ); mAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMeshMatrix ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMeshMatrix, aOutputMatrix ) ); aPolygonIndex = nAttr.create( "polygonIndex", "polygonIndex", MFnNumericData::kInt, 0 ); nAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aPolygonIndex ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aPolygonIndex, aOutputMatrix ) ); aU = nAttr.create( "u", "u", MFnNumericData::kDouble, 0.5 ); nAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aU ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aU, aOutputMatrix ) ); aV = nAttr.create( "v", "v", MFnNumericData::kDouble, 0.5 ); nAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aV ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aV, aOutputMatrix ) ); return MS::kSuccess; }
// INIT ========================================= MStatus gear_curveCns::initialize() { MFnMatrixAttribute mAttr; MStatus stat; // INPUTS inputs = mAttr.create( "inputs", "inputs" ); mAttr.setStorable(true); mAttr.setReadable(false); mAttr.setIndexMatters(false); mAttr.setArray(true); stat = addAttribute( inputs ); if (!stat) {stat.perror("addAttribute"); return stat;} // CONNECTIONS stat = attributeAffects( inputs, outputGeom ); if (!stat) { stat.perror("attributeAffects"); return stat;} return MS::kSuccess; }
MStatus MG_curve::initialize() { //This is the curve degree attribute MFnNumericAttribute numFn; degree = numFn.create("degree","d",MFnNumericData::kInt,3); numFn.setMin(1); addAttribute(degree); //Those are all the matrix input MFnMatrixAttribute matrixFn; inputMatrix =matrixFn.create("inputMatrix","im"); matrixFn.setArray(true); matrixFn.setStorable(true); addAttribute(inputMatrix); //This is the curve's matrix used to compensate curve translate transformMatrix =matrixFn.create("transformMatrix","tm"); matrixFn.setStorable(true); addAttribute(transformMatrix); //This is the curve output attribute MFnTypedAttribute typedFn; output = typedFn.create("output","o",MFnData::kNurbsCurve); typedFn.setStorable(false); typedFn.setWritable(false); addAttribute(output); attributeAffects(degree,output); attributeAffects(inputMatrix,output); attributeAffects(transformMatrix,output); return MS::kSuccess; }
MStatus n_tentacle::initialize() { MFnNumericAttribute numericAttr; MFnMatrixAttribute matrixAttr; MFnTypedAttribute typedAttr; MFnUnitAttribute unitAttribute; MFnEnumAttribute enumAttr; MStatus stat; stretch = numericAttr.create("stretch", "st", MFnNumericData::kDouble, 0.0); numericAttr.setMin(0.0); numericAttr.setMax(1.0); globalScale = numericAttr.create("globalScale", "gs", MFnNumericData::kDouble, 1.0); numericAttr.setMin(0.00001); numericAttr.setMax(10.0); iniLength = numericAttr.create("iniLength", "iln", MFnNumericData::kDouble, 0.01); parameter = numericAttr.create("parameter", "prm", MFnNumericData::kDouble, 0.0); numericAttr.setArray(true); blendRot = numericAttr.create("blendRot", "blr", MFnNumericData::kDouble, 0.0); numericAttr.setArray(true); interval = numericAttr.create("interval", "itv", MFnNumericData::kInt, 0); numericAttr.setArray(true); matrix = matrixAttr.create("matrix", "mtx"); matrixAttr.setArray(true); matrixAttr.setHidden(true); curve = typedAttr.create("curve", "crv", MFnData::kNurbsCurve); outTranslate = numericAttr.create("outTranslate", "ot", MFnNumericData::k3Double); numericAttr.setArray(true); numericAttr.setHidden(true); numericAttr.setUsesArrayDataBuilder(true); numericAttr.setHidden(true); outRotateX = unitAttribute.create("outRotateX", "orx", MFnUnitAttribute::kAngle); outRotateY = unitAttribute.create("outRotateY", "ory", MFnUnitAttribute::kAngle); outRotateZ = unitAttribute.create("outRotateZ", "orz", MFnUnitAttribute::kAngle); outRotate = numericAttr.create("outRotate", "or",outRotateX, outRotateY, outRotateZ); numericAttr.setArray(true); numericAttr.setHidden(true); numericAttr.setUsesArrayDataBuilder(true); numericAttr.setHidden(true); tangentAxis = enumAttr.create("tangentAxis", "tga", 1); enumAttr.addField("X", 0); enumAttr.addField("Y", 1); enumAttr.addField("Z", 2); enumAttr.addField("negativeX", 3); enumAttr.addField("negativeY", 4); enumAttr.addField("negativeZ", 5); // Add the attributes we have created to the node // stat = addAttribute( parameter ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( blendRot ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( interval ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( stretch ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( globalScale ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( iniLength ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( matrix ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( curve ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( outTranslate ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( outRotate ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( tangentAxis ); if (!stat) { stat.perror("addAttribute"); return stat;} attributeAffects( parameter, outTranslate ); attributeAffects( blendRot, outTranslate ); attributeAffects( interval, outTranslate ); attributeAffects( stretch, outTranslate ); attributeAffects( globalScale, outTranslate ); attributeAffects( iniLength, outTranslate ); attributeAffects( matrix, outTranslate ); attributeAffects( curve, outTranslate ); attributeAffects( tangentAxis, outTranslate ); attributeAffects( parameter, outRotate ); attributeAffects( blendRot, outRotate ); attributeAffects( interval, outRotate ); attributeAffects( stretch, outRotate ); attributeAffects( globalScale, outRotate ); attributeAffects( iniLength, outRotate ); attributeAffects( matrix, outRotate ); attributeAffects( curve, outRotate ); attributeAffects( tangentAxis, outRotate ); attributeAffects( parameter, outRotateX ); attributeAffects( blendRot, outRotateX ); attributeAffects( interval, outRotateX ); attributeAffects( stretch, outRotateX ); attributeAffects( globalScale, outRotateX ); attributeAffects( iniLength, outRotateX ); attributeAffects( matrix, outRotateX ); attributeAffects( curve, outRotateX ); attributeAffects( tangentAxis, outRotateX ); attributeAffects( parameter, outRotateY ); attributeAffects( blendRot, outRotateY ); attributeAffects( interval, outRotateY ); attributeAffects( stretch, outRotateY ); attributeAffects( globalScale, outRotateY ); attributeAffects( iniLength, outRotateY ); attributeAffects( matrix, outRotateY ); attributeAffects( curve, outRotateY ); attributeAffects( tangentAxis, outRotateY ); attributeAffects( parameter, outRotateZ ); attributeAffects( blendRot, outRotateZ ); attributeAffects( interval, outRotateZ ); attributeAffects( stretch, outRotateZ ); attributeAffects( globalScale, outRotateZ ); attributeAffects( iniLength, outRotateZ ); attributeAffects( matrix, outRotateZ ); attributeAffects( curve, outRotateZ ); attributeAffects( tangentAxis, outRotateZ ); return MS::kSuccess; }
MStatus sphericalBlendShape::initialize() { MStatus status; MFnMatrixAttribute mAttr; MFnEnumAttribute eAttr; aSpaceMatrix = mAttr.create("spaceMatrix", "spaceMatrix", MFnMatrixAttribute::kDouble, &status); CHECK_MSTATUS_AND_RETURN_IT(status); aPoleAxis = eAttr.create("poleAxis", "poleAxis", 1, &status); CHECK_MSTATUS_AND_RETURN_IT(status); eAttr.addField("+X", 0); eAttr.addField("+Y", 1); eAttr.addField("+Z", 2); eAttr.addField("-X", 3); eAttr.addField("-Y", 4); eAttr.addField("-Z", 5); eAttr.setDefault(1); eAttr.setKeyable(true); eAttr.setStorable(true); eAttr.setWritable(true); aSeamAxis = eAttr.create("seamAxis", "seamAxis", 0, &status); CHECK_MSTATUS_AND_RETURN_IT(status); eAttr.addField("+X", 0); eAttr.addField("+Y", 1); eAttr.addField("+Z", 2); eAttr.addField("-X", 3); eAttr.addField("-Y", 4); eAttr.addField("-Z", 5); eAttr.setDefault(0); eAttr.setKeyable(true); eAttr.setStorable(true); eAttr.setWritable(true); aWarpMatrix = mAttr.create("warpMatrix", "warpMatrix", MFnMatrixAttribute::kDouble, &status); CHECK_MSTATUS_AND_RETURN_IT(status); aMethod = eAttr.create("conversionMethod", "conversionMethod", 0, &status); CHECK_MSTATUS_AND_RETURN_IT(status); eAttr.addField("xyzToSpherical", 0); eAttr.addField("sphericalToXyz", 1); eAttr.setDefault(0); eAttr.setKeyable(true); eAttr.setStorable(true); eAttr.setWritable(true); addAttribute(aSpaceMatrix); addAttribute(aPoleAxis); addAttribute(aSeamAxis); addAttribute(aWarpMatrix); addAttribute(aMethod); attributeAffects(aSpaceMatrix, outputGeom); attributeAffects(aPoleAxis, outputGeom); attributeAffects(aSeamAxis, outputGeom); attributeAffects(aWarpMatrix, outputGeom); attributeAffects(aMethod, outputGeom); return MS::kSuccess; }
MStatus slopeShaderNode::initialize() // // Description: // Initializes the attributes for this node. // { MFnNumericAttribute nAttr; MFnMatrixAttribute nMAttr; MFnTypedAttribute nTAttr; MFnGenericAttribute nGAttr; // Input Attributes // aAngle = nAttr.create( "angle", "ang", MFnNumericData::kFloat); nAttr.setDefault(30.0f); nAttr.setMin(0.0f); nAttr.setMax(100.0f); nAttr.setKeyable(true); nAttr.setStorable(true); nAttr.setReadable(true); nAttr.setWritable(true); aColor1 = nAttr.createColor( "walkableColor", "w" ); nAttr.setDefault(0.0f, 1.0f, 0.0f); nAttr.setKeyable(true); nAttr.setStorable(true); nAttr.setUsedAsColor(true); nAttr.setReadable(true); nAttr.setWritable(true); aColor2 = nAttr.createColor( "nonWalkableColor", "nw" ); nAttr.setDefault(1.0f, 0.0f, 0.0f); nAttr.setKeyable(true); nAttr.setStorable(true); nAttr.setUsedAsColor(true); nAttr.setReadable(true); nAttr.setWritable(true); // Surface Normal supplied by the render sampler // aTriangleNormalCamera = nAttr.createPoint( "triangleNormalCamera", "n" ); nAttr.setStorable(false); nAttr.setHidden(true); nAttr.setReadable(true); nAttr.setWritable(true); //View matrix from the camera into world space // aMatrixEyeToWorld = nMAttr.create( "matrixEyeToWorld", "mew", MFnMatrixAttribute::kFloat ); nAttr.setHidden(true); nMAttr.setWritable(true); // Output Attributes // aOutColor = nAttr.createColor( "outColor", "oc" ); nAttr.setStorable(false); nAttr.setHidden(false); nAttr.setReadable(true); nAttr.setWritable(false); //dummy plug for forcing evaluation // aDirtyShaderAttr = nGAttr.create( "dirtyShaderPlug", "dsp"); nGAttr.setArray(true); nGAttr.setHidden(false); nGAttr.setUsesArrayDataBuilder(true); nGAttr.setReadable(false); nGAttr.setStorable(true); nGAttr.setIndexMatters(false); nGAttr.addAccept(MFnData::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); return MS::kSuccess; }
MStatus blendTwoMatrixDecompose::initialize() { MStatus stat; MFnMatrixAttribute mAttr; MFnNumericAttribute nAttr; MFnUnitAttribute uAttr; aMatrix1 = mAttr.create( "inMatrix1", "i1" ); mAttr.setStorable( true ); aMatrix2 = mAttr.create( "inMatrix2", "i2" ); mAttr.setStorable( true ); aBlender = nAttr.create( "attributeBlender", "ab", MFnNumericData::kFloat, 0.5 ); nAttr.setMin(0); nAttr.setMax(1); nAttr.setStorable( true ); aOutputTranslateX = nAttr.create( "outputTranslateX", "otx", MFnNumericData::kDouble, 0.0 ); aOutputTranslateY = nAttr.create( "outputTranslateY", "oty", MFnNumericData::kDouble, 0.0 ); aOutputTranslateZ = nAttr.create( "outputTranslateZ", "otz", MFnNumericData::kDouble, 0.0 ); aOutputTranslate = nAttr.create( "outputTranslate", "ot", aOutputTranslateX, aOutputTranslateY, aOutputTranslateZ ); nAttr.setStorable( false ); nAttr.setWritable( false ); aOutputRotateX = uAttr.create( "outputRotateX", "orx", MFnUnitAttribute::kAngle, 0.0 ); aOutputRotateY = uAttr.create( "outputRotateY", "ory", MFnUnitAttribute::kAngle, 0.0 ); aOutputRotateZ = uAttr.create( "outputRotateZ", "orz", MFnUnitAttribute::kAngle, 0.0 ); aOutputRotate = nAttr.create( "outputRotate", "or", aOutputRotateX, aOutputRotateY, aOutputRotateZ ); nAttr.setStorable( false ); nAttr.setWritable( false ); aOutputScaleX = nAttr.create( "outputScaleX", "osx", MFnNumericData::kDouble, 0.0 ); aOutputScaleY = nAttr.create( "outputScaleY", "osy", MFnNumericData::kDouble, 0.0 ); aOutputScaleZ = nAttr.create( "outputScaleZ", "osz", MFnNumericData::kDouble, 0.0 ); aOutputScale = nAttr.create( "outputScale", "os", aOutputScaleX, aOutputScaleY, aOutputScaleZ ); nAttr.setStorable( false ); nAttr.setWritable( false ); aOutputShearX = nAttr.create( "outputShearX", "oshx", MFnNumericData::kDouble, 0.0 ); aOutputShearY = nAttr.create( "outputShearY", "oshy", MFnNumericData::kDouble, 0.0 ); aOutputShearZ = nAttr.create( "outputShearZ", "oshz", MFnNumericData::kDouble, 0.0 ); aOutputShear = nAttr.create( "outputShear", "osh", aOutputShearX, aOutputShearY, aOutputShearZ ); nAttr.setStorable( false ); nAttr.setWritable( false ); stat = addAttribute( aMatrix1 ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( aMatrix2 ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( aBlender ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( aOutputTranslate ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( aOutputRotate ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( aOutputScale ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = addAttribute( aOutputShear ); if (!stat) { stat.perror("addAttribute"); return stat;} stat = attributeAffects( aMatrix1, aOutputTranslate ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( aMatrix1, aOutputRotate ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( aMatrix1, aOutputScale ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( aMatrix1, aOutputShear ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( aMatrix2, aOutputTranslate ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( aMatrix2, aOutputRotate ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( aMatrix2, aOutputScale ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( aMatrix2, aOutputShear ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( aBlender, aOutputTranslate ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( aBlender, aOutputRotate ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( aBlender, aOutputScale ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( aBlender, aOutputShear ); if (!stat) { stat.perror("attributeAffects"); return stat;} return MS::kSuccess; }
// initializes attribute information MStatus noise3::initialize() { MFnMatrixAttribute mAttr; MFnNumericAttribute nAttr; // Create input attributes aColor1 = nAttr.createColor("color1", "c1"); MAKE_INPUT(nAttr); CHECK_MSTATUS ( nAttr.setDefault(0., .58824, .644) ); // Light blue aColor2 = nAttr.createColor("color2", "c2"); MAKE_INPUT(nAttr); CHECK_MSTATUS ( nAttr.setDefault(1., 1., 1.) ); // White aScale = nAttr.create( "scale", "s", MFnNumericData::kFloat); MAKE_INPUT(nAttr); CHECK_MSTATUS ( nAttr.setDefault( 1. ) ); aBias = nAttr.create( "bias", "b", MFnNumericData::kFloat); MAKE_INPUT(nAttr); aPlaceMat = mAttr.create("placementMatrix", "pm", MFnMatrixAttribute::kFloat); MAKE_INPUT(mAttr); // Implicit shading network attributes aPointWorld = nAttr.createPoint("pointWorld", "pw"); MAKE_INPUT(nAttr); CHECK_MSTATUS ( nAttr.setHidden(true) ); // Create output attributes aOutColor = nAttr.createColor("outColor", "oc"); MAKE_OUTPUT(nAttr); aOutAlpha = nAttr.create( "outAlpha", "oa", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); // Add the attributes here CHECK_MSTATUS ( addAttribute(aColor1) ); CHECK_MSTATUS ( addAttribute(aColor2) ); CHECK_MSTATUS ( addAttribute(aScale) ); CHECK_MSTATUS ( addAttribute(aBias) ); CHECK_MSTATUS ( addAttribute(aPointWorld) ); CHECK_MSTATUS ( addAttribute(aPlaceMat) ); CHECK_MSTATUS ( addAttribute(aOutColor) ); CHECK_MSTATUS ( addAttribute(aOutAlpha) ); // All input affect the output color and alpha CHECK_MSTATUS ( attributeAffects (aColor1, aOutColor) ); CHECK_MSTATUS ( attributeAffects (aColor1, aOutAlpha) ); CHECK_MSTATUS ( attributeAffects (aColor2, aOutColor) ) ; CHECK_MSTATUS ( attributeAffects (aColor2, aOutAlpha) ); CHECK_MSTATUS ( attributeAffects (aScale, aOutAlpha) ); CHECK_MSTATUS ( attributeAffects (aScale, aOutColor) ); CHECK_MSTATUS ( attributeAffects (aBias, aOutAlpha) ); CHECK_MSTATUS ( attributeAffects (aBias, aOutColor) ); CHECK_MSTATUS ( attributeAffects (aPointWorld, aOutColor) ); CHECK_MSTATUS ( attributeAffects (aPointWorld, aOutAlpha) ); CHECK_MSTATUS ( attributeAffects (aPlaceMat, aOutColor) ); CHECK_MSTATUS ( attributeAffects (aPlaceMat, aOutAlpha) ); return MS::kSuccess; }
MStatus MG_softIk::initialize() { //This is the nurbs input attribute MFnTypedAttribute typedFn; MFnCompoundAttribute compund; MFnNumericAttribute numFn; MFnMatrixAttribute matrixFn; startMatrix =matrixFn.create("startMatrix","stm"); addAttribute(startMatrix); endMatrix =matrixFn.create("endMatrix","enm"); addAttribute(endMatrix); upInitLength = numFn.create("upInitLength","uil",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(upInitLength); downInitLength = numFn.create("downInitLength","dil",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(downInitLength); globalScale = numFn.create("globalScale","gb",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); numFn.setMin(0.001); addAttribute(globalScale); softDistance = numFn.create("softDistance","sd",MFnNumericData::kDouble,0); numFn.setMin(0.001); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(softDistance); stretch = numFn.create("stretch","str",MFnNumericData::kDouble,0); numFn.setMin(0.0); numFn.setMax(1.0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(stretch); slide = numFn.create("slide","sld",MFnNumericData::kDouble,0.5); numFn.setMin(0.0); numFn.setMax(1.0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(slide); upScale = numFn.create("upScale","ups",MFnNumericData::kDouble,1); numFn.setStorable(false); numFn.setKeyable(false); numFn.setWritable(false); addAttribute(upScale); downScale = numFn.create("downScale","dws",MFnNumericData::kDouble,1); numFn.setStorable(false); numFn.setKeyable(false); numFn.setWritable(false); addAttribute(downScale); outputTranslateX = numFn.create("outputTranslateX","otx",MFnNumericData::kDouble,0); numFn.setStorable(false); numFn.setKeyable(false); numFn.setWritable(false); addAttribute(outputTranslateX); outputTranslateY = numFn.create("outputTranslateY","oty",MFnNumericData::kDouble,0); numFn.setStorable(false); numFn.setWritable(false); numFn.setKeyable(false); addAttribute(outputTranslateY); outputTranslateZ = numFn.create("outputTranslateZ","otz",MFnNumericData::kDouble,0); numFn.setStorable(false); numFn.setKeyable(false); numFn.setWritable(false); addAttribute(outputTranslateZ); outputTranslate= compund.create("outputTranslate","ot"); compund.addChild(outputTranslateX); compund.addChild(outputTranslateY); compund.addChild(outputTranslateZ); compund.setStorable(false); compund.setKeyable(false); compund.setWritable(false); addAttribute(outputTranslate); attributeAffects( startMatrix ,outputTranslate) ; attributeAffects( endMatrix ,outputTranslate) ; attributeAffects( softDistance ,outputTranslate) ; attributeAffects( stretch ,outputTranslate) ; attributeAffects( slide ,outputTranslate) ; attributeAffects( globalScale ,outputTranslate) ; attributeAffects( startMatrix ,upScale) ; attributeAffects( endMatrix ,upScale) ; attributeAffects( stretch ,upScale) ; attributeAffects( softDistance ,upScale) ; attributeAffects( slide ,upScale) ; attributeAffects( globalScale ,upScale) ; attributeAffects( startMatrix ,downScale) ; attributeAffects( endMatrix ,downScale) ; attributeAffects( softDistance ,downScale) ; attributeAffects( stretch ,downScale) ; attributeAffects( slide ,downScale) ; attributeAffects( globalScale ,downScale) ; return MS::kSuccess; }
MStatus MG_nurbsRivet::initialize() { //This is the nurbs input attribute MFnTypedAttribute typedFn; MFnCompoundAttribute compund; MFnNumericAttribute numFn; MFnMatrixAttribute matrixFn; inputNurbSurface = typedFn.create("inputNurbSurface","in",MFnData::kNurbsSurface); typedFn.setStorable(true); addAttribute(inputNurbSurface); //This is the input point attribute inputPointX = numFn.create("inputPointX","ipx",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(inputPointX); inputPointY = numFn.create("inputPointY","ipy",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(inputPointY); inputPointZ = numFn.create("inputPointZ","ipz",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(inputPointZ); inputPoint= compund.create("inputPoint","ip"); compund.addChild(inputPointX); compund.addChild(inputPointY); compund.addChild(inputPointZ); addAttribute(inputPoint); //This is the recompute point checkbox recompute = numFn.create("recompute","r",MFnNumericData::kBoolean,1); numFn.setKeyable(true); numFn.setStorable(true); addAttribute(recompute); //This is U attribute uValue = numFn.create("uValue","u",MFnNumericData::kFloat , 0); numFn.setKeyable(true); numFn.setStorable(true); addAttribute(uValue); //This is V attribute vValue = numFn.create("vValue","v",MFnNumericData::kFloat , 0 ); numFn.setKeyable(true); numFn.setStorable(true); addAttribute(vValue); //This is the output translate attribute outputX = numFn.create("outputTranslateX","otx",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(outputX); outputY = numFn.create("outputTranslateY","oty",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(outputY); outputZ = numFn.create("outputTranslateZ","otz",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(outputZ); output= compund.create("outputTranslate","ot"); compund.addChild(outputX); compund.addChild(outputY); compund.addChild(outputZ); compund.setKeyable(false); compund.setStorable(false); compund.setWritable(false); addAttribute(output); //output = numFn.createPoint("outputTranslate","ot"); //numFn.setKeyable(false); //numFn.setStorable(false); //numFn.setWritable(false); //addAttribute(output); //This is the output rotate attribute outputRotateX = numFn.create("outputRotateX","orx",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(outputRotateX); outputRotateY = numFn.create("outputRotateY","ory",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(outputRotateY); outputRotateZ = numFn.create("outputRotateZ","orz",MFnNumericData::kDouble,0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(outputRotateZ); outputRotate= compund.create("outputRotate","oro"); compund.addChild(outputRotateX); compund.addChild(outputRotateY); compund.addChild(outputRotateZ); compund.setKeyable(false); compund.setStorable(false); compund.setWritable(false); addAttribute(outputRotate); //Those are all the matrix input outputMatrix =matrixFn.create("outputMatrix","om"); matrixFn.setKeyable(false); matrixFn.setStorable(false); matrixFn.setWritable(false); addAttribute(outputMatrix); //offset matrix offsetMatrix =matrixFn.create("offsetMatrix","ofm"); MMatrix defMatrix; defMatrix.setToIdentity(); matrixFn.setDefault(defMatrix); matrixFn.setKeyable(false); matrixFn.setStorable(true); matrixFn.setWritable(true); addAttribute(offsetMatrix); //all the attr affects attributeAffects (recompute,output); attributeAffects (inputPoint,output); attributeAffects (inputNurbSurface,output); attributeAffects (uValue,output); attributeAffects (vValue,output); attributeAffects (offsetMatrix,output); attributeAffects (recompute,outputRotate); attributeAffects (inputPoint,outputRotate); attributeAffects (inputNurbSurface,outputRotate); attributeAffects (uValue,outputRotate); attributeAffects (vValue,outputRotate); attributeAffects (offsetMatrix,outputRotate); attributeAffects (recompute,outputMatrix); attributeAffects (inputPoint,outputMatrix); attributeAffects (inputNurbSurface,outputMatrix); attributeAffects (uValue,outputMatrix); attributeAffects (vValue,outputMatrix); attributeAffects (offsetMatrix,outputMatrix); return MS::kSuccess; }
MStatus clusterControledCurve::initialize() { MStatus status; MFnNumericAttribute nAttr; MFnMatrixAttribute mAttr; MFnTypedAttribute tAttr; MFnCompoundAttribute cAttr; aInputCurve = tAttr.create( "inputCurve", "inputCurve", MFnData::kNurbsCurve ); tAttr.setStorable( true ); CHECK_MSTATUS( addAttribute( aInputCurve ) ); aInputCurveMatrix = mAttr.create( "inputCurveMatrix", "inputCurveMatrix" ); mAttr.setStorable( true ); CHECK_MSTATUS( addAttribute( aInputCurveMatrix ) ); aDumyMatrix = mAttr.create( "dumyMatrix", "dumyMatrix" ); mAttr.setStorable( true ); CHECK_MSTATUS( addAttribute( aDumyMatrix ) ); aBindPreMatrix = mAttr.create( "bindPreMatrix", "bindPreMatrix" ); mAttr.setStorable( true ); mAttr.setArray( true ); nAttr.setUsesArrayDataBuilder( true ); CHECK_MSTATUS( addAttribute( aBindPreMatrix ) ); aMatrix = mAttr.create( "matrix", "matrix" ); mAttr.setStorable( true ); mAttr.setArray( true ); CHECK_MSTATUS( addAttribute( aMatrix ) ); aWeightList = cAttr.create( "weightList", "weightList" ); aWeights = nAttr.create( "weights", "weights", MFnNumericData::kFloat, 0.0 ); nAttr.setArray( true ); nAttr.setUsesArrayDataBuilder( true ); cAttr.addChild( aWeights ); cAttr.setArray( true ); cAttr.setStorable( true ); CHECK_MSTATUS( addAttribute( aWeightList ) ); aUpdate = nAttr.create( "update", "update", MFnNumericData::kBoolean, false ); nAttr.setStorable( true ); CHECK_MSTATUS( addAttribute( aUpdate ) ); aOutputCurve = tAttr.create( "outputCurve", "outputCurve", MFnData::kNurbsCurve ); CHECK_MSTATUS( addAttribute( aOutputCurve ) ); CHECK_MSTATUS( attributeAffects( aInputCurve, aOutputCurve ) ); CHECK_MSTATUS( attributeAffects( aInputCurveMatrix, aOutputCurve ) ); CHECK_MSTATUS( attributeAffects( aDumyMatrix, aOutputCurve ) ); CHECK_MSTATUS( attributeAffects( aBindPreMatrix, aOutputCurve ) ); CHECK_MSTATUS( attributeAffects( aMatrix, aOutputCurve ) ); CHECK_MSTATUS( attributeAffects( aWeightList, aOutputCurve ) ); CHECK_MSTATUS( attributeAffects( aUpdate, aOutputCurve ) ); return MS::kSuccess; }
MStatus sgHair_controlJoint::initialize() { MStatus status; MFnTypedAttribute tAttr; MFnMatrixAttribute mAttr; MFnMessageAttribute msgAttr; MFnNumericAttribute nAttr; MFnUnitAttribute uAttr; MFnCompoundAttribute cAttr; aInputBaseCurve = tAttr.create( "inputBaseCurve", "inputBaseCurve", MFnData::kNurbsCurve ); tAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputBaseCurve ) ); aInputBaseCurveMatrix = mAttr.create( "inputBaseCurveMatrix", "inputBaseCurveMatrix" ); mAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputBaseCurveMatrix ) ); aJointParentBaseMatrix = mAttr.create( "jointParentBaseMatrix", "jointParentBaseMatrix" ); mAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aJointParentBaseMatrix ) ); aGravityParam = nAttr.create( "gravityParam", "gravityParam", MFnNumericData::kDouble, 0.0 ); nAttr.setMin( 0.0 ); nAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGravityParam ) ); aGravityRange = nAttr.create( "gravityRange", "gravityRange", MFnNumericData::kDouble, 0.0 ); nAttr.setMin( 0.0 ); nAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGravityRange ) ); aGravityWeight = nAttr.create( "gravityWeight", "gravityWeight", MFnNumericData::kDouble, 0.0 ); nAttr.setMin( 0.0 ); nAttr.setMax( 1.0 ); nAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGravityWeight ) ); aGravityOffsetMatrix = mAttr.create( "gravityOffsetMatrix", "gravityOffsetMatrix" ); mAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGravityOffsetMatrix ) ); aStaticRotation = nAttr.create( "staticRotation", "staticRotation", MFnNumericData::kBoolean, false ); nAttr.setStorable( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aStaticRotation ) ); aOutput = cAttr.create( "output", "output" ); aOutTransX = nAttr.create( "outTransX", "otx", MFnNumericData::kDouble ); aOutTransY = nAttr.create( "outTransY", "oty", MFnNumericData::kDouble ); aOutTransZ = nAttr.create( "outTransZ", "otz", MFnNumericData::kDouble ); aOutTrans = nAttr.create( "outTrans", "ot", aOutTransX, aOutTransY, aOutTransZ ); aOutOrientX = uAttr.create( "outRotateX", "orx", MFnUnitAttribute::kAngle, 0.0 ); aOutOrientY = uAttr.create( "outRotateY", "ory", MFnUnitAttribute::kAngle, 0.0 ); aOutOrientZ = uAttr.create( "outRotateZ", "orz", MFnUnitAttribute::kAngle, 0.0 ); aOutOrient = nAttr.create( "outRotate", "outRotate", aOutOrientX, aOutOrientY, aOutOrientZ ); cAttr.addChild( aOutTrans ); cAttr.addChild( aOutOrient ); cAttr.setStorable( false ); cAttr.setArray( true ); cAttr.setUsesArrayDataBuilder( true ); CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutput ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGravityParam, aOutput ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGravityRange, aOutput ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGravityWeight, aOutput ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aJointParentBaseMatrix, aOutput ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGravityOffsetMatrix, aOutput ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputBaseCurve, aOutput ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputBaseCurveMatrix, aOutput ) ); CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aStaticRotation, aOutput ) ); return MS::kSuccess; }
// INIT ========================================= MStatus gear_slideCurve2::initialize() { MFnTypedAttribute tAttr; MFnMatrixAttribute mAttr; MFnNumericAttribute nAttr; MStatus stat; // INPUTS MESH master_crv = tAttr.create("master_crv", "mcrv", MFnData::kNurbsCurve); stat = addAttribute( master_crv ); if (!stat) {stat.perror("addAttribute"); return stat;} master_mat = mAttr.create( "master_mat", "mmat" ); mAttr.setStorable(true); mAttr.setReadable(false); stat = addAttribute( master_mat ); if (!stat) {stat.perror("addAttribute"); return stat;} // SLIDERS slave_length = nAttr.create("slave_length", "sl", MFnNumericData::kFloat, 1); nAttr.setStorable(true); nAttr.setKeyable(true); stat = addAttribute( slave_length ); if (!stat) {stat.perror("addAttribute"); return stat;} master_length = nAttr.create("master_length", "ml", MFnNumericData::kFloat, 1); nAttr.setStorable(true); nAttr.setKeyable(true); stat = addAttribute( master_length ); if (!stat) {stat.perror("addAttribute"); return stat;} position = nAttr.create("position", "p", MFnNumericData::kFloat, 0.0); nAttr.setStorable(true); nAttr.setKeyable(true); nAttr.setMin(0); nAttr.setMax(1); stat = addAttribute( position ); if (!stat) {stat.perror("addAttribute"); return stat;} maxstretch = nAttr.create("maxstretch", "mst", MFnNumericData::kFloat, 1.5); nAttr.setStorable(true); nAttr.setKeyable(true); nAttr.setMin(1); stat = addAttribute( maxstretch ); if (!stat) {stat.perror("addAttribute"); return stat;} maxsquash = nAttr.create("maxsquash", "msq", MFnNumericData::kFloat, .5); nAttr.setStorable(true); nAttr.setKeyable(true); nAttr.setMin(0); nAttr.setMax(1); stat = addAttribute( maxsquash ); if (!stat) {stat.perror("addAttribute"); return stat;} softness = nAttr.create("softness", "s", MFnNumericData::kFloat, 0.5); nAttr.setStorable(true); nAttr.setKeyable(true); nAttr.setMin(0); nAttr.setMax(1); stat = addAttribute( softness ); if (!stat) {stat.perror("addAttribute"); return stat;} // CONNECTIONS stat = attributeAffects( master_crv, outputGeom ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( master_mat, outputGeom ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( master_length, outputGeom ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( slave_length, outputGeom ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( position, outputGeom ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( maxstretch, outputGeom ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( maxsquash, outputGeom ); if (!stat) { stat.perror("attributeAffects"); return stat;} stat = attributeAffects( softness, outputGeom ); if (!stat) { stat.perror("attributeAffects"); return stat;} return MS::kSuccess; }
MStatus retargetLocator::initialize() { MFnNumericAttribute nAttr; MFnMatrixAttribute mAttr; MFnEnumAttribute eAttr; MFnUnitAttribute uAttr; MFnCompoundAttribute cAttr; MFnTypedAttribute tAttr; aOutput = nAttr.create( "output", "output", MFnNumericData::kDouble ); nAttr.setStorable( false ); CHECK_MSTATUS( addAttribute( aOutput ) ); aDiscMatrix = mAttr.create( "discMatrix", "discMatrix" ); mAttr.setStorable( true ); CHECK_MSTATUS( addAttribute( aDiscMatrix ) ); CHECK_MSTATUS( attributeAffects( aDiscMatrix, aOutput ) ); aDiscAxis = eAttr.create( "discAxis", "discAxis", 0 ); eAttr.addField( "X", 0 ); eAttr.addField( "Y", 1 ); eAttr.addField( "Z", 2 ); eAttr.setStorable( true ); eAttr.setChannelBox( true ); eAttr.setReadable( true ); CHECK_MSTATUS( addAttribute( aDiscAxis ) ); CHECK_MSTATUS( attributeAffects( aDiscAxis, aOutput ) ); aDiscDivision = nAttr.create( "discDivision", "discDivision", MFnNumericData::kInt, 32 ); nAttr.setMin( 1 ); nAttr.setMax( 32 ); nAttr.setStorable( true ); nAttr.setChannelBox( true ); CHECK_MSTATUS( addAttribute( aDiscDivision ) ); CHECK_MSTATUS( attributeAffects( aDiscDivision, aOutput ) ); aDiscAngle = uAttr.create( "discAngle", "discAngle", MFnUnitAttribute::kAngle, 0.0 ); uAttr.setStorable( true ); uAttr.setChannelBox( true ); CHECK_MSTATUS( addAttribute( aDiscAngle ) ); CHECK_MSTATUS( attributeAffects( aDiscAngle, aOutput ) ); aDiscOffsetX = nAttr.create( "discOffsetX", "discOffsetX", MFnNumericData::kDouble, 0.0 ); aDiscOffsetY = nAttr.create( "discOffsetY", "discOffsetY", MFnNumericData::kDouble, 0.0 ); aDiscOffsetZ = nAttr.create( "discOffsetZ", "discOffsetZ", MFnNumericData::kDouble, 0.0 ); aDiscOffset = nAttr.create( "discOffset", "discOffset", aDiscOffsetX, aDiscOffsetY, aDiscOffsetZ ); uAttr.setStorable( true ); uAttr.setChannelBox( true ); CHECK_MSTATUS( addAttribute( aDiscOffset ) ); CHECK_MSTATUS( attributeAffects( aDiscOffset, aOutput ) ); aDiscSizeX = nAttr.create( "discSizeX", "discSizeX", MFnNumericData::kDouble, 1.0 ); aDiscSizeY = nAttr.create( "discSizeY", "discSizeY", MFnNumericData::kDouble, 1.0 ); aDiscSizeZ = nAttr.create( "discSizeZ", "discSizeZ", MFnNumericData::kDouble, 1.0 ); aDiscSize = nAttr.create( "discSize", "discSize", aDiscSizeX, aDiscSizeY, aDiscSizeZ ); uAttr.setStorable( true ); uAttr.setChannelBox( true ); CHECK_MSTATUS( addAttribute( aDiscSize ) ); CHECK_MSTATUS( attributeAffects( aDiscSize, aOutput ) ); aDiscActiveColor = nAttr.createColor( "discActiveColor", "discActiveColor" ); nAttr.setStorable( true ); nAttr.setUsedAsColor(true); nAttr.setDefault(1.0f, 1.0f, 1.0f); CHECK_MSTATUS( addAttribute( aDiscActiveColor ) ); CHECK_MSTATUS( attributeAffects( aDiscActiveColor, aOutput ) ); aDiscLeadColor = nAttr.createColor( "discLeadColor", "discLeadColor" ); nAttr.setStorable( true ); nAttr.setUsedAsColor(true); nAttr.setDefault(.263f, 1.0f, .639f); CHECK_MSTATUS( addAttribute( aDiscLeadColor ) ); CHECK_MSTATUS( attributeAffects( aDiscLeadColor, aOutput ) ); aDiscDefaultColor = nAttr.createColor( "discDefaultColor", "discDefaultColor" ); nAttr.setStorable( true ); nAttr.setUsedAsColor(true); nAttr.setDefault(.0f, .016f, .376f); CHECK_MSTATUS( addAttribute( aDiscDefaultColor ) ); CHECK_MSTATUS( attributeAffects( aDiscDefaultColor, aOutput ) ); aDiscFillAlpha = nAttr.create( "discFillAlpha", "discFillAlpha", MFnNumericData::kFloat, 0.1f ); nAttr.setStorable( true ); nAttr.setMin( 0.0f ); nAttr.setMax( 1.0f ); CHECK_MSTATUS( addAttribute( aDiscFillAlpha ) ); CHECK_MSTATUS( attributeAffects( aDiscFillAlpha, aOutput ) ); aDiscLineAlpha = nAttr.create( "discLineAlpha", "discLineAlpha", MFnNumericData::kFloat, 1.0f ); nAttr.setStorable( true ); nAttr.setMin( 0.0f ); nAttr.setMax( 1.0f ); CHECK_MSTATUS( addAttribute( aDiscLineAlpha ) ); CHECK_MSTATUS( attributeAffects( aDiscLineAlpha, aOutput ) ); aArrow = cAttr.create( "arrow", "arrow" ); aInheritMatrix = nAttr.create( "inheritMatrix", "inheritMatrix", MFnNumericData::kBoolean, false ); aInputMesh = tAttr.create( "inputMesh", "inputMesh", MFnData::kMesh ); aAimMatrix = mAttr.create( "aimMatrix", "aimMatrix" ); aStartSize = nAttr.create( "startSize", "startSize", MFnNumericData::kFloat, 0.5f ); aSize = nAttr.create( "size", "size", MFnNumericData::kFloat, 1.0f ); aActiveColor = nAttr.createColor( "activeColor", "activeColor" ); nAttr.setUsedAsColor(true); nAttr.setDefault(1.0f, 1.0f, 1.0f); aLeadColor = nAttr.createColor( "leadColor", "leadColor" ); nAttr.setUsedAsColor(true); nAttr.setDefault(.263f, 1.0f, .639f); aDefaultColor = nAttr.createColor( "defaultColor", "defaultColor" ); nAttr.setUsedAsColor(true); nAttr.setDefault(.0f, .016f, .376f); aFillAlpha = nAttr.create( "fillAlpha", "fillAlpha", MFnNumericData::kFloat, 0.1f ); aLineAlpha = nAttr.create( "lineAlpha", "lineAlpha", MFnNumericData::kFloat, 1.0f ); aOffsetX = nAttr.create( "offsetX", "offsetX", MFnNumericData::kDouble, 0.0 ); aOffsetY = nAttr.create( "offsetY", "offsetY", MFnNumericData::kDouble, 0.0 ); aOffsetZ = nAttr.create( "offsetZ", "offsetZ", MFnNumericData::kDouble, 0.0 ); aOffset = nAttr.create( "offset", "offset", aOffsetX, aOffsetY, aOffsetZ ); cAttr.addChild( aInheritMatrix ); cAttr.addChild( aAimMatrix ); cAttr.addChild( aInputMesh ); cAttr.addChild( aStartSize ); cAttr.addChild( aSize ); cAttr.addChild( aActiveColor ); cAttr.addChild( aLeadColor ); cAttr.addChild( aDefaultColor ); cAttr.addChild( aFillAlpha ); cAttr.addChild( aLineAlpha ); cAttr.addChild( aOffset ); cAttr.setArray( true ); cAttr.setStorable( true ); CHECK_MSTATUS( addAttribute( aArrow ) ); CHECK_MSTATUS( attributeAffects( aArrow, aOutput ) ); return MS::kSuccess; }
// // DESCRIPTION: /////////////////////////////////////////////////////// MStatus Cell3D::initialize() { MFnMatrixAttribute mAttr; MFnNumericAttribute nAttr; // Input attributes aColorGain = nAttr.createColor("colorGain", "cg"); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setDefault(1.0f,1.0f,1.0f) ); aColorOffset = nAttr.createColor("colorOffset", "co"); MAKE_INPUT(nAttr); aPlaceMat = mAttr.create("placementMatrix", "pm", MFnMatrixAttribute::kFloat); MAKE_INPUT(mAttr); // Implicit shading network attributes aPointWorld = nAttr.createPoint("pointWorld", "pw"); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setHidden(true) ); // Create output attributes aOutF0 = nAttr.create( "F0", "f0", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); aOutF1 = nAttr.create( "F1", "f1", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); aOutN0 = nAttr.create( "N0", "n0", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); aOutBorderDist = nAttr.create("borderDistance", "bd", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); aOutColor = nAttr.createColor("outColor", "oc"); MAKE_OUTPUT(nAttr); aOutAlpha = nAttr.create( "outAlpha", "oa", MFnNumericData::kFloat); MAKE_OUTPUT(nAttr); // Add attributes to the node database. CHECK_MSTATUS( addAttribute(aColorGain) ); CHECK_MSTATUS( addAttribute(aColorOffset) ); CHECK_MSTATUS( addAttribute(aPointWorld) ); CHECK_MSTATUS( addAttribute(aPlaceMat) ); CHECK_MSTATUS( addAttribute(aOutAlpha) ); CHECK_MSTATUS( addAttribute(aOutColor) ); CHECK_MSTATUS( addAttribute(aOutF0) ); CHECK_MSTATUS( addAttribute(aOutF1) ); CHECK_MSTATUS( addAttribute(aOutN0) ); CHECK_MSTATUS( addAttribute(aOutBorderDist) ); // All input affect the output color and alpha CHECK_MSTATUS( attributeAffects (aColorGain, aOutColor) ); CHECK_MSTATUS( attributeAffects (aColorOffset, aOutColor) ); CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutColor) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutColor) ); CHECK_MSTATUS( attributeAffects (aColorGain, aOutAlpha) ); CHECK_MSTATUS( attributeAffects (aColorOffset, aOutAlpha) ); CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutAlpha) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutAlpha) ); // Geometry attribute affect all other outputs. CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutF0) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutF0) ); CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutF1) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutF1) ); CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutN0) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutN0) ); CHECK_MSTATUS( attributeAffects (aPlaceMat, aOutBorderDist) ); CHECK_MSTATUS( attributeAffects (aPointWorld, aOutBorderDist) ); return MS::kSuccess; }
MStatus LSSolverNode::initialize() { MFnNumericAttribute nAttr; MFnUnitAttribute uAttr; MFnTypedAttribute tAttr; MFnEnumAttribute eAttr; MFnMatrixAttribute mAttr; tetWorldMatrix = mAttr.create("tet_world_matrix","twm",MFnMatrixAttribute::kDouble,&returnStatus); McheckErr(returnStatus, "ERROR creating LSTetgenNode worldMatrix attribute\n"); MAKE_INPUT(mAttr); mAttr.setHidden(true); restShape = tAttr.create("restShape", "rs", MFnMeshData::kMesh, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode restShape attribute\n"); MAKE_INPUT(tAttr); restElements = tAttr.create("restElements", "re", MFnData::kIntArray, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode restShape attribute\n"); MAKE_INPUT(tAttr); restVertices = tAttr.create("restVertices", "rv", MFnData::kDoubleArray, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode restShape attribute\n"); MAKE_INPUT(tAttr); selectedConstraintVerts = tAttr.create("selectedConstraintVerts", "scv", MFnData::kIntArray, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode selectedConstraintVerts attribute\n"); MAKE_INPUT(tAttr); selectedForceVerts = tAttr.create("selectedForceVerts", "sfv", MFnData::kIntArray, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode selectedForceVerts attribute\n"); MAKE_INPUT(tAttr); time = uAttr.create("time", "t", MFnUnitAttribute::kTime,0.0, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode time attribute\n"); MAKE_INPUT(uAttr); deformed = tAttr.create("deformed", "d", MFnMeshData::kMesh, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode deformed attribute\n"); MAKE_OUTPUT(tAttr); poissonRatio = nAttr.create("poissonRatio", "pr", MFnNumericData::kDouble, 0.45, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode poisson ratio\n"); MAKE_INPUT(nAttr); nAttr.setMax(0.45); nAttr.setMin(0); youngsModulus = nAttr.create("youngsModulus", "ym", MFnNumericData::kDouble, 90000000000, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode youngsModulus\n"); MAKE_INPUT(nAttr); //nAttr.setMax(50000); //nAttr.setMin(1); objectDensity = nAttr.create("density", "objd", MFnNumericData::kDouble, 1000, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode objectDensity\n"); MAKE_INPUT(nAttr); nAttr.setMax(10000); nAttr.setMin(1); friction = nAttr.create("friction", "f", MFnNumericData::kDouble, 0.98, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode friction\n"); MAKE_INPUT(nAttr); nAttr.setMax(1); nAttr.setMin(0); restitution = nAttr.create("restitution", "r", MFnNumericData::kDouble, 0.4, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode restitution\n"); MAKE_INPUT(nAttr); nAttr.setMax(1); nAttr.setMin(0); damping = nAttr.create("damping", "dmp", MFnNumericData::kDouble, 0.0, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode damping\n"); MAKE_INPUT(nAttr); nAttr.setMax(1); nAttr.setMin(0); userSuppliedDt = nAttr.create("timeStep","ts",MFnNumericData::kDouble,0.01, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode userSuppliedDt\n"); MAKE_INPUT(nAttr); nAttr.setMax(1); nAttr.setMin(0.00001); forceApplicationTime = nAttr.create("forceApplicationTime", "fat", MFnNumericData::kInt, 50, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode forceApplicationTime ratio\n"); MAKE_INPUT(nAttr); forceReleasedTime = nAttr.create("forceReleasedTime", "frt", MFnNumericData::kInt, 100, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode forceReleasedTime ratio\n"); MAKE_INPUT(nAttr); forceIncrementTime = nAttr.create("forceIncrementTime", "fit", MFnNumericData::kInt, 10, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode forceIncrementTime ratio\n"); MAKE_INPUT(nAttr); forceStartTime = nAttr.create("forceStartTime", "fst", MFnNumericData::kInt,100, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode forceStartTime\n"); MAKE_INPUT(nAttr); forceStopTime = nAttr.create("forceStopTime", "fet", MFnNumericData::kInt, 200, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode forceStopTime\n"); MAKE_INPUT(nAttr); forceMagnitude = nAttr.create("forceMagnitude", "fm", MFnNumericData::kDouble, 10.0, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode forceIdleTime ratio\n"); MAKE_INPUT(nAttr); forceDirection = nAttr.create("forceDirection", "fd", MFnNumericData::k3Double, 0.0 , &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode forceIdleTime ratio\n"); MAKE_INPUT(nAttr); useSuppliedConstraints = nAttr.create("useSuppliedConstraints", "usc", MFnNumericData::kBoolean,1, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode useSuppliedConstraints ratio\n"); MAKE_INPUT(nAttr); useSuppliedForce = nAttr.create("useSuppliedForce", "usf", MFnNumericData::kBoolean, 0, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode useSuppliedForces ratio\n"); MAKE_INPUT(nAttr); integrationType = eAttr.create("timeIntegrationMethod","it",0,&returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode integrationType\n"); eAttr.addField("Implicit Backward Euler",0); eAttr.addField("Implicit Newmark",1); eAttr.addField("Central Differences",2); eAttr.addField("Symplectic Euler",3); MAKE_INPUT(eAttr); forceModelType = eAttr.create("system","ft",0,&returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode forceModelType\n"); eAttr.addField("Corotational Linear FEM",0); eAttr.addField("Mass Spring System",1); MAKE_INPUT(eAttr); contactKs = nAttr.create("contactSpringForce", "cKs", MFnNumericData::kDouble, 1000.0, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode contactSpringForces\n"); MAKE_INPUT(nAttr); contactKd = nAttr.create("contactDampForce", "cKd", MFnNumericData::kDouble, 50.0, &returnStatus); McheckErr(returnStatus, "ERROR creating LSSolverNode contactDampForces\n"); MAKE_INPUT(nAttr); returnStatus = addAttribute(tetWorldMatrix); McheckErr(returnStatus, "ERROR adding LSSolverNode world matrix attribute\n"); returnStatus = addAttribute(restShape); McheckErr(returnStatus, "ERROR adding LSSolverNode step attribute\n"); returnStatus = addAttribute(restElements); McheckErr(returnStatus, "ERROR adding LSSolverNode restElements attribute\n"); returnStatus = addAttribute(restVertices); McheckErr(returnStatus, "ERROR adding LSSolverNode restVertices attribute\n"); returnStatus = addAttribute(selectedConstraintVerts); McheckErr(returnStatus, "ERROR adding LSSolverNode selectedConstraintVerts attribute\n"); returnStatus = addAttribute(selectedForceVerts); McheckErr(returnStatus, "ERROR adding LSSolverNode selectedForceVerts attribute\n"); returnStatus = addAttribute(time); McheckErr(returnStatus, "ERROR adding LSSolverNode time attribute\n"); returnStatus = addAttribute(deformed); McheckErr(returnStatus, "ERROR adding LSSolverNode deformed attribute\n"); returnStatus = addAttribute(youngsModulus); McheckErr(returnStatus, "ERROR adding LSSolverNode youngsModulus\n"); returnStatus = addAttribute(poissonRatio); McheckErr(returnStatus, "ERROR adding LSSolverNode poissonRation\n"); returnStatus = addAttribute(objectDensity); McheckErr(returnStatus, "ERROR adding LSSolverNode objectDensity\n"); returnStatus = addAttribute(friction); McheckErr(returnStatus, "ERROR adding LSSolverNode friction\n"); returnStatus = addAttribute(restitution); McheckErr(returnStatus, "ERROR adding LSSolverNode resitution\n"); returnStatus = addAttribute(damping); McheckErr(returnStatus, "ERROR adding LSSolverNode damping\n"); returnStatus = addAttribute(userSuppliedDt); McheckErr(returnStatus, "ERROR adding LSSolverNode userSuppliedDt\n"); returnStatus = addAttribute(useSuppliedConstraints); McheckErr(returnStatus, "ERROR adding LSSolverNode useSuppliedConstraints\n"); returnStatus = addAttribute(useSuppliedForce); McheckErr(returnStatus, "ERROR adding LSSolverNode useSuppliedForce\n"); returnStatus = addAttribute(forceMagnitude); McheckErr(returnStatus, "ERROR adding LSSolverNode forceMagnitude\n"); returnStatus = addAttribute(forceDirection); McheckErr(returnStatus, "ERROR adding LSSolverNode forceDirection\n"); returnStatus = addAttribute(forceApplicationTime); McheckErr(returnStatus, "ERROR adding LSSolverNode forceApplicationTime\n"); returnStatus = addAttribute(forceReleasedTime); McheckErr(returnStatus, "ERROR adding LSSolverNode forceReleasedTime\n"); returnStatus = addAttribute(forceIncrementTime); McheckErr(returnStatus, "ERROR adding LSSolverNode forceIncrementTime\n"); returnStatus = addAttribute(forceStartTime); McheckErr(returnStatus, "ERROR adding LSSolverNode forceIdleTime\n"); returnStatus = addAttribute(forceStopTime); McheckErr(returnStatus, "ERROR adding LSSolverNode forceIdleTime\n"); // returnStatus = addAttribute(inputFilePath); // McheckErr(returnStatus, "ERROR adding LSSolverNode inputFilePath\n"); returnStatus = addAttribute(integrationType); McheckErr(returnStatus, "ERROR adding LSSolverNode integrationType\n"); returnStatus = addAttribute(forceModelType); McheckErr(returnStatus, "ERROR adding LSSolverNode forceModelType\n"); returnStatus = addAttribute(contactKd); McheckErr(returnStatus, "ERROR adding LSSolverNode contactKd\n"); returnStatus = addAttribute(contactKs); McheckErr(returnStatus, "ERROR adding LSSolverNode contactKs\n"); returnStatus = attributeAffects(restShape, deformed); McheckErr(returnStatus, "ERROR in attributeAffects: restShape - deformed\n"); returnStatus = attributeAffects(time, deformed); McheckErr(returnStatus, "ERROR in attributeAffects: time - deformed\n"); return MS::kSuccess; }
MStatus SurfaceAttach::initialize() { MFnTypedAttribute fnTypeAttr; MFnNumericAttribute fnNumAttr; MFnUnitAttribute fnUnitAttr; MFnCompoundAttribute fnCompoundAttr; MFnEnumAttribute fnEnumAttr; MFnMatrixAttribute fnMatAttr; MStatus stat; // Input Attributes direction = fnEnumAttr.create("direction", "dire", 0); fnEnumAttr.addField("U", 0); fnEnumAttr.addField("V", 1); surface = fnTypeAttr.create("surface", "surface", MFnData::kNurbsSurface); parentInverse = fnMatAttr.create("parentInverse", "ps", MFnMatrixAttribute::kDouble); fnMatAttr.setKeyable(true); samples = fnNumAttr.create("samples", "samples", MFnNumericData::kInt, 1000); fnNumAttr.setKeyable(true); fnNumAttr.setMin(1.0); staticLength = fnNumAttr.create("staticLength", "staticLength", MFnNumericData::kDouble, 0.0001); fnNumAttr.setKeyable(true); fnNumAttr.setMin(0.0001); offset = fnNumAttr.create("offset", "offset", MFnNumericData::kDouble, 0.0); fnNumAttr.setKeyable(true); genus = fnEnumAttr.create("type", "type", 0); fnEnumAttr.addField("Parametric", 0); fnEnumAttr.addField("Percentage", 1); fnEnumAttr.addField("FixedLength", 2); fnEnumAttr.setKeyable(true); reverse = fnNumAttr.create("reverse", "reverse", MFnNumericData::kBoolean, false); fnNumAttr.setKeyable(true); inU = fnNumAttr.create("inU", "U", MFnNumericData::kDouble, 0.5); fnNumAttr.setKeyable(true); inV = fnNumAttr.create("inV", "V", MFnNumericData::kDouble, 0.5); fnNumAttr.setKeyable(true); inUV = fnCompoundAttr.create("inUV", "inUV"); fnCompoundAttr.setKeyable(true); fnCompoundAttr.setArray(true); fnCompoundAttr.addChild(inU); fnCompoundAttr.addChild(inV); fnCompoundAttr.setUsesArrayDataBuilder(true); // Output Attributes translateX = fnNumAttr.create("translateX", "translateX", MFnNumericData::kDouble); fnNumAttr.setWritable(false); fnNumAttr.setStorable(false); translateY = fnNumAttr.create("translateY", "translateY", MFnNumericData::kDouble); fnNumAttr.setWritable(false); fnNumAttr.setStorable(false); translateZ = fnNumAttr.create("translateZ", "translateZ", MFnNumericData::kDouble); fnNumAttr.setWritable(false); fnNumAttr.setStorable(false); translate = fnNumAttr.create("translate", "translate", translateX, translateY, translateZ); fnNumAttr.setWritable(false); fnNumAttr.setStorable(false); rotateX = fnUnitAttr.create("rotateX", "rotateX", MFnUnitAttribute::kAngle); fnUnitAttr.setWritable(false); fnUnitAttr.setStorable(false); rotateY = fnUnitAttr.create("rotateY", "rotateY", MFnUnitAttribute::kAngle); fnUnitAttr.setWritable(false); fnUnitAttr.setStorable(false); rotateZ = fnUnitAttr.create("rotateZ", "rotateZ", MFnUnitAttribute::kAngle); fnUnitAttr.setWritable(false); fnUnitAttr.setStorable(false); rotate = fnNumAttr.create("rotate", "rotate", rotateX, rotateY, rotateZ); fnNumAttr.setWritable(false); out = fnCompoundAttr.create("out", "out"); fnCompoundAttr.setWritable(false); fnCompoundAttr.setArray(true); fnCompoundAttr.addChild(translate); fnCompoundAttr.addChild(rotate); fnCompoundAttr.setUsesArrayDataBuilder(true); // These aren't going to fail, give me a break :) // Add Attributes SurfaceAttach::addAttribute(direction); SurfaceAttach::addAttribute(surface); SurfaceAttach::addAttribute(parentInverse); SurfaceAttach::addAttribute(samples); SurfaceAttach::addAttribute(staticLength); SurfaceAttach::addAttribute(offset); SurfaceAttach::addAttribute(genus); SurfaceAttach::addAttribute(reverse); SurfaceAttach::addAttribute(inUV); SurfaceAttach::addAttribute(out); // Attribute Affects SurfaceAttach::attributeAffects(direction, translate); SurfaceAttach::attributeAffects(surface, translate); SurfaceAttach::attributeAffects(parentInverse, translate); SurfaceAttach::attributeAffects(staticLength, translate); SurfaceAttach::attributeAffects(samples, translate); SurfaceAttach::attributeAffects(offset, translate); SurfaceAttach::attributeAffects(genus, translate); SurfaceAttach::attributeAffects(reverse, translate); SurfaceAttach::attributeAffects(inU, translate); SurfaceAttach::attributeAffects(inV, translate); SurfaceAttach::attributeAffects(direction, rotate); SurfaceAttach::attributeAffects(surface, rotate); SurfaceAttach::attributeAffects(parentInverse, rotate); SurfaceAttach::attributeAffects(staticLength, rotate); SurfaceAttach::attributeAffects(samples, rotate); SurfaceAttach::attributeAffects(offset, rotate); SurfaceAttach::attributeAffects(genus, rotate); SurfaceAttach::attributeAffects(reverse, rotate); SurfaceAttach::attributeAffects(inU, rotate); SurfaceAttach::attributeAffects(inV, rotate); return MS::kSuccess; }
MStatus ProxyViz::initialize() { MFnNumericAttribute numFn; MStatus stat; alodgatehigh = numFn.create( "lodGateMax", "ldmx", MFnNumericData::kFloat, 1.f); numFn.setKeyable(true); numFn.setStorable(true); numFn.setMin(0.001f); numFn.setMax(2.f); addAttribute(alodgatehigh); alodgatelow = numFn.create( "lodGateMin", "ldmin", MFnNumericData::kFloat, 0.f); numFn.setKeyable(true); numFn.setStorable(true); numFn.setMin(0.f); numFn.setMax(0.999f); addAttribute(alodgatelow); abboxminx = numFn.create( "bBoxMinX", "bbmnx", MFnNumericData::kFloat, -1.f ); numFn.setKeyable(true); numFn.setStorable(true); addAttribute(abboxminx); abboxminy = numFn.create( "bBoxMinY", "bbmny", MFnNumericData::kFloat, -1.f ); numFn.setKeyable(true); numFn.setStorable(true); addAttribute(abboxminy); abboxminz = numFn.create( "bBoxMinZ", "bbmnz", MFnNumericData::kFloat, -1.f ); numFn.setKeyable(true); numFn.setStorable(true); addAttribute(abboxminz); abboxmaxx = numFn.create( "bBoxMaxX", "bbmxx", MFnNumericData::kFloat, 1.f ); numFn.setKeyable(true); numFn.setStorable(true); addAttribute(abboxmaxx); abboxmaxy = numFn.create( "bBoxMaxY", "bbmxy", MFnNumericData::kFloat, 1.f); numFn.setKeyable(true); numFn.setStorable(true); addAttribute(abboxmaxy); abboxmaxz = numFn.create( "bBoxMaxZ", "bbmxz", MFnNumericData::kFloat, 1.f); numFn.setKeyable(true); numFn.setStorable(true); addAttribute(abboxmaxz); aradiusMult = numFn.create( "radiusMultiplier", "rml", MFnNumericData::kFloat); numFn.setStorable(true); numFn.setKeyable(true); numFn.setDefault(1.f); numFn.setMin(.05f); addAttribute(aradiusMult); axmultiplier = numFn.create( "visualMultiplierX", "vmx", MFnNumericData::kFloat, 1.f); numFn.setKeyable(true); numFn.setStorable(true); numFn.setMin(0.001f); addAttribute(axmultiplier); aymultiplier = numFn.create( "visualMultiplierY", "vmy", MFnNumericData::kFloat, 1.f); numFn.setKeyable(true); numFn.setStorable(true); numFn.setMin(0.001f); addAttribute(aymultiplier); azmultiplier = numFn.create( "visualMultiplierZ", "vmz", MFnNumericData::kFloat, 1.f); numFn.setKeyable(true); numFn.setStorable(true); numFn.setMin(0.001f); addAttribute(azmultiplier); agroupcount = numFn.create( "numberInstances", "nis", MFnNumericData::kInt, 1); numFn.setKeyable(false); numFn.setStorable(true); numFn.setMin(1); addAttribute(agroupcount); ainstanceId = numFn.create( "instanceId", "iis", MFnNumericData::kInt, 0); numFn.setKeyable(false); numFn.setStorable(true); numFn.setMin(0); addAttribute(ainstanceId); MFnTypedAttribute typedAttrFn; MVectorArray defaultVectArray; MFnVectorArrayData vectArrayDataFn; vectArrayDataFn.create( defaultVectArray ); outPositionPP = typedAttrFn.create( "outPosition", "opos", MFnData::kVectorArray, vectArrayDataFn.object(), &stat ); if(!stat) MGlobal::displayWarning("failed create pospp"); typedAttrFn.setStorable(false); if(addAttribute( outPositionPP ) != MS::kSuccess) MGlobal::displayWarning("failed add pospp"); outScalePP = typedAttrFn.create( "outScale", "oscl", MFnData::kVectorArray, vectArrayDataFn.object(), &stat ); if(!stat) MGlobal::displayWarning("failed create sclpp"); typedAttrFn.setStorable(false); if(addAttribute(outScalePP) != MS::kSuccess) MGlobal::displayWarning("failed add sclpp"); outRotationPP = typedAttrFn.create( "outRotation", "orot", MFnData::kVectorArray, vectArrayDataFn.object(), &stat ); if(!stat) MGlobal::displayWarning("failed create rotpp"); typedAttrFn.setStorable(false); if(addAttribute(outRotationPP) != MS::kSuccess) MGlobal::displayWarning("failed add rotpp"); MDoubleArray defaultDArray; MFnDoubleArrayData dArrayDataFn; dArrayDataFn.create( defaultDArray ); outReplacePP = typedAttrFn.create( "outReplace", "orpl", MFnData::kDoubleArray, dArrayDataFn.object(), &stat ); if(stat != MS::kSuccess) { MGlobal::displayWarning("failed create outReplace"); } typedAttrFn.setStorable(false); stat = addAttribute(outReplacePP); if(stat != MS::kSuccess) { MGlobal::displayWarning("failed add outReplace"); } outValue = numFn.create( "outValue", "ov", MFnNumericData::kFloat ); numFn.setStorable(false); numFn.setWritable(false); addAttribute(outValue); outValue1 = numFn.create( "outValue1", "ov1", MFnNumericData::kFloat ); numFn.setStorable(false); numFn.setWritable(false); addAttribute(outValue1); MFnTypedAttribute stringAttr; acachename = stringAttr.create( "cachePath", "cp", MFnData::kString ); stringAttr.setStorable(true); addAttribute( acachename ); astandinNames = stringAttr.create( "standinNames", "sdn", MFnData::kString ); stringAttr.setStorable(true); stringAttr.setArray(true); addAttribute(astandinNames); MFnMatrixAttribute matAttr; acameraspace = matAttr.create( "cameraSpace", "cspc", MFnMatrixAttribute::kDouble ); matAttr.setStorable(false); matAttr.setWritable(true); matAttr.setConnectable(true); addAttribute(acameraspace); ahapeture = numFn.create( "horizontalFilmAperture", "hfa", MFnNumericData::kDouble, 1.0 ); numFn.setStorable(false); numFn.setConnectable(true); addAttribute( ahapeture ); avapeture = numFn.create( "verticalFilmAperture", "vfa", MFnNumericData::kDouble, 1.0 ); numFn.setStorable(false); numFn.setConnectable(true); addAttribute( avapeture ); afocallength = numFn.create( "focalLength", "fl", MFnNumericData::kDouble ); numFn.setStorable(false); numFn.setConnectable(true); addAttribute( afocallength ); aconvertPercentage = numFn.create( "convertPercentage", "cvp", MFnNumericData::kDouble ); numFn.setStorable(false); numFn.setConnectable(true); numFn.setDefault(1.0); numFn.setMax(1.0); numFn.setMin(0.01); addAttribute(aconvertPercentage); agroundMesh = typedAttrFn.create("groundMesh", "grdm", MFnMeshData::kMesh); typedAttrFn.setStorable(false); typedAttrFn.setWritable(true); typedAttrFn.setConnectable(true); typedAttrFn.setArray(true); typedAttrFn.setDisconnectBehavior(MFnAttribute::kDelete); addAttribute( agroundMesh ); attributeAffects(agroundMesh, outValue); agroundSpace = matAttr.create("groundSpace", "grdsp", MFnMatrixAttribute::kDouble); matAttr.setStorable(false); matAttr.setWritable(true); matAttr.setConnectable(true); matAttr.setArray(true); matAttr.setDisconnectBehavior(MFnAttribute::kDelete); addAttribute( agroundSpace ); attributeAffects(agroundSpace, outValue); MPointArray defaultPntArray; MFnPointArrayData pntArrayDataFn; pntArrayDataFn.create( defaultPntArray ); aplantTransformCache = typedAttrFn.create( "transformCachePlant", "tmcpl", MFnData::kPointArray, pntArrayDataFn.object(), &stat ); typedAttrFn.setStorable(true); addAttribute(aplantTransformCache); MIntArray defaultIntArray; MFnIntArrayData intArrayDataFn; intArrayDataFn.create( defaultIntArray ); aplantIdCache = typedAttrFn.create( "idCachePlant", "idcpl", MFnData::kIntArray, intArrayDataFn.object(), &stat ); typedAttrFn.setStorable(true); addAttribute(aplantIdCache); aplantTriangleIdCache = typedAttrFn.create( "triCachePlant", "trcpl", MFnData::kIntArray, intArrayDataFn.object(), &stat ); typedAttrFn.setStorable(true); addAttribute(aplantTriangleIdCache); aplantTriangleCoordCache = typedAttrFn.create( "coordCachePlant", "crcpl", MFnData::kVectorArray, vectArrayDataFn.object(), &stat ); typedAttrFn.setStorable(true); addAttribute(aplantTriangleCoordCache); aplantOffsetCache = typedAttrFn.create( "offsetCachePlant", "otcpl", MFnData::kVectorArray, vectArrayDataFn.object(), &stat ); typedAttrFn.setStorable(true); addAttribute(aplantOffsetCache); ainexamp = typedAttrFn.create("inExample", "ixmp", MFnData::kPlugin); typedAttrFn.setStorable(false); typedAttrFn.setConnectable(true); typedAttrFn.setArray(true); addAttribute(ainexamp); adisplayVox = numFn.create( "showVoxelThreshold", "svt", MFnNumericData::kFloat ); numFn.setDefault(1.0); numFn.setMin(.7); numFn.setMax(1.0); numFn.setStorable(true); numFn.setKeyable(true); addAttribute(adisplayVox); acheckDepth = numFn.create( "checkDepth", "cdp", MFnNumericData::kBoolean ); numFn.setDefault(0); numFn.setStorable(false); addAttribute(acheckDepth); ainoverscan = numFn.create( "cameraOverscan", "cos", MFnNumericData::kDouble ); numFn.setDefault(1.33); numFn.setStorable(false); addAttribute(ainoverscan); aactivated = numFn.create( "activated", "act", MFnNumericData::kBoolean ); numFn.setDefault(0); numFn.setStorable(false); addAttribute(aactivated); attributeAffects(ainexamp, outValue1); attributeAffects(aradiusMult, outValue1); attributeAffects(abboxminx, outValue); attributeAffects(abboxmaxx, outValue); attributeAffects(abboxminy, outValue); attributeAffects(abboxmaxy, outValue); attributeAffects(abboxminz, outValue); attributeAffects(abboxmaxz, outValue); attributeAffects(outPositionPP, outValue); return MS::kSuccess; }
/* static */ MStatus cgfxVector::initialize() { MStatus status; MFnNumericAttribute nAttr; MFnMatrixAttribute mAttr; sVectorX = nAttr.create("vectorX", "vx", MFnNumericData::kDouble, 0.0, &status); if (!status) { status.perror("cgfxVector: create vectorX"); return status; } nAttr.setKeyable(true); sVectorY = nAttr.create("vectorY", "vy", MFnNumericData::kDouble, 0.0, &status); if (!status) { status.perror("cgfxVector: create vectorY"); return status; } nAttr.setKeyable(true); sVectorZ = nAttr.create("vectorZ", "vz", MFnNumericData::kDouble, 0.0, &status); if (!status) { status.perror("cgfxVector: create vectorZ"); return status; } nAttr.setKeyable(true); sVector = nAttr.create("vector", "v", sVectorX, sVectorY, sVectorZ, &status); if (!status) { status.perror("cgfxVector: create vector"); return status; } nAttr.setKeyable(true); sIsDirection = nAttr.create("isDirection", "id", MFnNumericData::kBoolean, 0.0, &status); if (!status) { status.perror("cgfxVector: create isDirection"); return status; } nAttr.setKeyable(true); nAttr.setDefault(false); sMatrix = mAttr.create("matrix", "m", MFnMatrixAttribute::kDouble, &status); if (!status) { status.perror("cgfxVector: create matrix"); return status; } mAttr.setWritable(true); mAttr.setStorable(true); sWorldVectorX = nAttr.create("worldVectorX", "wvx", MFnNumericData::kFloat, 0.0, &status); if (!status) { status.perror("cgfxVector: create worldVectorX"); return status; } nAttr.setWritable(false); nAttr.setStorable(false); sWorldVectorY = nAttr.create("worldVectorY", "wvy", MFnNumericData::kFloat, 0.0, &status); if (!status) { status.perror("cgfxVector: create worldVectorY"); return status; } nAttr.setWritable(false); nAttr.setStorable(false); sWorldVectorZ = nAttr.create("worldVectorZ", "wvz", MFnNumericData::kFloat, 0.0, &status); if (!status) { status.perror("cgfxVector: create worldVectorZ"); return status; } nAttr.setWritable(false); nAttr.setStorable(false); sWorldVectorW = nAttr.create("worldVectorW", "wvw", MFnNumericData::kFloat, 0.0, &status); if (!status) { status.perror("cgfxVector: create worldVectorW"); return status; } nAttr.setWritable(false); nAttr.setStorable(false); sWorldVector = nAttr.create("worldVector", "wv", sWorldVectorX, sWorldVectorY, sWorldVectorZ, &status); if( !status ) { status.perror("cgfxVector: create worldVector"); return status; } nAttr.setWritable(false); nAttr.setStorable(false); status = addAttribute(sVector); if (!status) { status.perror("cgfxVector: addAttribute vector"); return status; } status = addAttribute(sIsDirection); if (!status) { status.perror("cgfxVector: addAttribute isDirection"); return status; } status = addAttribute(sMatrix); if (!status) { status.perror("cgfxVector: addAttribute matrix"); return status; } status = addAttribute(sWorldVector); if (!status) { status.perror("cgfxVector: addAttribute worldVector"); return status; } status = addAttribute(sWorldVectorW); if (!status) { status.perror("cgfxVector: addAttribute worldVectorW"); return status; } status = attributeAffects(sVector, sWorldVector); if (!status) { status.perror("cgfxVector: attributeAffects vector -> worldVector"); return status; } status = attributeAffects(sIsDirection, sWorldVector); if (!status) { status.perror("cgfxVector: attributeAffects isDirection -> worldVector"); return status; } status = attributeAffects(sMatrix, sWorldVector); if (!status) { status.perror("cgfxVector: attributeAffects matrix -> worldVector"); return status; } status = attributeAffects(sVector, sWorldVectorW); if (!status) { status.perror("cgfxVector: attributeAffects vector -> worldVectorW"); return status; } status = attributeAffects(sIsDirection, sWorldVectorW); if (!status) { status.perror("cgfxVector: attributeAffects isDirection -> worldVectorW"); return status; } status = attributeAffects(sMatrix, sWorldVectorW); if (!status) { status.perror("cgfxVector: attributeAffects matrix -> worldVectorW"); return status; } return MS::kSuccess; }
// initializes attribute information // call by MAYA when this plug-in was loded. // MStatus anisotropicShaderNode::initialize() { MFnNumericAttribute nAttr; MFnLightDataAttribute lAttr; MFnMatrixAttribute mAttr; aMatrixOToW = mAttr.create( "matrixObjectToWorld", "mow", MFnMatrixAttribute::kFloat ); CHECK_MSTATUS( mAttr.setStorable( false ) ); CHECK_MSTATUS( mAttr.setHidden( true ) ); aMatrixWToC = mAttr.create( "matrixWorldToEye", "mwc", MFnMatrixAttribute::kFloat ); CHECK_MSTATUS( mAttr.setStorable( false ) ); CHECK_MSTATUS( mAttr.setHidden( true ) ); aDiffuseReflectivity = nAttr.create( "diffuseReflectivity", "drfl", MFnNumericData::kFloat); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setDefault(0.8f) ); CHECK_MSTATUS( nAttr.setMin(0.0f) ); CHECK_MSTATUS( nAttr.setMax(1.0f) ); aColor = nAttr.createColor( "color", "c" ); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setDefault(0.0f, 0.58824f, 0.644f) ); aNormalCamera = nAttr.createPoint( "normalCamera", "n" ); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setHidden(true) ); aLightDirection = nAttr.createPoint( "lightDirection", "ld"); CHECK_MSTATUS ( nAttr.setStorable(false) ); CHECK_MSTATUS ( nAttr.setHidden(true) ); CHECK_MSTATUS ( nAttr.setReadable(true) ); CHECK_MSTATUS ( nAttr.setWritable(false) ); aLightIntensity = nAttr.createColor( "lightIntensity", "li" ); CHECK_MSTATUS ( nAttr.setStorable(false) ); CHECK_MSTATUS ( nAttr.setHidden(true) ); CHECK_MSTATUS ( nAttr.setReadable(true) ); CHECK_MSTATUS ( nAttr.setWritable(false) ); aLightAmbient = nAttr.create( "lightAmbient", "la", MFnNumericData::kBoolean); CHECK_MSTATUS ( nAttr.setStorable(false) ); CHECK_MSTATUS ( nAttr.setHidden(true) ); CHECK_MSTATUS ( nAttr.setReadable(true) ); CHECK_MSTATUS ( nAttr.setWritable(false) ); aLightDiffuse = nAttr.create( "lightDiffuse", "ldf", MFnNumericData::kBoolean); CHECK_MSTATUS ( nAttr.setStorable(false) ); CHECK_MSTATUS ( nAttr.setHidden(true) ); CHECK_MSTATUS ( nAttr.setReadable(true) ); CHECK_MSTATUS ( nAttr.setWritable(false) ); aLightSpecular = nAttr.create( "lightSpecular", "ls", MFnNumericData::kBoolean); CHECK_MSTATUS ( nAttr.setStorable(false) ); CHECK_MSTATUS ( nAttr.setHidden(true) ); CHECK_MSTATUS ( nAttr.setReadable(true) ); CHECK_MSTATUS ( nAttr.setWritable(false) ); aLightShadowFraction = nAttr.create( "lightShadowFraction", "lsf", MFnNumericData::kFloat); CHECK_MSTATUS ( nAttr.setStorable(false) ); CHECK_MSTATUS ( nAttr.setHidden(true) ); CHECK_MSTATUS ( nAttr.setReadable(true) ); CHECK_MSTATUS ( nAttr.setWritable(false) ); aPreShadowIntensity = nAttr.create( "preShadowIntensity", "psi", MFnNumericData::kFloat); CHECK_MSTATUS ( nAttr.setStorable(false) ); CHECK_MSTATUS ( nAttr.setHidden(true) ); CHECK_MSTATUS ( nAttr.setReadable(true) ); CHECK_MSTATUS ( nAttr.setWritable(false) ); aLightBlindData = nAttr.createAddr( "lightBlindData", "lbld"); CHECK_MSTATUS ( nAttr.setStorable(false) ); CHECK_MSTATUS ( nAttr.setHidden(true) ); CHECK_MSTATUS ( nAttr.setReadable(true) ); CHECK_MSTATUS ( nAttr.setWritable(false) ); aLightData = lAttr.create( "lightDataArray", "ltd", aLightDirection, aLightIntensity, aLightAmbient, aLightDiffuse, aLightSpecular, aLightShadowFraction, aPreShadowIntensity, aLightBlindData); CHECK_MSTATUS( lAttr.setArray(true) ); CHECK_MSTATUS( lAttr.setStorable(false) ); CHECK_MSTATUS( lAttr.setHidden(true) ); CHECK_MSTATUS( lAttr.setDefault(0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, true, true, false, 0.0f, 1.0f, NULL) ); aSpecularCoeff = nAttr.create( "specularCoeff", "scf", MFnNumericData::kFloat); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setMin(0.0f) ); CHECK_MSTATUS( nAttr.setMax(1.0f) ); CHECK_MSTATUS( nAttr.setDefault(0.8f) ); aPointCamera = nAttr.createPoint( "pointCamera", "pc" ); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setHidden(true) ); // input transparency aInTransparency = nAttr.createColor( "transparency", "it" ); MAKE_INPUT(nAttr); // ray direction aRayDirection = nAttr.createPoint( "rayDirection", "rd" ); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setHidden(true) ); // specular color aSpecColor = nAttr.createColor( "specularColor","sc" ); CHECK_MSTATUS( nAttr.setDefault( .5, .5, .5 ) ); MAKE_INPUT(nAttr); // anisotropic parameters // aRoughness1 = nAttr.create( "roughness1", "rn1", MFnNumericData::kFloat); CHECK_MSTATUS( nAttr.setMin(0.0f) ); CHECK_MSTATUS( nAttr.setMax(1.0f) ); CHECK_MSTATUS( nAttr.setDefault(0.2f) ); aRoughness2 = nAttr.create( "roughness2", "rn2", MFnNumericData::kFloat); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setMin(0.0f) ); CHECK_MSTATUS( nAttr.setMax(1.0f) ); CHECK_MSTATUS( nAttr.setDefault(0.4f) ); aAxesVector = nAttr.createPoint( "axesVector", "av" ); MAKE_INPUT(nAttr); CHECK_MSTATUS( nAttr.setDefault( 0.0f, 1.0f, 0.0f ) ); // output color aOutColor = nAttr.createColor( "outColor", "oc" ); MAKE_OUTPUT(nAttr); // output transparency aOutTransparency = nAttr.createColor( "outTransparency", "ot" ); MAKE_OUTPUT(nAttr); setAttribute(); return MS::kSuccess; }