本文整理汇总了C++中MFnEnumAttribute::setWritable方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnEnumAttribute::setWritable方法的具体用法?C++ MFnEnumAttribute::setWritable怎么用?C++ MFnEnumAttribute::setWritable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnEnumAttribute
的用法示例。
在下文中一共展示了MFnEnumAttribute::setWritable方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
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;
}
示例2: initialize
MStatus ModifyArrayNode::initialize()
{
MStatus status;
MFnTypedAttribute T;
MFnNumericAttribute N;
MFnEnumAttribute E;
aInput = T.create("input", "i", MFnData::kDoubleArray);
T.setKeyable(false);
T.setChannelBox(false);
T.setStorable(true);
T.setWritable(true);
aOperation = E.create("operation", "operation");
E.addField("No Operation", kNO_OP);
E.addField("Sort", kSORT);
E.addField("Absolute Value", kABS);
E.addField("Reflect Left", kREFLECT_LEFT);
E.addField("Reflect Right", kREFLECT_RIGHT);
E.setDefault(kNO_OP);
E.setKeyable(true);
E.setStorable(true);
E.setWritable(true);
aReverse = N.create("reverse", "rev", MFnNumericData::kBoolean);
N.setKeyable(true);
N.setChannelBox(true);
N.setStorable(true);
N.setWritable(true);
aOutput = T.create("output", "o", MFnData::kDoubleArray);
T.setKeyable(false);
T.setChannelBox(false);
T.setWritable(false);
T.setStorable(false);
addAttribute(aOperation);
addAttribute(aInput);
addAttribute(aReverse);
addAttribute(aOutput);
attributeAffects(aOperation, aOutput);
attributeAffects(aInput, aOutput);
attributeAffects(aReverse, aOutput);
return MS::kSuccess;
}
示例3: initialize
MStatus TestDeformer::initialize()
{
MFnNumericAttribute numericAttr;
MFnTypedAttribute polyMeshAttr;
MFnEnumAttribute enumAttr;
MStatus status; // Status will be used to hold the MStatus value
// vertSnapInput
driver_mesh = polyMeshAttr.create( "vertSnapInput", "vsnpin", MFnData::kMesh, &status );
CHECK_MSTATUS( status );
CHECK_MSTATUS( polyMeshAttr.setStorable( false ) );
CHECK_MSTATUS( polyMeshAttr.setArray(true) );
CHECK_MSTATUS( polyMeshAttr.setConnectable( true ) );
CHECK_MSTATUS( addAttribute(driver_mesh) );
CHECK_MSTATUS( attributeAffects(driver_mesh, outputGeom) );
// initialize is used to mark this node's state
initialized_data = enumAttr.create( "initialize", "inl", 0/*default*/, &status );
CHECK_MSTATUS( status );
CHECK_MSTATUS( enumAttr.addField( "Off", 0) );
CHECK_MSTATUS( enumAttr.addField( "Re-Set Bind", 1) );
CHECK_MSTATUS( enumAttr.addField( "Bound", 2) );
CHECK_MSTATUS( enumAttr.setKeyable(true) );
CHECK_MSTATUS( enumAttr.setStorable(true) );
CHECK_MSTATUS( enumAttr.setReadable(true) );
CHECK_MSTATUS( enumAttr.setWritable(true) );
CHECK_MSTATUS( enumAttr.setDefault(0) );
CHECK_MSTATUS( addAttribute( initialized_data ) );
CHECK_MSTATUS( attributeAffects( initialized_data, outputGeom ) );
// hold the vertex index mapping
vert_map = numericAttr.create( "vtxIndexMap", "vtximp", MFnNumericData::kLong, 0/*default*/, &status );
CHECK_MSTATUS( status );
CHECK_MSTATUS( numericAttr.setKeyable(false) );
CHECK_MSTATUS( numericAttr.setArray(true) );
CHECK_MSTATUS( numericAttr.setStorable(true) );
CHECK_MSTATUS( numericAttr.setReadable(true) );
CHECK_MSTATUS( numericAttr.setWritable(true) );
CHECK_MSTATUS( addAttribute( vert_map ) );
CHECK_MSTATUS( attributeAffects( vert_map, outputGeom ) );
CHECK_MSTATUS( MGlobal::executePythonCommand("import maya.cmds; maya.cmds.makePaintable('"+TestDeformer::cTypeName()+"', 'weights', attrType='multiFloat')") );
return( MS::kSuccess );
}
示例4: initialize
MStatus ReduceArrayNode::initialize()
{
MStatus status;
MFnTypedAttribute T;
MFnNumericAttribute N;
MFnEnumAttribute E;
aInput = T.create("input", "i", MFnData::kDoubleArray);
T.setKeyable(false);
T.setChannelBox(false);
T.setStorable(true);
T.setWritable(true);
aOutput = N.create("output", "o", MFnNumericData::kDouble, 0.0);
T.setKeyable(false);
T.setChannelBox(false);
T.setWritable(true);
T.setStorable(true);
aOperation = E.create("operation", "operation");
E.addField("No Operation", kNO_OP);
E.addField("Sum", kSUM);
E.addField("Difference", kDIFFERENCE);
E.addField("Average", kAVERAGE);
E.addField("Product", kPRODUCT);
E.addField("Quotient", kQUOTIENT);
E.addField("Exponent", kEXPONENT);
E.addField("Minimum", kMIN);
E.addField("Maximum", kMAX);
E.addField("Length", kLENGTH);
E.setKeyable(true);
E.setStorable(true);
E.setWritable(true);
addAttribute(aOperation);
addAttribute(aInput);
addAttribute(aOutput);
attributeAffects(aOperation, aOutput);
attributeAffects(aInput, aOutput);
return MS::kSuccess;
}
示例5: initialize
MStatus AlembicNode::initialize()
{
MStatus status;
MFnUnitAttribute uAttr;
MFnTypedAttribute tAttr;
MFnNumericAttribute nAttr;
MFnGenericAttribute gAttr;
MFnEnumAttribute eAttr;
// add the input attributes: time, file, sequence time
mTimeAttr = uAttr.create("time", "tm", MFnUnitAttribute::kTime, 0.0);
status = uAttr.setStorable(true);
status = addAttribute(mTimeAttr);
// input file name
MFnStringData fileFnStringData;
MObject fileNameDefaultObject = fileFnStringData.create("");
mAbcFileNameAttr = tAttr.create("abc_File", "fn",
MFnData::kString, fileNameDefaultObject);
status = tAttr.setStorable(true);
status = tAttr.setUsedAsFilename(true);
status = addAttribute(mAbcFileNameAttr);
// playback speed
mSpeedAttr = nAttr.create("speed", "sp",
MFnNumericData::kDouble, 1.0, &status);
status = nAttr.setWritable(true);
status = nAttr.setStorable(true);
status = nAttr.setKeyable(true);
status = addAttribute(mSpeedAttr);
// frame offset
mOffsetAttr = nAttr.create("offset", "of",
MFnNumericData::kDouble, 0, &status);
status = nAttr.setWritable(true);
status = nAttr.setStorable(true);
status = nAttr.setKeyable(true);
status = addAttribute(mOffsetAttr);
// cycle type
mCycleTypeAttr = eAttr.create("cycleType", "ct", 0, &status );
status = eAttr.addField("Hold", PLAYTYPE_HOLD);
status = eAttr.addField("Loop", PLAYTYPE_LOOP);
status = eAttr.addField("Reverse", PLAYTYPE_REVERSE);
status = eAttr.addField("Bounce", PLAYTYPE_BOUNCE);
status = eAttr.setWritable(true);
status = eAttr.setStorable(true);
status = eAttr.setKeyable(true);
status = addAttribute(mCycleTypeAttr);
// Regex Filter
// This is a hidden variable to preserve a regexIncludefilter string
// into a .ma file.
mIncludeFilterAttr = tAttr.create("regexIncludeFilter", "ift",
MFnData::kString);
status = tAttr.setStorable(true);
status = tAttr.setHidden(true);
status = addAttribute(mIncludeFilterAttr);
// Regex Filter
// This is a hidden variable to preserve a regexExcludefilter string
// into a .ma file.
mExcludeFilterAttr = tAttr.create("regexExcludeFilter", "eft",
MFnData::kString);
status = tAttr.setStorable(true);
status = tAttr.setHidden(true);
status = addAttribute(mExcludeFilterAttr);
// sequence min and max in frames
mStartFrameAttr = nAttr.create("startFrame", "sf",
MFnNumericData::kDouble, 0, &status);
status = nAttr.setWritable(false);
status = nAttr.setStorable(true);
status = addAttribute(mStartFrameAttr);
mEndFrameAttr = nAttr.create("endFrame", "ef",
MFnNumericData::kDouble, 0, &status);
status = nAttr.setWritable(false);
status = nAttr.setStorable(true);
status = addAttribute(mEndFrameAttr);
// add the output attributes
// sampled subD mesh
MFnMeshData fnMeshData;
MObject meshDefaultObject = fnMeshData.create(&status);
mOutSubDArrayAttr = tAttr.create("outSubDMesh", "osubd",
MFnData::kMesh, meshDefaultObject);
status = tAttr.setStorable(false);
status = tAttr.setWritable(false);
status = tAttr.setKeyable(false);
status = tAttr.setArray(true);
status = tAttr.setUsesArrayDataBuilder(true);
status = addAttribute(mOutSubDArrayAttr);
// sampled poly mesh
mOutPolyArrayAttr = tAttr.create("outPolyMesh", "opoly",
MFnData::kMesh, meshDefaultObject);
status = tAttr.setStorable(false);
status = tAttr.setWritable(false);
//.........这里部分代码省略.........
示例6: initialize
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;
}
示例7: MCHECKERR
// Create and Add Attributes
//
// 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
MayaPolySmooth::initialize() {
MStatus stat;
MFnCompoundAttribute cAttr;
MFnEnumAttribute eAttr;
MFnGenericAttribute gAttr;
MFnLightDataAttribute lAttr;
MFnMatrixAttribute mAttr;
MFnMessageAttribute msgAttr;
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
MFnUnitAttribute uAttr;
// MAYA_NODE_BUILDER:BEG [ATTRIBUTE CREATION] ==========
// a_inputPolymesh : This is a description for this attribute
a_inputPolymesh = tAttr.create("inputPolymesh", "ip", MFnData::kMesh, MObject::kNullObj, &stat);
MCHECKERR( stat, "cannot create MayaPolySmooth::inputPolymesh" );
stat = tAttr.setReadable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::inputPolymesh.setReadable()" );
stat = tAttr.setWritable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::inputPolymesh.setWritable()" );
stat = tAttr.setHidden(true);
MCHECKERR( stat, "cannot MayaPolySmooth::inputPolymesh.setHidden()" );
stat = addAttribute( a_inputPolymesh );
MCHECKERR( stat, "cannot MayaPolySmooth::addAttribute(a_inputPolymesh)" );
// a_output : This is a description for this attribute
a_output = tAttr.create("output", "out", MFnData::kMesh, MObject::kNullObj, &stat);
MCHECKERR( stat, "cannot create MayaPolySmooth::output" );
stat = tAttr.setReadable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::output.setReadable()" );
stat = tAttr.setWritable(false);
MCHECKERR( stat, "cannot MayaPolySmooth::output.setWritable()" );
stat = tAttr.setHidden(true);
MCHECKERR( stat, "cannot MayaPolySmooth::output.setHidden()" );
stat = addAttribute( a_output );
MCHECKERR( stat, "cannot MayaPolySmooth::addAttribute(a_output)" );
// a_subdivisionLevels : The number of recursive quad subdivisions to perform on each face.
a_subdivisionLevels = nAttr.create("subdivisionLevels", "sl", MFnNumericData::kInt, 0.0, &stat);
MCHECKERR( stat, "cannot create MayaPolySmooth::subdivisionLevels" );
stat = nAttr.setDefault(2);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setDefault(2)" );
stat = nAttr.setMin(0);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setMin(0)" );
stat = nAttr.setMax(10);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setMax(10)" );
stat = nAttr.setSoftMax(4);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setSoftMax(4)" );
stat = nAttr.setReadable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setReadable()" );
stat = nAttr.setWritable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setWritable()" );
stat = addAttribute( a_subdivisionLevels );
MCHECKERR( stat, "cannot MayaPolySmooth::addAttribute(a_subdivisionLevels)" );
// a_recommendedIsolation : The number of recursive quad subdivisions to perform on each face.
a_recommendedIsolation = nAttr.create("recommendedIsolation", "ri", MFnNumericData::kInt, 0.0, &stat);
MCHECKERR( stat, "cannot create MayaPolySmooth::recommendedIsolation" );
stat = nAttr.setDefault(2);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setDefault(0)" );
stat = nAttr.setMin(0);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setMin(0)" );
stat = nAttr.setMax(10);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setSoftMax(10)" );
stat = nAttr.setReadable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setReadable()" );
stat = nAttr.setWritable(false);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setWritable()" );
stat = nAttr.setHidden(false);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setHidden()" );
stat = addAttribute( a_recommendedIsolation );
MCHECKERR( stat, "cannot MayaPolySmooth::addAttribute(a_recommendedIsolation)" );
// a_vertBoundaryMethod : Controls how boundary edges and vertices are interpolated. <ul> <li>Smooth, Edges: Renderman: InterpolateBoundaryEdgeOnly</li> <li>Smooth, Edges and Corners: Renderman: InterpolateBoundaryEdgeAndCorner</li> </ul>
a_vertBoundaryMethod = eAttr.create("vertBoundaryMethod", "vbm", 0, &stat);
MCHECKERR( stat, "cannot create MayaPolySmooth::vertBoundaryMethod" );
stat = eAttr.addField("Interpolate Edges", k_BoundaryMethod_InterpolateBoundaryEdgeOnly);
MCHECKERR( stat, "cannot MayaPolySmooth::vertBoundaryMethod.addField(Interpolate Edges, k_BoundaryMethod_InterpolateBoundaryEdgeOnly)" );
stat = eAttr.addField("Interpolate Edges And Corners", k_BoundaryMethod_InterpolateBoundaryEdgeAndCorner);
MCHECKERR( stat, "cannot MayaPolySmooth::vertBoundaryMethod.addField(Interpolate Edges And Corners, k_BoundaryMethod_InterpolateBoundaryEdgeAndCorner)" );
stat = eAttr.setDefault(k_BoundaryMethod_InterpolateBoundaryEdgeOnly);
MCHECKERR( stat, "cannot MayaPolySmooth::vertBoundaryMethod.setDefault(k_BoundaryMethod_InterpolateBoundaryEdgeOnly)" );
stat = eAttr.setReadable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::vertBoundaryMethod.setReadable()" );
stat = eAttr.setWritable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::vertBoundaryMethod.setWritable()" );
//.........这里部分代码省略.........
示例8: initialize
MStatus VmIslandNode::initialize()
{
fprintf( stderr, "VmIslandNode::initialize()...\n" );
MStatus status;
//Seed attribute
{
MFnNumericAttribute numericAttrFn;
ia_seed = numericAttrFn.create( "seed", "sD", MFnNumericData::kLong, 0, & status );
CHECK_MSTATUS( status );
numericAttrFn.setReadable( true );
numericAttrFn.setWritable( true );
numericAttrFn.setStorable( true );
numericAttrFn.setKeyable( true );
numericAttrFn.setConnectable( true );
numericAttrFn.setHidden( false );
numericAttrFn.setMin( 0 );
numericAttrFn.setMax( 1000 );
numericAttrFn.setDefault ( 0 );
status = addAttribute( ia_seed );
CHECK_MSTATUS( status );
}
//Roughness attribute
{
MFnNumericAttribute numericAttrFn;
ia_roughness = numericAttrFn.create( "roughness", "rG", MFnNumericData::kFloat, 0, & status );
CHECK_MSTATUS( status );
numericAttrFn.setReadable( true );
numericAttrFn.setWritable( true );
numericAttrFn.setStorable( true );
numericAttrFn.setKeyable( true );
numericAttrFn.setConnectable( true );
numericAttrFn.setHidden( false );
numericAttrFn.setMin( 0 );
numericAttrFn.setMax( 1 );
numericAttrFn.setDefault ( 0.75 );
status = addAttribute( ia_roughness );
CHECK_MSTATUS( status );
}
//Plane Height attribute
{
MFnNumericAttribute numericAttrFn;
ia_planeHeight = numericAttrFn.create( "planeHeight", "pH", MFnNumericData::kLong, 0, & status );
CHECK_MSTATUS( status );
numericAttrFn.setReadable( true );
numericAttrFn.setWritable( true );
numericAttrFn.setStorable( true );
numericAttrFn.setKeyable( true );
numericAttrFn.setConnectable( true );
numericAttrFn.setHidden( false );
numericAttrFn.setMin( 0 );
numericAttrFn.setMax( 2000 );
numericAttrFn.setDefault ( 5 );
status = addAttribute( ia_planeHeight );
CHECK_MSTATUS( status );
}
//Plane smoothing attribute
{
MFnNumericAttribute numericAttrFn;
ia_smooth = numericAttrFn.create( "smoothingStrength", "sS", MFnNumericData::kLong, 0, & status );
CHECK_MSTATUS( status );
numericAttrFn.setReadable( true );
numericAttrFn.setWritable( true );
numericAttrFn.setStorable( true );
numericAttrFn.setKeyable( true );
numericAttrFn.setConnectable( true );
numericAttrFn.setHidden( false );
numericAttrFn.setMin( 0 );
numericAttrFn.setMax( 6 );
numericAttrFn.setDefault ( 1 );
status = addAttribute( ia_smooth );
CHECK_MSTATUS( status );
}
//Plane resolution attribute
{
MFnNumericAttribute numericAttrFn;
ia_resolution = numericAttrFn.create( "mayaResolution", "mR", MFnNumericData::kLong, 0, & status );
CHECK_MSTATUS( status );
numericAttrFn.setReadable( true );
numericAttrFn.setWritable( true );
numericAttrFn.setStorable( true );
numericAttrFn.setKeyable( true );
numericAttrFn.setConnectable( true );
numericAttrFn.setHidden( false );
numericAttrFn.setMin( 1 );
numericAttrFn.setMax( 10 );
numericAttrFn.setDefault ( 1 );
status = addAttribute( ia_resolution );
CHECK_MSTATUS( status );
}
//Renderman resolution attribute
{
MFnNumericAttribute numericAttrFn;
ia_rmanResolution = numericAttrFn.create( "rendermanResolution", "rR", MFnNumericData::kLong, 0, & status );
//.........这里部分代码省略.........