本文整理汇总了C++中MFnEnumAttribute::setKeyable方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnEnumAttribute::setKeyable方法的具体用法?C++ MFnEnumAttribute::setKeyable怎么用?C++ MFnEnumAttribute::setKeyable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnEnumAttribute
的用法示例。
在下文中一共展示了MFnEnumAttribute::setKeyable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
MStatus BasicLocator::initialize()
{
//standard attribute creation for the locator node
MStatus status;
MFnNumericAttribute nAttr;
MFnEnumAttribute eAttr;
//output attribute
aIsDrawing = nAttr.create("draw", "d", MFnNumericData::kBoolean, 1);
nAttr.setWritable(true);
nAttr.setStorable(true);
addAttribute(aIsDrawing);
aIsTransparent = nAttr.create("transparent", "tpart", MFnNumericData::kFloat, 0.5);
nAttr.setMin(0.0);
nAttr.setMax(1.0);
nAttr.setWritable(true);
nAttr.setStorable(true);
addAttribute(aIsTransparent);
aShapeColor = nAttr.createColor("color", "col");
nAttr.setDefault(0.1, 0.1, 0.8);
nAttr.setStorable(true);
nAttr.setWritable(true);
addAttribute(aShapeColor);
aShapeType = eAttr.create("shapeType", "styp", 0);
eAttr.setStorable(true);
eAttr.setKeyable(true);
eAttr.addField("arrow", 0);
eAttr.addField("disc", 1);
addAttribute(aShapeType);
return MS::kSuccess;
}
示例2: 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;
}
示例3: 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;
}
示例4: Initialize
//-----------------------------------------------------------------------------
// Purpose: Initialize the node, add static attributes, etc...
// Output : MStatus::kSuccess if everything was ok
//-----------------------------------------------------------------------------
MStatus CVstExampleLocator::Initialize()
{
// Add a little enum attribute to control how it's drawn
MFnEnumAttribute eFn;
s_iaDisplayStyle = eFn.create( "displayStyle", "ds", 0 );
eFn.setKeyable ( true );
eFn.addField( "maya", 0 );
eFn.addField( "shaded", 1 );
eFn.addField( "wireframe", 2 );
eFn.addField( "points", 3 );
addAttribute(s_iaDisplayStyle);
return MS::kSuccess;
}
示例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
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;
}
示例7: initialize
MStatus mpBox::initialize()
{
MFnNumericAttribute nAttr;
MFnEnumAttribute enumAttr;
// add the custom attributes for mpBox //
_COMMON_ATTR_INIT_;
aXsize = nAttr.create( "xsize", "xsz", MFnNumericData::kFloat);
nAttr.setDefault(0.5f);
nAttr.setKeyable(1);
nAttr.setReadable(1);
nAttr.setWritable(1);
nAttr.setStorable(1);
aYsize = nAttr.create( "ysize", "ysz", MFnNumericData::kFloat);
nAttr.setDefault(0.5f);
nAttr.setKeyable(1);
nAttr.setReadable(1);
nAttr.setWritable(1);
nAttr.setStorable(1);
aZsize = nAttr.create( "zsize", "zsz", MFnNumericData::kFloat);
nAttr.setDefault(0.5f);
nAttr.setKeyable(1);
nAttr.setReadable(1);
nAttr.setWritable(1);
nAttr.setStorable(1);
aDrawType = enumAttr.create( "drawType" , "dt");
enumAttr.addField("wireframe", 0);
enumAttr.addField("shaded", 1);
enumAttr.addField("normal", 2);
enumAttr.setHidden(false);
enumAttr.setKeyable(true);
enumAttr.setDefault(2);
addAttribute(aXsize);
addAttribute(aYsize);
addAttribute(aZsize);
addAttribute(aDrawType);
return MS::kSuccess;
}
示例8: 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;
}
示例9: 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);
//.........这里部分代码省略.........
示例10: initialize
// Attributes initialisation
MStatus DA_GridGenerator::initialize()
{
MStatus stat;
MFnCompoundAttribute cAttr;
MFnNumericAttribute nAttr;
MFnEnumAttribute eAttr;
MFnTypedAttribute tAttr;
//
// Controls
//
aWidth = nAttr.create("width", "w", MFnNumericData::kDouble, 1.0);
nAttr.setMin(0.001);
nAttr.setChannelBox(true);
nAttr.setKeyable(true);
stat = addAttribute(aWidth);
CHECK_MSTATUS(stat);
aHeight = nAttr.create("height", "h", MFnNumericData::kDouble, 1.0);
nAttr.setMin(0.001);
nAttr.setChannelBox(true);
nAttr.setKeyable(true);
stat = addAttribute(aHeight);
CHECK_MSTATUS(stat);
aResolutionX = nAttr.create("resolutionX", "resx", MFnNumericData::kInt, 10);
nAttr.setMin(2);
nAttr.setChannelBox(true);
nAttr.setKeyable(true);
aResolutionY = nAttr.create("resolutionY", "resy", MFnNumericData::kInt, 10);
nAttr.setMin(2);
nAttr.setChannelBox(true);
nAttr.setKeyable(true);
aResolution = cAttr.create("resolution", "res");
stat = cAttr.addChild(aResolutionX);
CHECK_MSTATUS(stat);
stat = cAttr.addChild(aResolutionY);
CHECK_MSTATUS(stat);
stat = addAttribute(aResolution);
CHECK_MSTATUS(stat);
aPattern = eAttr.create("pattern","pat",0);
eAttr.addField(DA_GridGeneratorPatterns::NONE, 0);
eAttr.addField(DA_GridGeneratorPatterns::BRICK_U, 1);
eAttr.addField(DA_GridGeneratorPatterns::BRICK_V, 2);
eAttr.setChannelBox(true);
eAttr.setKeyable(true);
stat = addAttribute(aPattern);
CHECK_MSTATUS(stat);
//
// Outputs
//
aOutDynamicArray = tAttr.create("outDynamicArray", "oda", MFnData::kDynArrayAttrs);
tAttr.setWritable(false); // Just output
stat = addAttribute(aOutDynamicArray);
CHECK_MSTATUS(stat);
//
// Attributes affects
//
attributeAffects(aWidth, aOutDynamicArray);
attributeAffects(aHeight, aOutDynamicArray);
attributeAffects(aResolutionX, aOutDynamicArray);
attributeAffects(aResolutionY, aOutDynamicArray);
attributeAffects(aPattern, aOutDynamicArray);
// Done
return stat;
}
示例11: initialize
MStatus SurfaceAttach::initialize() {
MFnTypedAttribute fnTypeAttr;
MFnNumericAttribute fnNumAttr;
MFnUnitAttribute fnUnitAttr;
MFnCompoundAttribute fnCompoundAttr;
MFnEnumAttribute fnEnumAttr;
MFnMatrixAttribute fnMatAttr;
MStatus stat;
// Input Attributes
direction = fnEnumAttr.create("direction", "dire", 0);
fnEnumAttr.addField("U", 0);
fnEnumAttr.addField("V", 1);
surface = fnTypeAttr.create("surface", "surface", MFnData::kNurbsSurface);
parentInverse = fnMatAttr.create("parentInverse", "ps", MFnMatrixAttribute::kDouble);
fnMatAttr.setKeyable(true);
samples = fnNumAttr.create("samples", "samples", MFnNumericData::kInt, 1000);
fnNumAttr.setKeyable(true);
fnNumAttr.setMin(1.0);
staticLength = fnNumAttr.create("staticLength", "staticLength", MFnNumericData::kDouble, 0.0001);
fnNumAttr.setKeyable(true);
fnNumAttr.setMin(0.0001);
offset = fnNumAttr.create("offset", "offset", MFnNumericData::kDouble, 0.0);
fnNumAttr.setKeyable(true);
genus = fnEnumAttr.create("type", "type", 0);
fnEnumAttr.addField("Parametric", 0);
fnEnumAttr.addField("Percentage", 1);
fnEnumAttr.addField("FixedLength", 2);
fnEnumAttr.setKeyable(true);
reverse = fnNumAttr.create("reverse", "reverse", MFnNumericData::kBoolean, false);
fnNumAttr.setKeyable(true);
inU = fnNumAttr.create("inU", "U", MFnNumericData::kDouble, 0.5);
fnNumAttr.setKeyable(true);
inV = fnNumAttr.create("inV", "V", MFnNumericData::kDouble, 0.5);
fnNumAttr.setKeyable(true);
inUV = fnCompoundAttr.create("inUV", "inUV");
fnCompoundAttr.setKeyable(true);
fnCompoundAttr.setArray(true);
fnCompoundAttr.addChild(inU);
fnCompoundAttr.addChild(inV);
fnCompoundAttr.setUsesArrayDataBuilder(true);
// Output Attributes
translateX = fnNumAttr.create("translateX", "translateX", MFnNumericData::kDouble);
fnNumAttr.setWritable(false);
fnNumAttr.setStorable(false);
translateY = fnNumAttr.create("translateY", "translateY", MFnNumericData::kDouble);
fnNumAttr.setWritable(false);
fnNumAttr.setStorable(false);
translateZ = fnNumAttr.create("translateZ", "translateZ", MFnNumericData::kDouble);
fnNumAttr.setWritable(false);
fnNumAttr.setStorable(false);
translate = fnNumAttr.create("translate", "translate", translateX, translateY, translateZ);
fnNumAttr.setWritable(false);
fnNumAttr.setStorable(false);
rotateX = fnUnitAttr.create("rotateX", "rotateX", MFnUnitAttribute::kAngle);
fnUnitAttr.setWritable(false);
fnUnitAttr.setStorable(false);
rotateY = fnUnitAttr.create("rotateY", "rotateY", MFnUnitAttribute::kAngle);
fnUnitAttr.setWritable(false);
fnUnitAttr.setStorable(false);
rotateZ = fnUnitAttr.create("rotateZ", "rotateZ", MFnUnitAttribute::kAngle);
fnUnitAttr.setWritable(false);
fnUnitAttr.setStorable(false);
rotate = fnNumAttr.create("rotate", "rotate", rotateX, rotateY, rotateZ);
fnNumAttr.setWritable(false);
out = fnCompoundAttr.create("out", "out");
fnCompoundAttr.setWritable(false);
fnCompoundAttr.setArray(true);
fnCompoundAttr.addChild(translate);
fnCompoundAttr.addChild(rotate);
fnCompoundAttr.setUsesArrayDataBuilder(true);
// These aren't going to fail, give me a break :)
// Add Attributes
SurfaceAttach::addAttribute(direction);
SurfaceAttach::addAttribute(surface);
SurfaceAttach::addAttribute(parentInverse);
SurfaceAttach::addAttribute(samples);
SurfaceAttach::addAttribute(staticLength);
//.........这里部分代码省略.........
示例12: initialize
MStatus meshOpNode::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;
MFnEnumAttribute enumFn;
cpList = attrFn.create("inputComponents", "ics",
MFnComponentListData::kComponentList);
attrFn.setStorable(true); // To be stored during file-save
opType = enumFn.create("operationType", "oprt", 0, &status);
enumFn.addField("subd_edges", 0);
enumFn.addField("subd_faces", 1);
enumFn.setHidden(false);
enumFn.setKeyable(true);
enumFn.setStorable(true); // To be stored during file-save
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);
// Add the attributes we have created to the node
//
status = addAttribute( cpList );
if (!status)
{
status.perror("addAttribute");
return status;
}
status = addAttribute( opType );
if (!status)
{
status.perror("addAttribute");
return status;
}
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;
}
status = attributeAffects( cpList, outMesh );
if (!status)
{
status.perror("attributeAffects");
return status;
}
status = attributeAffects( opType, outMesh );
if (!status)
{
status.perror("attributeAffects");
return status;
}
return MS::kSuccess;
}
示例13: 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 );
//.........这里部分代码省略.........
示例14: initialize
MStatus worldSettingNode::initialize()
{
MStatus stat;
MFnNumericAttribute numAttr;
MFnEnumAttribute enumAttr;
backgroundTypes=enumAttr.create("BackgroundTypes","wbaty",0);
enumAttr.addField("Single Color",0);
enumAttr.addField("Gradient",1);
enumAttr.addField("Texture",2);
enumAttr.addField("Sunsky",3);
enumAttr.addField("DarkTide's Sunsky",4);
//MCHECKERROR(stat, "create background types");
enumAttr.setKeyable(true);
enumAttr.setStorable(true);
enumAttr.setHidden(true);
volumeInitTypes=enumAttr.create("VolumeTypes","wvoty",0);
enumAttr.addField("None",0);
enumAttr.addField("Single Scatter",1);
enumAttr.addField("Sky",2);
//MCHECKERROR(stat, "create volume types");
enumAttr.setKeyable(true);
enumAttr.setStorable(true);
DSSkyColorSpaces=enumAttr.create("DarkTideSunskyColorSpaces","wdasu",0);
enumAttr.addField("CIEE",0);
enumAttr.addField("CIED50",1);
enumAttr.addField("sRBGD65",2);
enumAttr.addField("sRGBD50",3);
//MCHECKERROR(stat, "create DarkTide's sunsky color spaces");
enumAttr.setKeyable(true);
enumAttr.setStorable(true);
backgroundColor=numAttr.createColor("BackgroundColor","wbaco");
numAttr.setKeyable(true);
numAttr.setStorable(true);
numAttr.setDefault(0.0,0.0,0.0);
//gradient attribute
horizonColor=numAttr.createColor("HorizonColor","whoco");
numAttr.setKeyable(true);
numAttr.setStorable(true);
numAttr.setDefault(0.1,0.8,0.5);
zenithColor=numAttr.createColor("ZenithColor","wzeco");
numAttr.setKeyable(true);
numAttr.setStorable(true);
numAttr.setDefault(0.4,0.5,0.1);
horGroundColor=numAttr.createColor("HorGroundColor","whgco");
numAttr.setKeyable(true);
numAttr.setStorable(true);
numAttr.setDefault(0.4,0.5,0.6);
zenGroundColor=numAttr.createColor("ZenGroundColor","wzgco");
numAttr.setKeyable(true);
numAttr.setStorable(true);
numAttr.setDefault(0.9,0.5,0.2);
//texture attribute
texRotation=numAttr.create("TextureRotation","wtero",MFnNumericData::kFloat,0.0);
numAttr.setKeyable(true);
numAttr.setStorable(true);
numAttr.setMin(0.0f);
numAttr.setMax(360.0f);
//sunsky attribute
turbidity=numAttr.create("Turbidity","wtu",MFnNumericData::kFloat,1.0);
numAttr.setKeyable(true);
numAttr.setStorable(true);
numAttr.setMin(1.0f);
numAttr.setMax(20.0f);
AHorBrght=numAttr.create("AHorBrght","wahb",MFnNumericData::kFloat,0.0);
numAttr.setKeyable(true);
numAttr.setStorable(true);
numAttr.setMin(0.0f);
numAttr.setMax(10.0f);
BHorSprd=numAttr.create("BHorSprd","wbhs",MFnNumericData::kFloat,0.0);
numAttr.setKeyable(true);
numAttr.setStorable(true);
numAttr.setMin(0.0f);
numAttr.setMax(10.0f);
CSunBrght=numAttr.create("CSunBrght","wcsb",MFnNumericData::kFloat,0.0);
numAttr.setKeyable(true);
numAttr.setStorable(true);
numAttr.setMin(0.0f);
numAttr.setMax(10.0f);
DSunSize=numAttr.create("DSunsize","wdss",MFnNumericData::kFloat,0.0);
numAttr.setKeyable(true);
numAttr.setStorable(true);
numAttr.setMin(0.0f);
numAttr.setMax(10.0f);
EBacklight=numAttr.create("EBacklight","webl",MFnNumericData::kFloat,0.0);
numAttr.setKeyable(true);
//.........这里部分代码省略.........
示例15: 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;
}