本文整理汇总了C++中MFnTypedAttribute::setCached方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnTypedAttribute::setCached方法的具体用法?C++ MFnTypedAttribute::setCached怎么用?C++ MFnTypedAttribute::setCached使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnTypedAttribute
的用法示例。
在下文中一共展示了MFnTypedAttribute::setCached方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
MStatus inverseSkinCluster::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnMatrixAttribute mAttr;
MFnMessageAttribute msgAttr;
MFnTypedAttribute tAttr;
aInMesh = tAttr.create( "inMesh", "inMesh", MFnData::kMesh );
tAttr.setStorable( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInMesh ) );
aGeomMatrix = mAttr.create( "geomMatrix", "geomMatrix" );
tAttr.setCached( false );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aGeomMatrix ) );
aMatrix = mAttr.create( "matrix", "matrix" );
mAttr.setArray( true );
mAttr.setStorable( true );
mAttr.setUsesArrayDataBuilder( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aMatrix ) );
aBindPreMatrix = mAttr.create( "bindPreMatrix", "bindPreMatrix" );
mAttr.setArray( true );
mAttr.setStorable( true );
mAttr.setUsesArrayDataBuilder( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aBindPreMatrix ) );
aUpdateMatrix = nAttr.create( "updateMatrix", "updateMatrix", MFnNumericData::kBoolean, false );
nAttr.setStorable( false );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aUpdateMatrix ) );
aTargetSkinCluster = msgAttr.create( "targetSkinCluster", "targetSkinCluster" );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aTargetSkinCluster ) );
aUpdateWeightList = nAttr.create( "updateWeightList", "updateWeightList", MFnNumericData::kBoolean, false );
nAttr.setStorable( false );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aUpdateWeightList ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInMesh, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aGeomMatrix, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aMatrix, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aBindPreMatrix, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aUpdateMatrix, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aUpdateWeightList, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aTargetSkinCluster, outputGeom ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aMatrix, outputGeom ) );
return MS::kSuccess;
}
示例2: initialize
MStatus sgMeshIntersect::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
MFnMatrixAttribute mAttr;
aPointSourceX = nAttr.create( "pointSourceX", "psx", MFnNumericData::kDouble, 0.0 );
aPointSourceY = nAttr.create( "pointSourceY", "psy", MFnNumericData::kDouble, 0.0 );
aPointSourceZ = nAttr.create( "pointSourceZ", "psz", MFnNumericData::kDouble, 0.0 );
aPointSource = nAttr.create( "pointSource", "ps", aPointSourceX, aPointSourceY, aPointSourceZ );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aPointSource ) );
aPointDestX = nAttr.create( "pointDestX", "pdx", MFnNumericData::kDouble, 0.0 );
aPointDestY = nAttr.create( "pointDestY", "pdy", MFnNumericData::kDouble, 0.0 );
aPointDestZ = nAttr.create( "pointDestZ", "pdz", MFnNumericData::kDouble, 0.0 );
aPointDest = nAttr.create( "pointDest", "pd", aPointDestX, aPointDestY, aPointDestZ );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aPointDest ) );
aInputMesh = tAttr.create( "inputMesh", "inMesh", MFnData::kMesh );
tAttr.setCached( false );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMesh ) );
aInputMeshMatrix = mAttr.create( "inputMeshMatrix", "inMatrix" );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMeshMatrix ) );
aParentInverseMatrix = mAttr.create( "parentInverseMatrix", "pim" );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aParentInverseMatrix ) );
aOutPointX = nAttr.create( "outPointX", "opx", MFnNumericData::kDouble, 0.0 );
aOutPointY = nAttr.create( "outPointY", "opy", MFnNumericData::kDouble, 0.0 );
aOutPointZ = nAttr.create( "outPointZ", "opz", MFnNumericData::kDouble, 0.0 );
aOutPoint = nAttr.create( "outPoint", "op", aOutPointX, aOutPointY, aOutPointZ );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutPoint ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aPointSource, aOutPoint ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aPointDest, aOutPoint ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMesh, aOutPoint ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMeshMatrix, aOutPoint ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aParentInverseMatrix, aOutPoint ) );
m_nodeNumber = 0;
return MS::kSuccess;
}
示例3: initialize
MStatus matrixFromPolygon::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnMatrixAttribute mAttr;
MFnTypedAttribute tAttr;
aOutputMatrix = mAttr.create( "outputMatrix", "outputMatrix" );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutputMatrix ) );
aInputMesh = tAttr.create( "inputMesh", "inputMesh", MFnData::kMesh );
tAttr.setStorable( true );
tAttr.setCached( false );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMesh ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMesh, aOutputMatrix ) );
aInputMeshMatrix = mAttr.create( "inputMeshMatrix", "inputMeshMatrix" );
mAttr.setStorable( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMeshMatrix ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMeshMatrix, aOutputMatrix ) );
aPolygonIndex = nAttr.create( "polygonIndex", "polygonIndex", MFnNumericData::kInt, 0 );
nAttr.setStorable( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aPolygonIndex ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aPolygonIndex, aOutputMatrix ) );
aU = nAttr.create( "u", "u", MFnNumericData::kDouble, 0.5 );
nAttr.setStorable( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aU ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aU, aOutputMatrix ) );
aV = nAttr.create( "v", "v", MFnNumericData::kDouble, 0.5 );
nAttr.setStorable( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aV ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aV, aOutputMatrix ) );
return MS::kSuccess;
}
示例4: createAttribute
//---------------------------------------------------
MObject DagHelper::createAttribute (
const MObject& node,
const char* attributeName,
const char* attributeShortName,
MFnData::Type type,
const char *value )
{
// Before creating a new attribute: verify that an old one doesn't already exist
MStatus status;
MObject attribute;
MFnDependencyNode nodeFn ( node );
MPlug plug = nodeFn.findPlug ( attributeShortName, status );
if ( status != MStatus::kSuccess )
{
MFnTypedAttribute attr;
MStatus status;
attribute = attr.create ( attributeName,attributeShortName,type,&status );
if ( status != MStatus::kSuccess ) return MObject::kNullObj;
attr.setStorable ( true );
attr.setKeyable ( false );
attr.setCached ( true );
attr.setReadable ( true );
attr.setWritable ( true );
status = nodeFn.addAttribute ( attribute, MFnDependencyNode::kLocalDynamicAttr );
if ( status != MStatus::kSuccess ) return MObject::kNullObj;
plug = nodeFn.findPlug ( attribute, &status );
if ( status != MStatus::kSuccess ) return MObject::kNullObj;
}
status = plug.setValue ( value );
if ( status != MStatus::kSuccess ) return MObject::kNullObj;
return attribute;
}
示例5: initialize
MStatus pointOnSubd::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 stat;
MFnTypedAttribute subdAttr;
aSubd = subdAttr.create( "subd", "s", MFnSubdData::kSubdSurface, &stat );
McheckErr( stat, "cannot create pointOnSubd::aSubd" );
subdAttr.setStorable(true);
subdAttr.setKeyable(false);
subdAttr.setReadable( true );
subdAttr.setWritable( true );
subdAttr.setCached( false );
stat = addAttribute( pointOnSubd::aSubd );
McheckErr( stat, "cannot add pointOnSubd::aSubd" );
MFnNumericAttribute faceFirstAttr;
aFaceFirst = faceFirstAttr.create( "faceFirst", "ff",
MFnNumericData::kLong, 0, &stat );
McheckErr( stat, "cannot create pointOnSubd::aFaceFirst" );
faceFirstAttr.setStorable(true);
faceFirstAttr.setKeyable(true);
faceFirstAttr.setSoftMin( 0.0 );
faceFirstAttr.setReadable( true );
faceFirstAttr.setWritable( true );
faceFirstAttr.setCached( false );
stat = addAttribute( pointOnSubd::aFaceFirst );
McheckErr( stat, "cannot add pointOnSubd::aFaceFirst" );
MFnNumericAttribute faceSecondAttr;
aFaceSecond = faceSecondAttr.create( "faceSecond", "fs",
MFnNumericData::kLong, 0, &stat );
McheckErr( stat, "cannot create pointOnSubd::aFaceSecond" );
faceSecondAttr.setStorable(true);
faceSecondAttr.setKeyable(true);
faceSecondAttr.setSoftMin( 0.0 );
faceSecondAttr.setReadable( true );
faceSecondAttr.setWritable( true );
faceSecondAttr.setCached( false );
stat = addAttribute( pointOnSubd::aFaceSecond );
McheckErr( stat, "cannot add pointOnSubd::aFaceSecond" );
MFnNumericAttribute uAttr;
aU = uAttr.create( "uValue", "u", MFnNumericData::kDouble,
0, &stat );
McheckErr( stat, "cannot create pointOnSubd::aU" );
uAttr.setStorable(true);
uAttr.setKeyable(true);
uAttr.setSoftMin( 0.0 );
uAttr.setSoftMax( 1.0 );
uAttr.setReadable( true );
uAttr.setWritable( true );
uAttr.setCached( false );
stat = addAttribute( aU );
McheckErr( stat, "cannot add pointOnSubd::aU" );
MFnNumericAttribute vAttr;
aV = vAttr.create( "vValue", "v", MFnNumericData::kDouble,
0, &stat );
McheckErr( stat, "cannot create pointOnSubd::aV" );
vAttr.setStorable(true);
vAttr.setKeyable(true);
vAttr.setSoftMin( 0.0 );
vAttr.setSoftMax( 1.0 );
vAttr.setReadable( true );
vAttr.setWritable( true );
vAttr.setCached( false );
stat = addAttribute( aV );
McheckErr( stat, "cannot add pointOnSubd::aV" );
MFnNumericAttribute relAttr;
aRelativeUV = relAttr.create( "relative", "rel", MFnNumericData::kBoolean,
0, &stat );
McheckErr( stat, "cannot create pointOnSubd::aRelativeUV" );
relAttr.setStorable(true);
relAttr.setKeyable(true);
relAttr.setSoftMin( 0.0 );
relAttr.setSoftMax( 1.0 );
relAttr.setReadable( true );
relAttr.setWritable( true );
relAttr.setCached( false );
stat = addAttribute( pointOnSubd::aRelativeUV );
McheckErr( stat, "cannot add pointOnSubd::aRelativeUV" );
MFnNumericAttribute pointXAttr;
aPointX = pointXAttr.create( "pointX", "px", MFnNumericData::kDouble,
0.0, &stat );
McheckErr( stat, "cannot create pointOnSubd::aPointX" );
pointXAttr.setWritable(false);
pointXAttr.setStorable(false);
pointXAttr.setReadable( true );
//.........这里部分代码省略.........
示例6: initialize
// The initialize routine is called after the node has been created.
// It sets up the input and output attributes and adds them to the node.
// Finally the dependencies are arranged so that when the inputs
// change Maya knowns to call compute to recalculate the output values.
//
MStatus hwColorPerVertexShader::initialize()
{
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
MStatus status;
// Create input attributes.
// All attributes are cached internal
//
aColorGain = nAttr.createColor( "colorGain", "cg", &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( nAttr.setStorable(true));
CHECK_MSTATUS( nAttr.setKeyable(true));
CHECK_MSTATUS( nAttr.setDefault(1.f, 1.f, 1.f));
nAttr.setCached( true );
nAttr.setInternal( true );
aTranspGain = nAttr.create("transparencyGain", "tg",
MFnNumericData::kFloat, 1.f, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( nAttr.setStorable(true));
CHECK_MSTATUS( nAttr.setKeyable(true));
CHECK_MSTATUS( nAttr.setDefault(1.f));
CHECK_MSTATUS( nAttr.setSoftMin(0.f));
CHECK_MSTATUS( nAttr.setSoftMax(2.f));
nAttr.setCached( true );
nAttr.setInternal( true );
aColorBias = nAttr.createColor( "colorBias", "cb", &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( nAttr.setStorable(true));
CHECK_MSTATUS( nAttr.setKeyable(true));
CHECK_MSTATUS( nAttr.setDefault(0.f, 0.f, 0.f));
nAttr.setCached( true );
nAttr.setInternal( true );
aTranspBias = nAttr.create( "transparencyBias", "tb",
MFnNumericData::kFloat, 0.f, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( nAttr.setStorable(true));
CHECK_MSTATUS( nAttr.setKeyable(true));
CHECK_MSTATUS( nAttr.setDefault(0.f));
CHECK_MSTATUS( nAttr.setSoftMin(-1.f));
CHECK_MSTATUS( nAttr.setSoftMax(1.f));
nAttr.setCached( true );
nAttr.setInternal( true );
aNormalsPerVertex = nAttr.create("normalsPerVertex", "nv",
MFnNumericData::kInt, 0, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( nAttr.setStorable(true));
CHECK_MSTATUS( nAttr.setKeyable(false));
CHECK_MSTATUS( nAttr.setDefault(0));
CHECK_MSTATUS( nAttr.setSoftMin(0));
CHECK_MSTATUS( nAttr.setSoftMax(3));
nAttr.setCached( true );
nAttr.setInternal( true );
aColorsPerVertex = nAttr.create("colorsPerVertex", "cv",
MFnNumericData::kInt, 0, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( nAttr.setStorable(true));
CHECK_MSTATUS( nAttr.setKeyable(false));
CHECK_MSTATUS( nAttr.setDefault(0));
CHECK_MSTATUS( nAttr.setSoftMin(0));
CHECK_MSTATUS( nAttr.setSoftMax(5));
nAttr.setCached( true );
nAttr.setInternal( true );
aColorSetName = tAttr.create("colorSetName", "cs",
MFnData::kString, MObject::kNullObj, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( tAttr.setStorable(true));
CHECK_MSTATUS( tAttr.setKeyable(false));
tAttr.setCached( true );
tAttr.setInternal( true );
aTexRotateX = nAttr.create( "texRotateX", "tx",
MFnNumericData::kFloat, 0.f, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( nAttr.setStorable(true));
CHECK_MSTATUS( nAttr.setKeyable(true));
CHECK_MSTATUS( nAttr.setDefault(0.f));
nAttr.setCached( true );
nAttr.setInternal( true );
aTexRotateY = nAttr.create( "texRotateY", "ty",
MFnNumericData::kFloat, 0.f, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( nAttr.setStorable(true));
CHECK_MSTATUS( nAttr.setKeyable(true));
CHECK_MSTATUS( nAttr.setDefault(0.f));
nAttr.setCached( true );
nAttr.setInternal( true );
//.........这里部分代码省略.........
示例7: initialize
MStatus closestPointOnCurveNode::initialize()
{
// CREATE AND ADD ".inCurve" ATTRIBUTE:
MFnTypedAttribute inCurveAttrFn;
aInCurve = inCurveAttrFn.create("inCurve", "ic", MFnData::kNurbsCurve);
inCurveAttrFn.setStorable(true);
inCurveAttrFn.setKeyable(false);
inCurveAttrFn.setReadable(true);
inCurveAttrFn.setWritable(true);
inCurveAttrFn.setCached(false);
addAttribute(aInCurve);
// CREATE AND ADD ".inPositionX" ATTRIBUTE:
MFnNumericAttribute inPositionXAttrFn;
aInPositionX = inPositionXAttrFn.create("inPositionX", "ipx", MFnNumericData::kDouble, 0.0);
inPositionXAttrFn.setStorable(true);
inPositionXAttrFn.setKeyable(true);
inPositionXAttrFn.setReadable(true);
inPositionXAttrFn.setWritable(true);
addAttribute(aInPositionX);
// CREATE AND ADD ".inPositionY" ATTRIBUTE:
MFnNumericAttribute inPositionYAttrFn;
aInPositionY = inPositionYAttrFn.create("inPositionY", "ipy", MFnNumericData::kDouble, 0.0);
inPositionYAttrFn.setStorable(true);
inPositionYAttrFn.setKeyable(true);
inPositionYAttrFn.setReadable(true);
inPositionYAttrFn.setWritable(true);
addAttribute(aInPositionY);
// CREATE AND ADD ".inPositionZ" ATTRIBUTE:
MFnNumericAttribute inPositionZAttrFn;
aInPositionZ = inPositionZAttrFn.create("inPositionZ", "ipz", MFnNumericData::kDouble, 0.0);
inPositionZAttrFn.setStorable(true);
inPositionZAttrFn.setKeyable(true);
inPositionZAttrFn.setReadable(true);
inPositionZAttrFn.setWritable(true);
addAttribute(aInPositionZ);
// CREATE AND ADD ".inPosition" ATTRIBUTE:
MFnNumericAttribute inPositionAttrFn;
aInPosition = inPositionAttrFn.create("inPosition", "ip", aInPositionX, aInPositionY, aInPositionZ);
inPositionAttrFn.setStorable(true);
inPositionAttrFn.setKeyable(true);
inPositionAttrFn.setReadable(true);
inPositionAttrFn.setWritable(true);
addAttribute(aInPosition);
// CREATE AND ADD ".positionX" ATTRIBUTE:
MFnNumericAttribute pointXAttrFn;
//.........这里部分代码省略.........
示例8: initialize
MStatus bruiseMapNode::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
aBias = nAttr.create("bias", "bs",
MFnNumericData::kFloat, 0.1f, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( nAttr.setStorable(true));
CHECK_MSTATUS( nAttr.setKeyable(true));
CHECK_MSTATUS( nAttr.setMin(0.f));
amapsize = nAttr.create( "mapsize", "mapsize", MFnNumericData::kInt, 1024 );
nAttr.setStorable(false);
nAttr.setKeyable(false);
addAttribute( amapsize );
auvset = tAttr.create("uvset", "uv",
MFnData::kString, MObject::kNullObj, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( tAttr.setStorable(true));
CHECK_MSTATUS( tAttr.setKeyable(false));
tAttr.setCached( true );
tAttr.setInternal( true );
zWorks::createMatrixAttr(aworldSpace, "worldSpace", "ws");
aoutput = nAttr.create( "outval", "ov", MFnNumericData::kInt, 1 );
nAttr.setStorable(false);
nAttr.setWritable(false);
nAttr.setKeyable(false);
addAttribute( aoutput );
zWorks::createTypedAttr(agrowth, MString("growMesh"), MString("gm"), MFnData::kMesh);
zCheckStatus(addAttribute(agrowth), "ERROR adding grow mesh");
zWorks::createTypedAttr(aguide, MString("guideMesh"), MString("gdm"), MFnData::kMesh);
zCheckStatus(addAttribute(aguide), "ERROR adding grow mesh");
astartframe = nAttr.create( "startFrame", "sf", MFnNumericData::kInt, 1 );
nAttr.setStorable(true);
nAttr.setKeyable(true);
addAttribute( astartframe );
zWorks::createTimeAttr(acurrenttime, MString("currentTime"), MString("ct"), 1.0);
zCheckStatus(addAttribute(acurrenttime), "ERROR adding time");
asavemap = nAttr.create( "saveMap", "sm", MFnNumericData::kInt, 0);
nAttr.setStorable(false);
nAttr.setKeyable(true);
addAttribute(asavemap);
CHECK_MSTATUS( addAttribute(aBias));
CHECK_MSTATUS( addAttribute(auvset));
addAttribute(aworldSpace);
attributeAffects( aBias, aoutput );
attributeAffects( amapsize, aoutput );
attributeAffects( agrowth, aoutput );
attributeAffects( astartframe, aoutput );
attributeAffects( acurrenttime, aoutput );
attributeAffects( aguide, aoutput );
attributeAffects( asavemap, aoutput );
return MS::kSuccess;
}
示例9: initialize
MStatus curveColliderLocator::initialize()
{
MFnNumericAttribute nAttr;
MStatus stat;
colliderRadiusIn = nAttr.create( "radius", "rd", MFnNumericData::kDouble );
nAttr.setDefault(1.0);
nAttr.setMin(0);
nAttr.setKeyable(true);
nAttr.setArray(true);
nAttr.setStorable(true);
nAttr.setWritable(true);
stat = addAttribute(colliderRadiusIn);
if (!stat) {
stat.perror("Could not add colliderRadiusIn attribute");
return stat;
}
// CREATE AND ADD ".inCurve" ATTRIBUTE:
MFnTypedAttribute inCurveAttrFn;
colliderCurveIn = inCurveAttrFn.create("colliderCurve", "ic", MFnData::kNurbsCurve);
inCurveAttrFn.setStorable(true);
inCurveAttrFn.setKeyable(false);
inCurveAttrFn.setReadable(true);
inCurveAttrFn.setWritable(true);
inCurveAttrFn.setCached(false);
stat = addAttribute(colliderCurveIn);
if (!stat) {
stat.perror("Could not add colliderCurveIn attribute");
return stat;
}
MFnMatrixAttribute mAttr;
colliderXform =mAttr.create("colliderXfm", "cx");
mAttr.setReadable(false);
mAttr.setKeyable(false);
mAttr.setConnectable(true);
stat = addAttribute( colliderXform );
if (!stat) {
stat.perror("Could not add colliderXform attribute");
return stat;
}
colliderColorR = nAttr.create( "colorR", "clr", MFnNumericData::kFloat );
nAttr.setDefault(0.2f);
nAttr.setMin(0.0f);
nAttr.setMax(1.0f);
nAttr.setKeyable(true);
nAttr.setStorable(true);
nAttr.setReadable(true);
nAttr.setWritable(true);
stat = addAttribute(colliderColorR);
if (!stat) {
stat.perror("Could not add colliderColorR attribute");
return stat;
}
colliderColorG = nAttr.create( "colorG", "clg", MFnNumericData::kFloat );
nAttr.setDefault(0.2f);
nAttr.setMin(0.0f);
nAttr.setMax(1.0f);
nAttr.setKeyable(true);
nAttr.setStorable(true);
nAttr.setReadable(true);
nAttr.setWritable(true);
stat = addAttribute(colliderColorG);
if (!stat) {
stat.perror("Could not add colliderColorG attribute");
return stat;
}
colliderColorB = nAttr.create( "colorB", "clb", MFnNumericData::kFloat );
nAttr.setDefault(0.8f);
nAttr.setMin(0.0f);
nAttr.setMax(1.0f);
nAttr.setKeyable(true);
nAttr.setStorable(true);
nAttr.setReadable(true);
nAttr.setWritable(true);
stat = addAttribute(colliderColorB);
if (!stat) {
stat.perror("Could not add colliderColorB attribute");
return stat;
}
colliderTransparency = nAttr.create( "colorT", "clt", MFnNumericData::kFloat );
nAttr.setDefault(1.0f);
nAttr.setMin(0.0f);
nAttr.setMax(1.0f);
nAttr.setKeyable(true);
nAttr.setStorable(true);
nAttr.setReadable(true);
nAttr.setWritable(true);
stat = addAttribute(colliderTransparency);
if (!stat) {
stat.perror("Could not add colliderTransparency attribute");
return stat;
//.........这里部分代码省略.........
示例10: initialize
MStatus octreeVizNode::initialize()
{
MStatus status;
MFnNumericAttribute numAttr;
MFnTypedAttribute tAttr;
alevel = numAttr.create("alevel","alr",MFnNumericData::kShort);
numAttr.setDefault( 4 );
numAttr.setMin( 0 );
numAttr.setMax( 10 );
numAttr.setKeyable( true );
numAttr.setReadable( true );
numAttr.setWritable( true );
numAttr.setStorable( true );
status = addAttribute(alevel);
CHECK_MSTATUS( status );
aarea = numAttr.create("aarea","aar",MFnNumericData::kFloat);
numAttr.setDefault( 10.0 );
numAttr.setKeyable( true );
numAttr.setReadable( true );
numAttr.setWritable( true );
numAttr.setStorable( true );
status = addAttribute(aarea);
CHECK_MSTATUS( status );
acount = numAttr.create("acount","aco",MFnNumericData::kInt);
numAttr.setDefault( 100 );
numAttr.setKeyable( true );
numAttr.setReadable( true );
numAttr.setWritable( true );
numAttr.setStorable( true );
status = addAttribute(acount);
CHECK_MSTATUS( status );
adefinepositionX = numAttr.create("adefinepositionX","poX",MFnNumericData::kFloat);
numAttr.setDefault( 0.0 );
numAttr.setKeyable( true );
numAttr.setReadable( true );
numAttr.setWritable( true );
numAttr.setStorable( true );
status = addAttribute(adefinepositionX);
CHECK_MSTATUS( status );
adefinepositionY = numAttr.create("adefinepositionY","poY",MFnNumericData::kFloat);
numAttr.setDefault( 0.0 );
numAttr.setKeyable( true );
numAttr.setReadable( true );
numAttr.setWritable( true );
numAttr.setStorable( true );
status = addAttribute(adefinepositionY);
CHECK_MSTATUS( status );
adefinepositionZ= numAttr.create("adefinepositionZ","poZ",MFnNumericData::kFloat);
numAttr.setDefault( 0.0 );
numAttr.setKeyable( true );
numAttr.setReadable( true );
numAttr.setWritable( true );
numAttr.setStorable( true );
status = addAttribute(adefinepositionZ);
CHECK_MSTATUS( status );
afuzz = numAttr.create( "fuzz", "fuzz", MFnNumericData::kFloat, 0.0 );
numAttr.setStorable(true);
numAttr.setKeyable(true);
addAttribute(afuzz);
alengthnoise = numAttr.create("kink", "kink",
MFnNumericData::kFloat, 0.f, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( numAttr.setStorable(true));
CHECK_MSTATUS( numAttr.setKeyable(true));
addAttribute(alengthnoise);
aSize = numAttr.create("clumping", "clp",
MFnNumericData::kFloat, 0.f, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( numAttr.setStorable(true));
CHECK_MSTATUS( numAttr.setKeyable(true));
CHECK_MSTATUS( numAttr.setDefault(0.f));
numAttr.setCached( true );
addAttribute(aSize);
astep = numAttr.create( "drawStep", "dsp", MFnNumericData::kInt, 1 );
numAttr.setStorable(true);
numAttr.setKeyable(true);
addAttribute(astep);
aHDRName = tAttr.create("cachePath", "cp",
MFnData::kString, MObject::kNullObj, &status);
CHECK_MSTATUS( status );
CHECK_MSTATUS( tAttr.setStorable(true));
CHECK_MSTATUS( tAttr.setKeyable(false));
tAttr.setCached( true );
zWorks::createMatrixAttr(aworldSpace, "worldSpace", "ws");
aoutput = numAttr.create( "outval", "ov", MFnNumericData::kInt, 1 );
numAttr.setStorable(false);
//.........这里部分代码省略.........