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 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 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; }
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; }
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; }