本文整理汇总了C++中MFnMatrixAttribute::setWritable方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnMatrixAttribute::setWritable方法的具体用法?C++ MFnMatrixAttribute::setWritable怎么用?C++ MFnMatrixAttribute::setWritable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnMatrixAttribute
的用法示例。
在下文中一共展示了MFnMatrixAttribute::setWritable方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
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;
}
示例2: initialize
/* 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;
//.........这里部分代码省略.........
示例3: initialize
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;
}
示例4: initialize
//.........这里部分代码省略.........
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);
示例5: initialize
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);
//.........这里部分代码省略.........
示例6: initialize
MStatus puttyNode::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnEnumAttribute eAttr;
MFnTypedAttribute tAttr;
MFnMatrixAttribute mAttr;
// the script
aScript = tAttr.create( "script", "scr", MFnData::kString);
tAttr.setStorable(true);
tAttr.setKeyable(false);
SYS_ERROR_CHECK( addAttribute( aScript ), "adding aScript" );
aCmdBaseName = tAttr.create( "cmdBaseName", "cbn", MFnData::kString);
tAttr.setStorable(true);
tAttr.setKeyable(false);
tAttr.setHidden(true);
SYS_ERROR_CHECK( addAttribute( aCmdBaseName ), "adding aCmdBaseName" );
// refresh
aSource = nAttr.create( "source", "src", MFnNumericData::kBoolean, 0 );
nAttr.setHidden(true);
SYS_ERROR_CHECK( addAttribute( aSource ), "adding aSource" );
// it is important that script sourced is initialised false and not storable
// so this way the function gets sourced on maya startup
aScriptSourced = nAttr.create( "scriptSourced", "ssrc", MFnNumericData::kBoolean, 0 );
nAttr.setStorable(false);
nAttr.setHidden(true);
SYS_ERROR_CHECK( addAttribute( aScriptSourced ), "adding aScriptSourced" );
aNodeReady = nAttr.create( "nodeReady", "nr", MFnNumericData::kBoolean, 0 );
nAttr.setHidden(true);
SYS_ERROR_CHECK( addAttribute( aNodeReady ), "adding aNodeReady" );
aDynDirty = nAttr.create( "dynDirty", "dd", MFnNumericData::kBoolean, 0 );
nAttr.setHidden(true);
SYS_ERROR_CHECK( addAttribute( aDynDirty ), "adding aDynDirty" );
// space
aDefSpace = eAttr.create("deformerSpace", "dsp", MSD_SPACE_OBJECT, &status);
eAttr.addField("object (default)", MSD_SPACE_OBJECT);
eAttr.addField("world (automatic conversion)", MSD_SPACE_WORLD);
eAttr.setKeyable(false);
eAttr.setStorable(true);
SYS_ERROR_CHECK( addAttribute( aDefSpace ), "adding aDefSpace" );
// envelope
aDefEnvelope = eAttr.create("deformerEnvelope", "de", MSD_ENVELOPE_AUTO, &status);
eAttr.addField("auto", MSD_ENVELOPE_AUTO);
eAttr.addField("user", MSD_ENVELOPE_USER);
eAttr.setKeyable(false);
eAttr.setStorable(true);
SYS_ERROR_CHECK( addAttribute( aDefEnvelope ), "adding aDefEnvelope" );
// weights
aDefWeights = eAttr.create("deformerWeights", "dw", MSD_WEIGHTS_AUTO, &status);
eAttr.addField("auto", MSD_WEIGHTS_AUTO);
eAttr.addField("user", MSD_WEIGHTS_USER);
eAttr.setKeyable(false);
eAttr.setStorable(true);
SYS_ERROR_CHECK( addAttribute( aDefWeights ), "adding aDefWeights" );
/////////////////////////////////////////////////////////////////////////////
// current values
aCurrPosition = tAttr.create( "currentPosition", "cpos", MFnData::kVectorArray);
tAttr.setStorable(false);
tAttr.setKeyable(false);
tAttr.setConnectable(false);
tAttr.setWritable(false);
SYS_ERROR_CHECK( addAttribute( aCurrPosition ), "adding aCurrPos" );
aCurrWeight = tAttr.create( "currentWeight", "cwgh", MFnData::kDoubleArray);
tAttr.setStorable(false);
tAttr.setKeyable(false);
tAttr.setConnectable(false);
tAttr.setWritable(false);
SYS_ERROR_CHECK( addAttribute( aCurrWeight ), "adding aCurrWeight" );
aCurrMultiIndex = nAttr.create("currentMultiIndex","cmi",MFnNumericData::kInt);
nAttr.setStorable(false);
nAttr.setKeyable(false);
nAttr.setConnectable(false);
nAttr.setWritable(false);
SYS_ERROR_CHECK( addAttribute( aCurrMultiIndex ), "adding aCurrMultiIndex" );
aCurrWorldMatrix = mAttr.create("currentWorldMatrix","cwm");
mAttr.setStorable(false);
mAttr.setKeyable(false);
mAttr.setConnectable(false);
mAttr.setWritable(false);
SYS_ERROR_CHECK( addAttribute( aCurrWorldMatrix ), "adding aCurrObjectName" );
/*
//.........这里部分代码省略.........
示例7: initialize
MStatus AimNode::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnMatrixAttribute mAttr;
MFnUnitAttribute uAttr;
aDriverMatrix = mAttr.create("driverMatrix", "dvm");
mAttr.setStorable(true);
mAttr.setKeyable(true);
mAttr.setWritable(true);
addAttribute(aDriverMatrix);
aUpVectorMatrix = mAttr.create("upVectorMatrix", "uvm");
mAttr.setStorable(true);
mAttr.setKeyable(true);
mAttr.setWritable(true);
addAttribute(aUpVectorMatrix);
//translateX
aInputTranslateX = nAttr.create("translateX", "tx", MFnNumericData::kDouble, 0);
nAttr.setStorable(true);
nAttr.setKeyable(true);
nAttr.setWritable(true);
addAttribute(aInputTranslateX);
//translateY
aInputTranslateY = nAttr.create("translateY", "ty", MFnNumericData::kDouble, 0);
nAttr.setStorable(true);
nAttr.setKeyable(true);
nAttr.setWritable(true);
addAttribute(aInputTranslateY);
//translateZ
aInputTranslateZ = nAttr.create("translateZ", "tz", MFnNumericData::kDouble, 0);
nAttr.setStorable(true);
nAttr.setKeyable(true);
nAttr.setWritable(true);
addAttribute(aInputTranslateZ);
//translate
aInputTranslate = nAttr.create("translate", "t", aInputTranslateX, aInputTranslateY, aInputTranslateZ);
addAttribute(aInputTranslate);
//rotateX
aOutputRotateX = uAttr.create("rotateX", "rx", MFnUnitAttribute::kAngle, 0);
nAttr.setStorable(true);
nAttr.setKeyable(true);
nAttr.setWritable(true);
addAttribute(aOutputRotateX);
//rotateY
aOutputRotateY = uAttr.create("rotateY", "ry", MFnUnitAttribute::kAngle, 0);
nAttr.setStorable(true);
nAttr.setKeyable(true);
nAttr.setWritable(true);
addAttribute(aOutputRotateY);
//rotateZ
aOutputRotateZ = uAttr.create("rotateZ", "rz", MFnUnitAttribute::kAngle, 0);
nAttr.setStorable(true);
nAttr.setKeyable(true);
nAttr.setWritable(true);
addAttribute(aOutputRotateZ);
//rotate
aOutputRotate = nAttr.create("rotate", "ro", aOutputRotateX, aOutputRotateY, aOutputRotateZ);
addAttribute(aOutputRotate);
//parent inverse matrix
aParentInverseMatrix = mAttr.create("parentInverse", "parinv");
mAttr.setDefault(MMatrix::identity);
addAttribute(aParentInverseMatrix);
attributeAffects(aParentInverseMatrix, aOutputRotate);
attributeAffects(aDriverMatrix, aOutputRotate);
attributeAffects(aUpVectorMatrix, aOutputRotate);
attributeAffects(aInputTranslate, aOutputRotate);
return MS::kSuccess;
}