MStatus updateTCCDataNode::initialize() // // Description: // This method is called to create and initialize all of the attributes // and attribute dependencies for this node type. This is only called // once when the node type is registered with Maya. // // Return Values: // MS::kSuccess // MS::kFailure // { MStatus status; MFnTypedAttribute attrFn; MFnNumericAttribute attrNum; MIntArray defaultArray; MFnIntArrayData defaultArrayDataFn; defaultArrayDataFn.create( defaultArray ); vtxRemap = attrFn.create("vtxRemap", "vR", MFnData::kIntArray, defaultArrayDataFn.object()); attrFn.setStorable(true); defaultArrayDataFn.create( defaultArray ); polyOrder = attrFn.create("polyOrder", "pO", MFnData::kIntArray, defaultArrayDataFn.object()); attrFn.setStorable(true); defaultArrayDataFn.create( defaultArray ); cShift = attrFn.create("cShift", "cS", MFnData::kIntArray, defaultArrayDataFn.object()); attrFn.setStorable(true); defaultArrayDataFn.create( defaultArray ); delta_F = attrFn.create("delta_F", "dF", MFnData::kIntArray, defaultArrayDataFn.object()); attrFn.setStorable(true); defaultArrayDataFn.create( defaultArray ); delta_nFV = attrFn.create("delta_nFV", "dnFV", MFnData::kIntArray, defaultArrayDataFn.object()); attrFn.setStorable(true); nV = attrNum.create("nV", "nV", MFnNumericData::kInt, 0.0); attrFn.setStorable(true); inMesh = attrFn.create("inMesh", "iM", MFnMeshData::kMesh); attrFn.setStorable(true); outMesh = attrFn.create("outMesh", "om", MFnMeshData::kMesh); attrFn.setStorable(false); attrFn.setWritable(false); status = addAttribute( vtxRemap ); MCheckStatus(status,"ERROR addAttribute"); status = addAttribute( polyOrder ); MCheckStatus(status,"ERROR addAttribute"); status = addAttribute( cShift ); MCheckStatus(status,"ERROR addAttribute"); status = addAttribute( delta_F ); MCheckStatus(status,"ERROR addAttribute"); status = addAttribute( delta_nFV ); MCheckStatus(status,"ERROR addAttribute"); status = addAttribute( nV ); MCheckStatus(status,"ERROR addAttribute"); status = addAttribute( inMesh ); MCheckStatus(status,"ERROR addAttribute"); status = addAttribute( outMesh); MCheckStatus(status,"ERROR addAttribute"); status = attributeAffects( inMesh, outMesh ); MCheckStatus(status,"ERROR attributeAffects"); status = attributeAffects( vtxRemap, outMesh ); MCheckStatus(status,"ERROR attributeAffects"); status = attributeAffects( polyOrder, outMesh ); MCheckStatus(status,"ERROR attributeAffects"); status = attributeAffects( cShift, outMesh ); MCheckStatus(status,"ERROR attributeAffects"); status = attributeAffects( delta_F, outMesh ); MCheckStatus(status,"ERROR attributeAffects"); status = attributeAffects( delta_nFV, outMesh ); MCheckStatus(status,"ERROR attributeAffects"); status = attributeAffects( nV, outMesh ); MCheckStatus(status,"ERROR attributeAffects"); return MS::kSuccess; }
MStatus TCC::initialize() { MFnNumericAttribute numAttr; MFnTypedAttribute attrFn; MFnIntArrayData defaultIArrayDataFn; MFnDoubleArrayData defaultDArrayDataFn; MStatus stat; aRes = numAttr.create( "SubdivisionResolution", "res", MFnNumericData::kInt, 3 ); aRefRes = numAttr.create( "SubdivisionRefinementResolution", "refres", MFnNumericData::kInt, 0 ); aLineThickness = numAttr.create( "UVLineThickness", "th", MFnNumericData::kFloat, 0 ); aInputMesh = attrFn.create("inputMesh", "inMesh", MFnMeshData::kMesh); defaultIArrayDataFn.create( ); anFVc = attrFn.create("nFVcached", "nFVc", MFnData::kIntArray, defaultIArrayDataFn.object()); attrFn.setConnectable(false); attrFn.setStorable(true); defaultIArrayDataFn.create( ); aFc = attrFn.create("Fcached", "Fc", MFnData::kIntArray, defaultIArrayDataFn.object()); attrFn.setConnectable(false); attrFn.setStorable(true); defaultIArrayDataFn.create( ); aPole = attrFn.create("pole", "pole", MFnData::kIntArray, defaultIArrayDataFn.object()); attrFn.setConnectable(false); attrFn.setStorable(true); defaultIArrayDataFn.create( ); aCorner = attrFn.create("corner", "corner", MFnData::kIntArray, defaultIArrayDataFn.object()); attrFn.setConnectable(false); attrFn.setStorable(true); defaultIArrayDataFn.create( ); aT = attrFn.create("T", "T", MFnData::kIntArray, defaultIArrayDataFn.object()); attrFn.setConnectable(false); attrFn.setStorable(true); defaultIArrayDataFn.create( ); aEqc = attrFn.create("eqc", "eqc", MFnData::kIntArray, defaultIArrayDataFn.object()); attrFn.setConnectable(false); attrFn.setStorable(true); defaultDArrayDataFn.create( ); aItv = attrFn.create("itv", "itv", MFnData::kDoubleArray, defaultDArrayDataFn.object()); attrFn.setConnectable(false); attrFn.setStorable(true); defaultIArrayDataFn.create( ); aErr = attrFn.create("err", "err", MFnData::kIntArray, defaultIArrayDataFn.object()); attrFn.setConnectable(false); attrFn.setStorable(true); aOutputMesh = attrFn.create( "outputMesh", "out", MFnData::kMesh); attrFn.setStorable(false); attrFn.setWritable(false); stat = addAttribute(aRes); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(aRefRes); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(aLineThickness); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(aInputMesh); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(anFVc); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(aFc); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(aPole); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(aCorner); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(aT); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(aEqc); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(aItv); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(aErr); McheckErr(stat, "ERROR adding attribute\n"); stat = addAttribute(aOutputMesh); McheckErr(stat, "ERROR adding attribute\n"); stat = attributeAffects(aRes, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); stat = attributeAffects(aRefRes, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); stat = attributeAffects(aLineThickness, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); stat = attributeAffects(aInputMesh, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); stat = attributeAffects(anFVc, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); stat = attributeAffects(aFc, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); stat = attributeAffects(aPole, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); stat = attributeAffects(aCorner, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); stat = attributeAffects(aT, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); stat = attributeAffects(aEqc, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); stat = attributeAffects(aItv, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); stat = attributeAffects(aErr, aOutputMesh); McheckErr(stat, "ERROR in attributeAffects\n"); 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; }
MStatus SargassoNode::initialize() { MFnNumericAttribute nAttr; MStatus status; MFnTypedAttribute typedAttr; MFnMatrixAttribute pimAttr; aconstraintParentInverseMatrix = pimAttr.create( "constraintParentInvMat", "cpim", MFnMatrixAttribute::kDouble, &status ); pimAttr.setArray(true); pimAttr.setStorable(false); pimAttr.setDisconnectBehavior(MFnAttribute::kDelete); status = addAttribute(aconstraintParentInverseMatrix); if (!status) { status.perror("addAttribute parent inverse matrix"); return status;} MFnNumericAttribute numAttr; constraintTranslateX = numAttr.create( "constraintTranslateX", "ctx", MFnNumericData::kDouble, 0.0, &status ); if(!status) { MGlobal::displayInfo("failed to create attrib constraintTranslateX"); return status; } constraintTranslateY = numAttr.create( "constraintTranslateY", "cty", MFnNumericData::kDouble, 0.0, &status ); if(!status) { MGlobal::displayInfo("failed to create attrib constraintTranslateY"); return status; } constraintTranslateZ = numAttr.create( "constraintTranslateZ", "ctz", MFnNumericData::kDouble, 0.0, &status ); if(!status) { MGlobal::displayInfo("failed to create attrib constraintTranslateY"); return status; } MFnUnitAttribute angleAttr; constraintRotateX = angleAttr.create( "constraintRotateX", "crx", MFnUnitAttribute::kAngle , 0.0, &status ); if(!status) { MGlobal::displayInfo("failed to create attrib constraintRotateX"); return status; } constraintRotateY = angleAttr.create( "constraintRotateY", "cry", MFnUnitAttribute::kAngle , 0.0, &status ); if(!status) { MGlobal::displayInfo("failed to create attrib constraintRotateY"); return status; } constraintRotateZ = angleAttr.create( "constraintRotateZ", "crz", MFnUnitAttribute::kAngle , 0.0, &status ); if(!status) { MGlobal::displayInfo("failed to create attrib constraintRotateY"); return status; } { // Compound target(geometry,weight): array, delete on disconnect MFnCompoundAttribute compoundAttr; compoundOutput = compoundAttr.create( "outValue", "otv",&status ); if (!status) { status.perror("compoundAttr.create"); return status;} status = compoundAttr.addChild( constraintTranslateX ); if (!status) { status.perror("compoundAttr.addChild tx"); return status;} status = compoundAttr.addChild( constraintTranslateY ); if (!status) { status.perror("compoundAttr.addChild ty"); return status;} status = compoundAttr.addChild( constraintTranslateZ ); if (!status) { status.perror("compoundAttr.addChild tz"); return status;} compoundAttr.addChild( constraintRotateX ); compoundAttr.addChild( constraintRotateY ); compoundAttr.addChild( constraintRotateZ ); compoundAttr.setArray( true ); //status = compoundAttr.setDisconnectBehavior(MFnAttribute::kDelete); //if (!status) { status.perror("typedAttrKeyable.setDisconnectBehavior:cgeom"); return status;} } status = addAttribute( compoundOutput ); if (!status) { status.perror("addAttribute"); return status;} MPointArray defaultPntArray; MFnPointArrayData pntArrayDataFn; pntArrayDataFn.create( defaultPntArray ); atargetRestP = typedAttr.create( "targetRestP", "tgrp", MFnData::kPointArray, pntArrayDataFn.object()); typedAttr.setStorable(true); addAttribute(atargetRestP); MIntArray defaultIntArray; MFnIntArrayData intArrayDataFn; intArrayDataFn.create( defaultIntArray ); atargetTri = typedAttr.create( "targetTriangle", "tgtri", MFnData::kIntArray, intArrayDataFn.object()); typedAttr.setStorable(true); addAttribute(atargetTri); atargetBind = typedAttr.create( "targetBindId", "tgbdi", MFnData::kIntArray, intArrayDataFn.object()); typedAttr.setStorable(true); addAttribute(atargetBind); aobjTri = typedAttr.create( "objectTriId", "obti", MFnData::kIntArray, intArrayDataFn.object()); typedAttr.setStorable(true); addAttribute(aobjTri); atargetNv = numAttr.create( "targetNumV", "tgnv", MFnNumericData::kInt, 0, &status ); addAttribute(atargetNv); atargetNt = numAttr.create( "targetNumTri", "tgnt", MFnNumericData::kInt, 0, &status ); addAttribute(atargetNt); MVectorArray defaultVectArray; MFnVectorArrayData vectArrayDataFn; vectArrayDataFn.create( defaultVectArray ); aobjLocal = typedAttr.create( "objectLocalP", "oblp", MFnData::kVectorArray, vectArrayDataFn.object()); typedAttr.setStorable(true); addAttribute(aobjLocal); aobjN = numAttr.create( "objectCount", "obct", MFnNumericData::kInt, 0, &status ); addAttribute(aobjN); atargetMesh = typedAttr.create("targetMesh", "tgms", MFnMeshData::kMesh, &status); typedAttr.setStorable(false); addAttribute(atargetMesh); attributeAffects(atargetMesh, compoundOutput); // attributeAffects(aconstraintParentInverseMatrix, compoundOutput); return MS::kSuccess; }