本文整理汇总了C++中MFnTypedAttribute::create方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnTypedAttribute::create方法的具体用法?C++ MFnTypedAttribute::create怎么用?C++ MFnTypedAttribute::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnTypedAttribute
的用法示例。
在下文中一共展示了MFnTypedAttribute::create方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
MStatus btSPHMgrNode::initialize()
{
_LogFunctionCall("btSPHMgrNode::initialize()");
MStatus status;
MFnUnitAttribute uAttr;
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
i_particleShape = nAttr.create(particleShape, ps, MFnNumericData::kInt, 0, &status);
IfMErrorWarn(status);
IfMErrorWarn(addAttribute(i_particleShape));
i_particlePPAttr = nAttr.create(particlePPAttr, pppa, MFnNumericData::kInt, 0, &status);
IfMErrorWarn(status);
IfMErrorWarn(addAttribute(i_particlePPAttr));
i_particleCount = nAttr.create( particleCount, pc, MFnNumericData::kInt, 300,&status);
IfMErrorWarn(status);
IfMErrorWarn(addAttribute( i_particleCount ));
i_obstacleAABB = tAttr.create(obstacleBox, obox, MFnData::kMesh, MObject::kNullObj, &status);
IfMErrorWarn(status);
IfMErrorWarn(addAttribute(i_obstacleAABB));
i_initAABB = tAttr.create(initBox, ibox, MFnData::kMesh, MObject::kNullObj, &status);
IfMErrorWarn(status);
IfMErrorWarn(addAttribute(i_initAABB));
return MS::kSuccess;
}
示例2: initialize
MStatus SceneShape::initialize()
{
MStatus s = inheritAttributesFrom( "ieSceneShapeInterface" );
MFnTypedAttribute tAttr;
// will need to check for sceneFile extensions
aSceneFilePlug = tAttr.create( "file", "scf", MFnData::kString, &s );
assert( s );
s = addAttribute( aSceneFilePlug );
assert( s );
aSceneRootPlug = tAttr.create( "root", "scr", MFnData::kString, MFnStringData().create( "/" ), &s );
assert( s );
s = addAttribute( aSceneRootPlug );
assert( s );
attributeAffects( aSceneFilePlug, aTransform );
attributeAffects( aSceneFilePlug, aBound );
attributeAffects( aSceneFilePlug, aOutputObjects );
attributeAffects( aSceneFilePlug, aAttributes );
attributeAffects( aSceneRootPlug, aTransform );
attributeAffects( aSceneRootPlug, aBound );
attributeAffects( aSceneRootPlug, aOutputObjects );
attributeAffects( aSceneRootPlug, aAttributes );
return s;
}
示例3: initialize
MStatus testNpassiveNode::initialize()
{
MStatus stat;
MFnTypedAttribute tAttr;
inputGeom = tAttr.create("inputGeom", "ing", MFnData::kMesh, MObject::kNullObj, &stat );
//statCheck(stat, "failed to create inputGeom");
tAttr.setWritable(true);
tAttr.setStorable(true);
tAttr.setHidden(true);
currentState = tAttr.create("currentState", "cus", MFnData::kNObject, MObject::kNullObj, &stat );
// statCheck(stat, "failed to create currentState");
tAttr.setWritable(true);
tAttr.setStorable(false);
tAttr.setHidden(true);
startState = tAttr.create( "startState", "sts", MFnData::kNObject, MObject::kNullObj, &stat );
//statCheck(stat, "failed to create startState");
tAttr.setWritable(true);
tAttr.setStorable(false);
tAttr.setHidden(true);
MFnUnitAttribute uniAttr;
currentTime = uniAttr.create( "currentTime", "ctm" , MFnUnitAttribute::kTime, 0.0, &stat );
addAttribute(inputGeom);
addAttribute(currentTime);
addAttribute(startState);
addAttribute(currentState);
attributeAffects(inputGeom, startState);
attributeAffects(inputGeom, currentState);
attributeAffects(currentTime, currentState);
attributeAffects(currentTime, startState);
return MStatus::kSuccess;
}
示例4: initialize
MStatus fullLoft::initialize()
{
MStatus stat;
MFnTypedAttribute typedAttr;
inputCurve=typedAttr.create( "inputCurve", "in",
MFnNurbsCurveData::kNurbsCurve,
&stat );
PERRORfail("initialize create input attribute");
stat = typedAttr.setArray( true );
PERRORfail("initialize set input attribute array");
outputSurface=typedAttr.create( "outputSurface", "out",
MFnNurbsSurfaceData::kNurbsSurface,
&stat );
PERRORfail("initialize create output attribute");
stat = typedAttr.setStorable( false );
PERRORfail("initialize set output attribute storable");
stat = addAttribute( inputCurve );
PERRORfail("addAttribute(inputCurve)");
stat = addAttribute( outputSurface );
PERRORfail("addAttribute(outputSurface)");
stat = attributeAffects( inputCurve, outputSurface );
PERRORfail("attributeAffects(inputCurve, outputSurface)");
return MS::kSuccess;
}
示例5: initialize
MStatus HesMeshNode::initialize()
{
MFnNumericAttribute numAttr;
MStatus stat;
MFnTypedAttribute stringAttr;
input = stringAttr.create( "hesPath", "hsp", MFnData::kString );
stringAttr.setStorable(true);
addAttribute( input );
ameshname = stringAttr.create( "meshName", "mn", MFnData::kString );
stringAttr.setStorable(true);
stringAttr.setArray(true);
stringAttr.setDisconnectBehavior(MFnAttribute::kDelete);
addAttribute( ameshname );
MFnTypedAttribute meshAttr;
outMesh = meshAttr.create( "outMesh", "o", MFnData::kMesh );
meshAttr.setStorable(false);
meshAttr.setWritable(false);
meshAttr.setArray(true);
meshAttr.setDisconnectBehavior(MFnAttribute::kDelete);
addAttribute( outMesh );
attributeAffects( input, outMesh );
return MS::kSuccess;
}
示例6: initialize
MStatus clusterControledCurve::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnMatrixAttribute mAttr;
MFnTypedAttribute tAttr;
MFnCompoundAttribute cAttr;
aInputCurve = tAttr.create( "inputCurve", "inputCurve", MFnData::kNurbsCurve );
tAttr.setStorable( true );
CHECK_MSTATUS( addAttribute( aInputCurve ) );
aInputCurveMatrix = mAttr.create( "inputCurveMatrix", "inputCurveMatrix" );
mAttr.setStorable( true );
CHECK_MSTATUS( addAttribute( aInputCurveMatrix ) );
aDumyMatrix = mAttr.create( "dumyMatrix", "dumyMatrix" );
mAttr.setStorable( true );
CHECK_MSTATUS( addAttribute( aDumyMatrix ) );
aBindPreMatrix = mAttr.create( "bindPreMatrix", "bindPreMatrix" );
mAttr.setStorable( true );
mAttr.setArray( true );
nAttr.setUsesArrayDataBuilder( true );
CHECK_MSTATUS( addAttribute( aBindPreMatrix ) );
aMatrix = mAttr.create( "matrix", "matrix" );
mAttr.setStorable( true );
mAttr.setArray( true );
CHECK_MSTATUS( addAttribute( aMatrix ) );
aWeightList = cAttr.create( "weightList", "weightList" );
aWeights = nAttr.create( "weights", "weights", MFnNumericData::kFloat, 0.0 );
nAttr.setArray( true );
nAttr.setUsesArrayDataBuilder( true );
cAttr.addChild( aWeights );
cAttr.setArray( true );
cAttr.setStorable( true );
CHECK_MSTATUS( addAttribute( aWeightList ) );
aUpdate = nAttr.create( "update", "update", MFnNumericData::kBoolean, false );
nAttr.setStorable( true );
CHECK_MSTATUS( addAttribute( aUpdate ) );
aOutputCurve = tAttr.create( "outputCurve", "outputCurve", MFnData::kNurbsCurve );
CHECK_MSTATUS( addAttribute( aOutputCurve ) );
CHECK_MSTATUS( attributeAffects( aInputCurve, aOutputCurve ) );
CHECK_MSTATUS( attributeAffects( aInputCurveMatrix, aOutputCurve ) );
CHECK_MSTATUS( attributeAffects( aDumyMatrix, aOutputCurve ) );
CHECK_MSTATUS( attributeAffects( aBindPreMatrix, aOutputCurve ) );
CHECK_MSTATUS( attributeAffects( aMatrix, aOutputCurve ) );
CHECK_MSTATUS( attributeAffects( aWeightList, aOutputCurve ) );
CHECK_MSTATUS( attributeAffects( aUpdate, aOutputCurve ) );
return MS::kSuccess;
}
示例7: initialize
MStatus AlembicCurvesDeformNode::initialize()
{
MStatus status;
MFnUnitAttribute uAttr;
MFnTypedAttribute tAttr;
MFnNumericAttribute nAttr;
MFnGenericAttribute gAttr;
MFnStringData emptyStringData;
MObject emptyStringObject = emptyStringData.create("");
// input time
mTimeAttr = uAttr.create("inTime", "tm", MFnUnitAttribute::kTime, 0.0);
status = uAttr.setStorable(true);
status = uAttr.setKeyable(true);
status = addAttribute(mTimeAttr);
// input file name
mFileNameAttr =
tAttr.create("fileName", "fn", MFnData::kString, emptyStringObject);
status = tAttr.setStorable(true);
status = tAttr.setUsedAsFilename(true);
status = tAttr.setKeyable(false);
status = addAttribute(mFileNameAttr);
// input identifier
mIdentifierAttr =
tAttr.create("identifier", "if", MFnData::kString, emptyStringObject);
status = tAttr.setStorable(true);
status = tAttr.setKeyable(false);
status = addAttribute(mIdentifierAttr);
// output for list of ArbGeomParams
mGeomParamsList = tAttr.create("ExocortexAlembic_GeomParams", "exo_gp",
MFnData::kString, emptyStringObject);
status = tAttr.setStorable(true);
status = tAttr.setKeyable(false);
status = tAttr.setHidden(false);
status = tAttr.setInternal(true);
status = addAttribute(mGeomParamsList);
// output for list of UserAttributes
mUserAttrsList = tAttr.create("ExocortexAlembic_UserAttributes", "exo_ua",
MFnData::kString, emptyStringObject);
status = tAttr.setStorable(true);
status = tAttr.setKeyable(false);
status = tAttr.setHidden(false);
status = tAttr.setInternal(true);
status = addAttribute(mUserAttrsList);
// create a mapping
status = attributeAffects(mTimeAttr, outputGeom);
status = attributeAffects(mFileNameAttr, outputGeom);
status = attributeAffects(mIdentifierAttr, outputGeom);
return status;
}
示例8: initialize
MStatus DynamicEnum::initialize()
{
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
MFnStringData sData;
MStatus status; // Status will be used to hold the MStatus value
// returned by each api function call. It is important
// to check the status returned by a call to aid in
// debugging. Failed API calls can result in subtle
// errors that can be difficult to track down, you may
// wish to use the CHECK_MSTATUS macro for any API
// call where you do not need to provide your own
// error handling.
//
// Attribute Initialization:
aFilePath = tAttr.create( "filepath", "file", MFnData::kString, &status );
CHECK_MSTATUS( status );
CHECK_MSTATUS( tAttr.setKeyable( true ) );
CHECK_MSTATUS( tAttr.setStorable( true ) );
CHECK_MSTATUS( tAttr.setDefault( sData.create("") ) );
aGridName = tAttr.create( "grid", "grd", MFnData::kString, &status );
CHECK_MSTATUS( status );
CHECK_MSTATUS( tAttr.setKeyable( true ) );
CHECK_MSTATUS( tAttr.setStorable( true ) );
CHECK_MSTATUS( tAttr.setDefault( sData.create("") ) );
aOutColor = nAttr.createColor( "outColor", "oc", &status );
CHECK_MSTATUS( status );
CHECK_MSTATUS( nAttr.setHidden( false ) );
CHECK_MSTATUS( nAttr.setReadable( true ) );
CHECK_MSTATUS( nAttr.setWritable( false ) );
// Next we will add the attributes we have defined to the node
//
CHECK_MSTATUS( addAttribute( aFilePath ) );
CHECK_MSTATUS( addAttribute( aGridName ) );
CHECK_MSTATUS( addAttribute( aOutColor ) );
// The attributeAffects() method is used to indicate when the input
// attribute affects the output attribute. This knowledge allows Maya
// to optimize dependencies in the graph in more complex nodes where
// there may be several inputs and outputs, but not all the inputs
// affect all the outputs.
//
CHECK_MSTATUS( attributeAffects( aFilePath, aOutColor ) );
CHECK_MSTATUS( attributeAffects( aGridName, aOutColor ) );
return( MS::kSuccess );
}
示例9: initialize
MStatus resetVtxRemapNode::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;
inMesh = attrFn.create("inMesh", "im", MFnMeshData::kMesh);
attrFn.setStorable(true); // To be stored during file-save
// Attribute is read-only because it is an output attribute
//
outMesh = attrFn.create("outMesh", "om", MFnMeshData::kMesh);
attrFn.setStorable(false);
attrFn.setWritable(false);
status = addAttribute( inMesh );
if (!status)
{
status.perror("addAttribute");
return status;
}
status = addAttribute( outMesh);
if (!status)
{
status.perror("addAttribute");
return status;
}
// Set up a dependency between the input and the output. This will cause
// the output to be marked dirty when the input changes. The output will
// then be recomputed the next time the value of the output is requested.
//
status = attributeAffects( inMesh, outMesh );
if (!status)
{
status.perror("attributeAffects");
return status;
}
return MS::kSuccess;
}
示例10: initialize
MStatus LSystemNode::initialize()
{
MFnUnitAttribute unitAttr;
MFnTypedAttribute typedAttr;
MFnNumericAttribute numericAttr;
MStatus returnStatus;
//(i)angle
LSystemNode::angle = numericAttr.create("angle","ag",MFnNumericData::kDouble,90.0,&returnStatus);
McheckErr(returnStatus, "ERROR creating LSystemNode angle attribute\n");
//(ii)size
step = numericAttr.create("step","st",MFnNumericData::kDouble,1.0, &returnStatus);
McheckErr(returnStatus, "ERROR creating LSystemNode step attribute\n");//(iv)time
//(iii)grammar
LSystemNode::grammar = typedAttr.create( "grammar", "grm", MFnData::kString, &returnStatus );
McheckErr(returnStatus, "ERROR creating LSystemNode grammar attribute\n");
//(iv)time
LSystemNode::time = unitAttr.create( "time", "tm", MFnUnitAttribute::kTime, 0.0, &returnStatus );
McheckErr(returnStatus, "ERROR creating LSystemNode time attribute\n");
//(v)output
LSystemNode::outputMesh = typedAttr.create( "outputMesh", "out", MFnData::kMesh, &returnStatus );
McheckErr(returnStatus, "ERROR creating LSystemNode output attribute\n");
typedAttr.setStorable(false);
//(i)angle
returnStatus = addAttribute(LSystemNode::angle);
McheckErr(returnStatus, "ERROR adding angle attribute\n");
//(ii)step
returnStatus = addAttribute(LSystemNode::step);
McheckErr(returnStatus, "ERROR adding step attribute\n");
//(iii)grammar
returnStatus = addAttribute(LSystemNode::grammar);
McheckErr(returnStatus, "ERROR adding grammar attribute\n");
//(iv)time
returnStatus = addAttribute(LSystemNode::time);
McheckErr(returnStatus, "ERROR adding time attribute\n");
//(v)output
returnStatus = addAttribute(LSystemNode::outputMesh);
McheckErr(returnStatus, "ERROR adding outputMesh attribute\n");
returnStatus = attributeAffects(LSystemNode::angle,LSystemNode::outputMesh);
McheckErr(returnStatus, "ERROR in attributeAffects\n");
returnStatus = attributeAffects(LSystemNode::step,LSystemNode::outputMesh);
McheckErr(returnStatus, "ERROR in attributeAffects\n");
returnStatus = attributeAffects(LSystemNode::grammar,LSystemNode::outputMesh);
McheckErr(returnStatus, "ERROR in attributeAffects\n");
returnStatus = attributeAffects(LSystemNode::time,LSystemNode::outputMesh);
McheckErr(returnStatus, "ERROR in attributeAffects\n");
return MS::kSuccess;
}
示例11: initialize
MStatus multiCurve::initialize()
{
MStatus stat;
MFnNumericAttribute nAttr;
MFnTypedAttribute typedAttr;
numCurves = nAttr.create ("numCurves", "nc",
MFnNumericData::kLong, 5, &stat);
PERRORfail(stat, "initialize create numCurves attribute");
CHECK_MSTATUS ( nAttr.setKeyable( true ) );
stat = addAttribute( numCurves );
PERRORfail(stat, "addAttribute(numCurves)");
curveOffset = nAttr.create ("curveOffset", "co",
MFnNumericData::kDouble, 1.0, &stat);
PERRORfail(stat, "initialize create curveOffset attribute");
CHECK_MSTATUS ( nAttr.setKeyable( true ) );
stat = addAttribute( curveOffset );
PERRORfail(stat, "addAttribute(curveOffset)");
inputCurve = typedAttr.create( "inputCurve", "ic",
MFnNurbsCurveData::kNurbsCurve, &stat );
PERRORfail(stat, "initialize create inputCurve attribute");
CHECK_MSTATUS ( typedAttr.setReadable( false ) );
CHECK_MSTATUS ( typedAttr.setWritable( true ) );
stat = addAttribute( inputCurve );
PERRORfail(stat, "addAttribute(inputCurve)");
outputCurves = typedAttr.create( "outputCurves", "oc",
MFnNurbsCurveData::kNurbsCurve, &stat );
PERRORfail(stat, "initialize create outputCurves attribute");
CHECK_MSTATUS ( typedAttr.setArray( true ) );
CHECK_MSTATUS ( typedAttr.setReadable( true ) );
CHECK_MSTATUS ( typedAttr.setWritable( false ) );
CHECK_MSTATUS ( typedAttr.setUsesArrayDataBuilder( true ) );
stat = addAttribute( outputCurves );
PERRORfail(stat, "addAttribute(outputCurves)");
stat = attributeAffects( numCurves, outputCurves );
PERRORfail(stat, "attributeAffects(inputCurve, outputCurves)");
stat = attributeAffects( curveOffset, outputCurves );
PERRORfail(stat, "attributeAffects(inputCurve, outputCurves)");
stat = attributeAffects( inputCurve, outputCurves );
PERRORfail(stat, "attributeAffects(inputCurve, outputCurves)");
return stat;
}
示例12: initialize
MStatus CmpMeshModifierNode::initialize()
{
MFnTypedAttribute tAttr;
inMesh = tAttr.create( "inMesh", "im", MFnData::kMesh );
outMesh = tAttr.create( "outMesh", "om", MFnData::kMesh );
tAttr.setStorable( false );
addAttribute( inMesh );
addAttribute( outMesh );
attributeAffects( inMesh, outMesh );
return MS::kSuccess;
}
示例13: 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;
}
示例14: initialize
MStatus PushDeformer::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
//add bulge attribute which affects the output geom
aAmount = nAttr.create("amount", "amt", MFnNumericData::kDouble, 0.0);
nAttr.setKeyable(true);
addAttribute(aAmount);
aStressMap = tAttr.create("aStressMap", "stMap", MFnData::kDoubleArray);
tAttr.setKeyable(true);
tAttr.setWritable(true);
tAttr.setStorable(true);
addAttribute(aStressMap);
aUseStress = nAttr.create("useStress", "useStress", MFnNumericData::kBoolean, 0);
nAttr.setKeyable(true);
nAttr.setStorable(true);
addAttribute(aUseStress);
aMultiThreadingType = nAttr.create("multiThreadingType", "multiThreadingType", MFnNumericData::kInt, 0);
nAttr.setKeyable(true);
addAttribute(aMultiThreadingType);
attributeAffects(aAmount, outputGeom);
attributeAffects(aStressMap, outputGeom);
attributeAffects(aUseStress, outputGeom);
attributeAffects(aMultiThreadingType, outputGeom);
// make paintable deformer
MGlobal::executeCommand("makePaintable -attrType multiFloat -sm deformer pushDeformer weights");
return MS::kSuccess;
}
示例15: initialize
//------------------------------------------------------------------------------
//
MStatus AdskPrepareRenderGlobals::initialize()
{
MStatus stat;
MFnStringData stringFn;
MObject emptyStr = stringFn.create( &stat );
MObject* attrib[3];
attrib[0] = &aRepName;
attrib[1] = &aRepLabel;
attrib[2] = &aRepType;
const char* longName[] = {"repName", "repLabel", "repType"};
const char* shortName[] = {"rna", "rla", "rty"};
MFnTypedAttribute stringAttrFn;
for (int i = 0; i < 3; i++)
{
*attrib[i] = stringAttrFn.create(longName[i], shortName[i], MFnData::kString, emptyStr);
stat = MPxNode::addAttribute(*attrib[i]);
CHECK_MSTATUS_AND_RETURN_IT(stat);
}
MFnNumericAttribute boolAttrFn;
aUseRegEx = boolAttrFn.create("useRegExp", "urx", MFnNumericData::kBoolean, 0);
stat = MPxNode::addAttribute(aUseRegEx);
CHECK_MSTATUS_AND_RETURN_IT(stat);
return stat;
}