本文整理汇总了C++中MFnTypedAttribute::setArray方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnTypedAttribute::setArray方法的具体用法?C++ MFnTypedAttribute::setArray怎么用?C++ MFnTypedAttribute::setArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnTypedAttribute
的用法示例。
在下文中一共展示了MFnTypedAttribute::setArray方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: initialize
MStatus testNucleusNode::initialize()
{
MStatus stat;
MFnTypedAttribute tAttr;
startState = tAttr.create("startState", "sst", MFnData::kNObject, MObject::kNullObj, &stat );
statCheck(stat, "failed to create startState");
tAttr.setWritable(true);
tAttr.setStorable(true);
tAttr.setHidden(true);
tAttr.setArray(true);
currentState = tAttr.create("currentState", "cst", MFnData::kNObject, MObject::kNullObj, &stat );
statCheck(stat, "failed to create currentState");
tAttr.setWritable(true);
tAttr.setStorable(true);
tAttr.setHidden(true);
tAttr.setArray(true);
nextState = tAttr.create("nextState", "nst", MFnData::kNObject, MObject::kNullObj, &stat );
statCheck(stat, "failed to create nextState");
tAttr.setWritable(true);
tAttr.setStorable(true);
tAttr.setHidden(true);
tAttr.setArray(true);
MFnUnitAttribute uniAttr;
currentTime = uniAttr.create( "currentTime", "ctm" , MFnUnitAttribute::kTime, 0.0, &stat );
addAttribute(startState);
addAttribute(currentState);
addAttribute(nextState);
addAttribute(currentTime);
attributeAffects(startState, nextState);
attributeAffects(currentState, nextState);
attributeAffects(currentTime, nextState);
return MStatus::kSuccess;
}
示例4: 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;
}
示例5: 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 );
}
示例6: initialize
//
// Initialize the node
//
MStatus jhMeshBlur::initialize()
{
// attribute types
MFnUnitAttribute unitAttr;
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
aOldMeshData = tAttr.create("oldMesh","om",MFnData::kPointArray);
tAttr.setArray(true);
tAttr.setHidden(true);
tAttr.setIndexMatters(true);
// create the attributes
aStrength = nAttr.create( "Strength", "str", MFnNumericData::kFloat,1.0);
nAttr.setStorable(true);
nAttr.setKeyable(true);
nAttr.setMax(1.0);
nAttr.setMin(0.0);
aTreshhold = nAttr.create( "Treshold", "tres", MFnNumericData::kFloat,0.0);
nAttr.setStorable(true);
nAttr.setKeyable(true);
nAttr.setMin(0.0);
aShapeFactor = nAttr.create( "ShapeFactor", "shapef", MFnNumericData::kFloat,0.5);
nAttr.setStorable(true);
nAttr.setKeyable(true);
nAttr.setMax(1.0);
nAttr.setMin(0.0);
aTweakBlur = nAttr.create( "TweakBlur", "tweak", MFnNumericData::kBoolean,false);
nAttr.setKeyable(false);
nAttr.setChannelBox(true);
aQuadInterp = nAttr.create( "QuadInterpolation", "qi", MFnNumericData::kBoolean,true);
nAttr.setKeyable(false);
nAttr.setChannelBox(true);
aInterpPower = nAttr.create( "InterpolationPower", "interp", MFnNumericData::kDouble, 0.75);
nAttr.setKeyable(true);
nAttr.setMax(1.0);
nAttr.setMin(0.0);
aTime = unitAttr.create( "time", "tm", MFnUnitAttribute::kTime, 1.0 );
unitAttr.setStorable(true);
unitAttr.setCached(true);
unitAttr.setReadable(true);
unitAttr.setWritable(true);
unitAttr.setAffectsAppearance(true);
unitAttr.setAffectsWorldSpace(true);
// Make the attributes visible to the user
addAttribute( aStrength);
addAttribute( aTreshhold);
addAttribute( aTime);
addAttribute( aTweakBlur);
addAttribute( aQuadInterp);
addAttribute( aInterpPower);
addAttribute( aOldMeshData);
// Make sure when an attribute changes, the node updates
attributeAffects( aTime, outputGeom );
attributeAffects( aStrength, outputGeom );
attributeAffects( aTreshhold, outputGeom );
attributeAffects( aQuadInterp, outputGeom );
attributeAffects( aInterpPower, outputGeom );
// Not implented yet, but make the weights paintable :)
MGlobal::executeCommand("makePaintable -attrType multiFloat -sm deformer jhMeshBlur weights;");
return MStatus::kSuccess;
}
示例7: 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);
//.........这里部分代码省略.........
示例8: initialize
// plugin (un)initialiser
MStatus nwayDeformerNode::initialize()
{
MFnTypedAttribute tAttr;
MFnNumericAttribute nAttr;
MFnEnumAttribute eAttr;
MFnMatrixAttribute mAttr;
aBlendMesh = tAttr.create("blendMesh", "mesh", MFnData::kMesh);
tAttr.setArray(true);
tAttr.setUsesArrayDataBuilder(true);
addAttribute(aBlendMesh);
attributeAffects( aBlendMesh, outputGeom );
aWeight = nAttr.create("blendWeight", "bw", MFnNumericData::kDouble, 0.0);
nAttr.setArray(true);
nAttr.setKeyable(true);
nAttr.setStorable(true);
nAttr.setUsesArrayDataBuilder(true);
addAttribute(aWeight);
attributeAffects( aWeight, outputGeom );
aRotationConsistency = nAttr.create( "rotationConsistency", "rc", MFnNumericData::kBoolean, false );
nAttr.setStorable(true);
addAttribute( aRotationConsistency );
attributeAffects( aRotationConsistency, outputGeom );
aInitRotation = nAttr.create("initRotation", "ir", MFnNumericData::kDouble);
addAttribute(aInitRotation);
attributeAffects( aInitRotation, outputGeom );
aVisualiseEnergy = nAttr.create( "visualiseEnergy", "ve", MFnNumericData::kBoolean, false );
nAttr.setStorable(true);
addAttribute( aVisualiseEnergy );
attributeAffects( aVisualiseEnergy, outputGeom );
aVisualisationMultiplier = nAttr.create("visualisationMultiplier", "vmp", MFnNumericData::kDouble, 1.0);
nAttr.setStorable(true);
addAttribute( aVisualisationMultiplier );
attributeAffects( aVisualisationMultiplier, outputGeom );
aBlendMode = eAttr.create( "blendMode", "bm", BM_SRL );
eAttr.addField( "expSO+expSym", BM_SRL );
eAttr.addField( "logmatrix3", BM_LOG3 );
eAttr.addField( "quat+linear", BM_SQL );
eAttr.addField( "expSO+linear", BM_SlRL );
eAttr.addField( "linear", BM_AFF );
eAttr.addField( "off", BM_OFF );
addAttribute( aBlendMode );
attributeAffects( aBlendMode, outputGeom );
aTetMode = eAttr.create( "tetMode", "tm", TM_FACE );
eAttr.addField( "face", TM_FACE );
eAttr.addField( "edge", TM_EDGE );
eAttr.addField( "vertex", TM_VERTEX );
eAttr.addField( "vface", TM_VFACE );
addAttribute( aTetMode );
attributeAffects( aTetMode, outputGeom );
aIteration = nAttr.create("iteration", "it", MFnNumericData::kShort, 1);
addAttribute(aIteration);
attributeAffects(aIteration, outputGeom);
// this shouldn't affect outputGeom
aEnergy = nAttr.create("energy", "energy", MFnNumericData::kDouble, 0.0);
nAttr.setArray(true);
nAttr.setKeyable(true);
nAttr.setStorable(true);
nAttr.setUsesArrayDataBuilder(true);
addAttribute(aEnergy);
// Make the deformer weights paintable
MGlobal::executeCommand( "makePaintable -attrType multiFloat -sm deformer nwayBlender weights;" );
return MS::kSuccess;
}
示例9: initialize
MStatus NBuddyEMPSaverNode::initialize()
{
MStatus status;
MFnTypedAttribute typedAttr; //Typed attributes
MFnUnitAttribute unitAttr;
MFnStringData stringData; //String Attributes
MFnNumericAttribute numFn; //Numerics
MFnPluginData dataFn;
//Create the body input array attribute
_inBodies = typedAttr.create("inBodies","inb" , naiadBodyData::id , MObject::kNullObj , &status);
NM_CheckMStatus(status, "ERROR creating inBodies attribute.\n");
typedAttr.setStorable( false );
typedAttr.setKeyable( false );
typedAttr.setWritable(true);
typedAttr.setReadable(false);
typedAttr.setArray( true );
status = addAttribute( _inBodies );
NM_CheckMStatus(status, "ERROR adding inBodies attribute.\n");
//Attribute for the folder in which to put the emp files
_empOutputPath = typedAttr.create( "empOutputPath", "ef", MFnData::kString ,stringData.create(MString("/home/jimmi/dev/naiad/emopen/maya/naiadForMaya/test.#.emp")), &status);
NM_CheckMStatus( status, "Failed to create empOutputPath attribute");
typedAttr.setStorable( true );
status = addAttribute( _empOutputPath );
NM_CheckMStatus( status, "Failed to add empOutputPath plug");
//Time input
_time = unitAttr.create( "time", "tm", MFnUnitAttribute::kTime, 0.0, &status );
NM_CheckMStatus( status, "Failed to create time attribute");
unitAttr.setStorable(true);
unitAttr.setWritable(true);
status = addAttribute( _time );
NM_CheckMStatus( status, "Failed to add time plug");
_framePadding = numFn.create( "framePadding", "fp", MFnNumericData::kInt, 4 , &status );
NM_CheckMStatus( status, "Failed to create framePadding attribute");
numFn.setStorable(true);
numFn.setWritable(true);
status = addAttribute( _framePadding );
NM_CheckMStatus( status, "Failed to add framePadding plug");
_timeStep = numFn.create( "timeStep", "ts", MFnNumericData::kInt, 0 , &status );
NM_CheckMStatus( status, "Failed to create timeStep attribute");
numFn.setStorable(true);
numFn.setWritable(true);
status = addAttribute( _timeStep );
NM_CheckMStatus( status, "Failed to add timeStep plug");
// an dummy output trigger to force evaluation of the node
_outTrigger = numFn.create("outTrigger", "ot", MFnNumericData::kBoolean);
NM_CheckMStatus( status, "Failed to create outTrigger attribute");
numFn.setStorable(false);
numFn.setWritable(false);
status = addAttribute( _outTrigger );
NM_CheckMStatus( status, "Failed to add outTrigger plug");
//Attribute Affects
attributeAffects( _inBodies, _outTrigger );
attributeAffects( _time, _outTrigger );
attributeAffects( _framePadding, _outTrigger );
attributeAffects( _timeStep, _outTrigger );
attributeAffects( _empOutputPath, _outTrigger );
return MS::kSuccess;
}
示例10: initialize
//.........这里部分代码省略.........
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);
addAttribute( avapeture );
afocallength = numFn.create( "focalLength", "fl", MFnNumericData::kDouble );
numFn.setStorable(false);
numFn.setConnectable(true);
addAttribute( afocallength );
aconvertPercentage = numFn.create( "convertPercentage", "cvp", MFnNumericData::kDouble );
numFn.setStorable(false);
numFn.setConnectable(true);
numFn.setDefault(1.0);
numFn.setMax(1.0);
numFn.setMin(0.01);
addAttribute(aconvertPercentage);
示例11: initialize
MStatus snapDeformer::initialize() {
MStatus stat;
MFnNumericAttribute FnNumeric;
MFnNumericAttribute FnNumericA;
MFnTypedAttribute FnTyped;
MFnEnumAttribute FnEnum;
//weight
weight = FnNumeric.create("weight", "we", MFnNumericData::kFloat);
FnNumeric.setKeyable(true);
FnNumeric.setStorable(true);
FnNumeric.setReadable(true);
FnNumeric.setWritable(true);
FnNumeric.setDefault( 1.0 );
addAttribute( weight );
///space target
space = FnEnum.create("space", "sp", 0);
FnEnum.addField("world",0);
FnEnum.addField("object",1);
FnEnum.setStorable(true);
FnEnum.setKeyable(true);
addAttribute(space);
///space source
spaceSource = FnEnum.create("spaceSource", "sps", 0);
FnEnum.addField("world",0);
FnEnum.addField("object",1);
FnEnum.setStorable(true);
FnEnum.setKeyable(true);
addAttribute(spaceSource);
//pointlist
pointList = FnNumericA.create("pointList", "pl", MFnNumericData::kInt);
FnNumericA.setArray( true );
FnNumericA.setKeyable(false);
FnNumericA.setStorable(true);
FnNumericA.setReadable(true);
FnNumericA.setWritable(true);
FnNumericA.setIndexMatters(true);
addAttribute( pointList );
//snapMesh
snapMesh = FnTyped.create("snapMesh", "sm", MFnData::kMesh);
FnTyped.setArray( false );
FnTyped.setReadable(true);
FnTyped.setWritable(true);
addAttribute( snapMesh );
attributeAffects(snapMesh, outputGeom);
attributeAffects(pointList, outputGeom);
attributeAffects(space, outputGeom);
attributeAffects(spaceSource, outputGeom);
attributeAffects(weight, outputGeom);
return stat;
}
示例12: initialize
MStatus AlembicCurvesNode::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 curve
mOutGeometryAttr = tAttr.create("outCurve", "os", MFnData::kNurbsCurve);
status = tAttr.setArray(true);
status = tAttr.setReadable(true);
status = tAttr.setUsesArrayDataBuilder(true);
status = tAttr.setStorable(false);
status = tAttr.setWritable(false);
status = tAttr.setKeyable(false);
status = tAttr.setHidden(false);
status = addAttribute(mOutGeometryAttr);
// 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, mOutGeometryAttr);
status = attributeAffects(mFileNameAttr, mOutGeometryAttr);
status = attributeAffects(mIdentifierAttr, mOutGeometryAttr);
return status;
}
示例13: initialize
// initialize
// ------------
//! Initialises the Attributes on the node, and set the evaluation dependencies
MStatus NBuddySurfaceToBodyNode::initialize()
{
MStatus status;
//Function sets needed
MFnStringData stringData;
MFnPluginData dataFn;
MFnMatrixData matrixFn;
MFnGenericAttribute genFn;
MFnTypedAttribute typedAttr;
MFnNumericAttribute numAttr;
MFnMatrixAttribute mAttr;
//Attribute that specifies if the object should be converted to worldspace or localspace
_useTransform = numAttr.create( "useTransform", "ut", MFnNumericData::kBoolean, true, &status );
NM_CheckMStatus(status, "ERROR creating useWorldSpace attribute.\n");
status = addAttribute( _useTransform );
//The input transform for the object
_inTransform = mAttr.create("inTransform","it", MFnMatrixAttribute::kDouble, &status);
mAttr.setStorable( true );
mAttr.setConnectable(true);
NM_CheckMStatus(status, "ERROR creating inTransform attribute.\n");
status = addAttribute( _inTransform );
NM_CheckMStatus(status, "ERROR adding inTransform attribute.\n");
//Create the inSurface plug
_inSurface = genFn.create( "inSurface", "surf", &status);
NM_CheckMStatus( status, "Failed to create inSurface GenericAttribute");
genFn.addAccept(MFnData::kNurbsSurface);
genFn.addAccept(MFnData::kMesh);
genFn.addAccept(MFnData::kSubdSurface);
genFn.setStorable(false);
genFn.setCached(false);
status = addAttribute( _inSurface );
NM_CheckMStatus(status, "ERROR adding inSurface attribute.\n");
// Create the attribute for the body output
_outBody = typedAttr.create("outBody","ob" , naiadBodyData::id , MObject::kNullObj , &status);
NM_CheckMStatus(status, "ERROR creating outBody attribute.\n");
typedAttr.setKeyable( false );
typedAttr.setWritable( false );
typedAttr.setReadable( true );
typedAttr.setStorable( false );
status = addAttribute( _outBody );
NM_CheckMStatus(status, "ERROR adding outBody attribute.\n");
// Create the attribute for the body name
_bodyName = typedAttr.create( "bodyName", "bn", MFnData::kString ,stringData.create( MString("mesh-body") ), &status);
NM_CheckMStatus( status, "Failed to create bodyName attribute");
typedAttr.setStorable( true );
typedAttr.setArray( false );
status = addAttribute( _bodyName );
NM_CheckMStatus( status, "Failed to add bodyName plug");
//Tesselation settings
_subDivide = numAttr.create( "subDivide", "td", MFnNumericData::kInt , 0, &status);
NM_CheckMStatus( status, "Failed to create subDivide attribute");
numAttr.setStorable( true );
numAttr.setArray( false );
status = addAttribute( _subDivide );
NM_CheckMStatus( status, "Failed to add bodyName plug");
// Attribute affects
attributeAffects( _bodyName, _outBody );
attributeAffects( _subDivide, _outBody );
attributeAffects( _inSurface, _outBody );
attributeAffects( _useTransform, _outBody );
attributeAffects( _inTransform, _outBody );
return MS::kSuccess;
}
示例14: initialize
// create attributes
MStatus probeDeformerARAPNode::initialize(){
MFnTypedAttribute tAttr;
MFnNumericAttribute nAttr;
MFnEnumAttribute eAttr;
MFnMatrixAttribute mAttr;
MRampAttribute rAttr;
// this attr will be dirtied when ARAP recomputation is needed
aARAP = nAttr.create( "arap", "arap", MFnNumericData::kBoolean, true );
nAttr.setStorable(false);
nAttr.setKeyable(false);
nAttr.setHidden(true);
addAttribute( aARAP );
// this attr will be dirtied when weight recomputation is needed
aComputeWeight = nAttr.create( "computeWeight", "computeWeight", MFnNumericData::kBoolean, true );
nAttr.setStorable(false);
nAttr.setKeyable(false);
nAttr.setHidden(true);
addAttribute( aComputeWeight );
aMatrix = mAttr.create("probeMatrix", "pm");
mAttr.setStorable(false);
mAttr.setHidden(true);
mAttr.setArray(true);
mAttr.setUsesArrayDataBuilder(true);
mAttr.setDisconnectBehavior(MFnMatrixAttribute::kDelete);
addAttribute(aMatrix);
attributeAffects( aMatrix, outputGeom );
aInitMatrix = mAttr.create("initProbeMatrix", "ipm");
mAttr.setHidden(true);
mAttr.setArray(true);
mAttr.setStorable(true);
mAttr.setUsesArrayDataBuilder(true);
addAttribute(aInitMatrix);
attributeAffects( aInitMatrix, outputGeom );
aBlendMode = eAttr.create( "blendMode", "bm", BM_SRL );
eAttr.addField( "expSO+expSym", BM_SRL );
eAttr.addField( "expSE+expSym", BM_SSE );
eAttr.addField( "logmatrix3", BM_LOG3 );
eAttr.addField( "logmatrix4", BM_LOG4 );
eAttr.addField( "quat+linear", BM_SQL );
eAttr.addField( "linear", BM_AFF );
eAttr.addField( "off", BM_OFF );
eAttr.setStorable(true);
eAttr.setKeyable(false);
addAttribute( aBlendMode );
attributeAffects( aBlendMode, outputGeom );
aRotationConsistency = nAttr.create( "rotationConsistency", "rc", MFnNumericData::kBoolean, false );
nAttr.setKeyable(false);
nAttr.setStorable(true);
addAttribute( aRotationConsistency );
attributeAffects( aRotationConsistency, outputGeom );
aFrechetSum = nAttr.create( "frechetSum", "fs", MFnNumericData::kBoolean, false );
nAttr.setKeyable(false);
nAttr.setStorable(true);
addAttribute( aFrechetSum );
attributeAffects( aFrechetSum, outputGeom );
aNormaliseWeight = eAttr.create( "normaliseWeight", "nw", NM_LINEAR );
eAttr.addField( "NONE", NM_NONE );
eAttr.addField( "Linear", NM_LINEAR );
eAttr.addField( "Softmax", NM_SOFTMAX );
eAttr.setStorable(true);
addAttribute( aNormaliseWeight );
attributeAffects( aNormaliseWeight, outputGeom );
attributeAffects( aNormaliseWeight, aComputeWeight );
aWeightMode = eAttr.create( "weightMode", "wtm", WM_HARMONIC_COTAN );
eAttr.addField( "inverse", WM_INV_DISTANCE );
eAttr.addField( "cut-off", WM_CUTOFF_DISTANCE );
eAttr.addField( "draw", WM_DRAW );
// eAttr.addField( "harmonic-arap", WM_HARMONIC_ARAP);
eAttr.addField( "harmonic-cotan", WM_HARMONIC_COTAN);
eAttr.setStorable(true);
eAttr.setKeyable(false);
addAttribute( aWeightMode );
attributeAffects( aWeightMode, outputGeom );
attributeAffects( aWeightMode, aComputeWeight );
aConstraintMode = eAttr.create( "constraintMode", "ctm", CONSTRAINT_CLOSEST );
eAttr.addField( "neighbour", CONSTRAINT_NEIGHBOUR);
eAttr.addField( "closestFace", CONSTRAINT_CLOSEST );
eAttr.setStorable(true);
eAttr.setKeyable(false);
addAttribute( aConstraintMode );
attributeAffects( aConstraintMode, outputGeom );
attributeAffects( aConstraintMode, aARAP);
aTetMode = eAttr.create( "tetMode", "tm", TM_FACE );
eAttr.addField( "face", TM_FACE );
eAttr.addField( "edge", TM_EDGE );
eAttr.addField( "vertex", TM_VERTEX );
eAttr.addField( "vface", TM_VFACE );
eAttr.setStorable(true);
//.........这里部分代码省略.........
示例15: initialize
// add some additional inputs
MStatus HRBFSkinCluster::initialize()
{
std::cout << "called initialize" << std::endl;
MFnNumericAttribute numAttr;
MFnTypedAttribute typedAttr;
//MFnCompoundAttribute cmpdAttr;
MStatus returnStatus;
HRBFSkinCluster::rebuildHRBF = numAttr.create("RebuildHRBF", "rbld", MFnNumericData::kInt,
0, &returnStatus);
McheckErr(returnStatus, "ERROR creating rbld attribute\n");
returnStatus = addAttribute(HRBFSkinCluster::rebuildHRBF);
McheckErr(returnStatus, "ERROR adding rbld attribute\n");
HRBFSkinCluster::exportComposition = numAttr.create("ExportComp", "exprtC", MFnNumericData::kInt,
0, &returnStatus);
McheckErr(returnStatus, "ERROR creating exprtC attribute\n");
returnStatus = addAttribute(HRBFSkinCluster::exportComposition);
McheckErr(returnStatus, "ERROR adding exprtC attribute\n");
HRBFSkinCluster::exportHRBFSamples = typedAttr.create("ExportHRBFs", "exprtS", MFnNumericData::kString,
&returnStatus);
McheckErr(returnStatus, "ERROR creating exprtS attribute\n");
returnStatus = addAttribute(HRBFSkinCluster::exportHRBFSamples);
McheckErr(returnStatus, "ERROR adding exprtS attribute\n");
HRBFSkinCluster::exportHRBFValues = typedAttr.create("ExportHRBFv", "exprtV", MFnNumericData::kString,
&returnStatus);
McheckErr(returnStatus, "ERROR creating exprtV attribute\n");
returnStatus = addAttribute(HRBFSkinCluster::exportHRBFValues);
McheckErr(returnStatus, "ERROR adding exprtV attribute\n");
HRBFSkinCluster::useDQ = numAttr.create("UseDualQuaternions", "useDQ", MFnNumericData::kInt,
0, &returnStatus);
McheckErr(returnStatus, "ERROR creating useDQ attribute\n");
returnStatus = addAttribute(HRBFSkinCluster::useDQ);
McheckErr(returnStatus, "ERROR adding useDQ attribute\n");
HRBFSkinCluster::useHRBF = numAttr.create("UseHRBFCorrection", "useHRBF", MFnNumericData::kInt,
0, &returnStatus);
McheckErr(returnStatus, "ERROR creating useHRBF attribute\n");
returnStatus = addAttribute(HRBFSkinCluster::useHRBF);
McheckErr(returnStatus, "ERROR adding useHRBF attribute\n");
HRBFSkinCluster::checkHRBFAt = numAttr.create("checkHRBFAt", "chkHRBF", MFnNumericData::k3Double,
0, &returnStatus);
McheckErr(returnStatus, "ERROR creating checkHRBFAt attribute\n");
returnStatus = addAttribute(HRBFSkinCluster::checkHRBFAt);
McheckErr(returnStatus, "ERROR adding checkHRBFAt attribute\n");
// hierarchy information
// http://download.autodesk.com/us/maya/2011help/API/weight_list_node_8cpp-example.html#a15
HRBFSkinCluster::jointParentIdcs = numAttr.create("parentJointIDCS", "pJIDCS", MFnNumericData::kInt,
0, &returnStatus);
McheckErr(returnStatus, "ERROR creating pIDCS attribute\n");
numAttr.setArray(true);
returnStatus = addAttribute(HRBFSkinCluster::jointParentIdcs);
McheckErr(returnStatus, "ERROR adding pIDCS attribute\n");
// joint names
HRBFSkinCluster::jointNames = typedAttr.create("jointNames", "jNms", MFnData::kString,
&returnStatus);
McheckErr(returnStatus, "ERROR creating pIDCS attribute\n");
typedAttr.setArray(true);
returnStatus = addAttribute(HRBFSkinCluster::jointNames);
McheckErr(returnStatus, "ERROR adding jNms attribute\n");
// set up affects
returnStatus = attributeAffects(HRBFSkinCluster::rebuildHRBF,
HRBFSkinCluster::outputGeom);
McheckErr(returnStatus, "ERROR in attributeAffects with rebuildHRBF\n");
returnStatus = attributeAffects(HRBFSkinCluster::exportComposition,
HRBFSkinCluster::outputGeom);
McheckErr(returnStatus, "ERROR in attributeAffects with exportComposition\n");
returnStatus = attributeAffects(HRBFSkinCluster::exportHRBFSamples,
HRBFSkinCluster::outputGeom);
McheckErr(returnStatus, "ERROR in attributeAffects with exportHRBFSamples\n");
returnStatus = attributeAffects(HRBFSkinCluster::exportHRBFValues,
HRBFSkinCluster::outputGeom);
McheckErr(returnStatus, "ERROR in attributeAffects with exportHRBFValues\n");
returnStatus = attributeAffects(HRBFSkinCluster::useDQ,
HRBFSkinCluster::outputGeom);
McheckErr(returnStatus, "ERROR in attributeAffects with useDQ\n");
returnStatus = attributeAffects(HRBFSkinCluster::useHRBF,
HRBFSkinCluster::outputGeom);
McheckErr(returnStatus, "ERROR in attributeAffects with useHRBF\n");
returnStatus = attributeAffects(HRBFSkinCluster::jointParentIdcs,
HRBFSkinCluster::outputGeom);
McheckErr(returnStatus, "ERROR in attributeAffects with jointParentIdcs\n");
returnStatus = attributeAffects(HRBFSkinCluster::checkHRBFAt,
HRBFSkinCluster::outputGeom);
//.........这里部分代码省略.........