本文整理汇总了C++中MFnEnumAttribute::setReadable方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnEnumAttribute::setReadable方法的具体用法?C++ MFnEnumAttribute::setReadable怎么用?C++ MFnEnumAttribute::setReadable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnEnumAttribute
的用法示例。
在下文中一共展示了MFnEnumAttribute::setReadable方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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 );
}
示例2: initialize
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 ) );
//.........这里部分代码省略.........
示例3: 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()" );
//.........这里部分代码省略.........
示例4: 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 );
//.........这里部分代码省略.........