本文整理汇总了C++中MFnEnumAttribute::addField方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnEnumAttribute::addField方法的具体用法?C++ MFnEnumAttribute::addField怎么用?C++ MFnEnumAttribute::addField使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnEnumAttribute
的用法示例。
在下文中一共展示了MFnEnumAttribute::addField方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
MStatus sgLockAngleMatrix::initialize()
{
MStatus status;
MFnMatrixAttribute mAttr;
MFnNumericAttribute nAttr;
MFnEnumAttribute eAttr;
aBaseMatrix = mAttr.create( "baseMatrix", "baseMatrix" );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aBaseMatrix ) );
aInputMatrix = mAttr.create( "inputMatrix", "inputMatrix" );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputMatrix ) );
aAngleAxis = eAttr.create( "angleAxis", "angleAxis" );
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.setStorable( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aAngleAxis ) );
aInputAngle = nAttr.create( "inputAngle", "inputAngle", MFnNumericData::kDouble, 45 );
nAttr.setStorable( true );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aInputAngle ) );
aOutputMatrix = mAttr.create( "outputMatrix", "outputMatrix" );
mAttr.setStorable( false );
CHECK_MSTATUS_AND_RETURN_IT( addAttribute( aOutputMatrix ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aBaseMatrix, aOutputMatrix ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputMatrix, aOutputMatrix ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aAngleAxis, aOutputMatrix ) );
CHECK_MSTATUS_AND_RETURN_IT( attributeAffects( aInputAngle, aOutputMatrix ) );
return MS::kSuccess;
}
示例2: initialize
MStatus liqCoordSysNode::initialize()
{
MFnEnumAttribute eAttr;
MFnNumericAttribute numAttr;
MStatus status;
aCoordType = eAttr.create( "type", "t", 0, &status );
eAttr.addField( "Card", 0 );
eAttr.addField( "Sphere", 1 );
eAttr.addField( "Cylinder", 2 );
eAttr.addField( "Cube", 3 );
eAttr.addField( "Deep Card", 4 );
eAttr.addField( "Clipping Plane", 5 );
MAKE_INPUT(eAttr);
CHECK_MSTATUS(eAttr.setConnectable(false));
CHECK_MSTATUS( addAttribute( aCoordType ) );
aCoordColor = numAttr.createColor( "coordColor", "cc", &status );
MAKE_INPUT(numAttr);
CHECK_MSTATUS( numAttr.setMin( 0.0, 0.0, 0.0 ) );
CHECK_MSTATUS( numAttr.setMax( 1.0, 1.0, 1.0 ) );
CHECK_MSTATUS( numAttr.setDefault( 0.0, 0.0, 0.5) );
CHECK_MSTATUS( addAttribute( aCoordColor ) );
aCoordOpacity = numAttr.create( "coordOpacity", "co", MFnNumericData::kFloat, 0.0, &status );
MAKE_INPUT(numAttr);
CHECK_MSTATUS( numAttr.setMin( 0.0 ) );
CHECK_MSTATUS( numAttr.setMax( 1.0 ) );
CHECK_MSTATUS( addAttribute( aCoordOpacity ) );
return MS::kSuccess;
}
示例3: 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;
}
示例4: 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;
}
示例5: create_enum_attribute
//create_enum_attribute
void Ocio_test::create_enum_attribute(std::string attribute_name,
std::vector<std::string>& value_list,
MObject& node)
{
//eAttr
MFnEnumAttribute eAttr;
//a_attribute
MObject a_attribute = eAttr.create(attribute_name.c_str(), attribute_name.c_str(), 0);
eAttr.setStorable(true);
//iterate and add values
for(int index = 0; index < value_list.size(); index++)
eAttr.addField(value_list[index].c_str(), index);
//dg_modifier
MDGModifier dg_modifier;
dg_modifier.addAttribute(node, a_attribute);
dg_modifier.doIt();
//reload AE
MGlobal::executeCommandOnIdle(MString("openAEWindow;"));
//tmp
MGlobal::displayInfo(MString("Reopened AE"));
};
示例6: 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;
}
示例7: 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 );
}
示例8: 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;
}
示例9: initialize
//initialize
//-----------------------------------------------
MStatus TesselationVisualization::initialize()
{
//Attr functionsets
MFnEnumAttribute eAttr;
MFnTypedAttribute tAttr;
MFnNumericAttribute nAttr;
//aVerbose
aVerbose = eAttr.create("verbose", "verbose", 0);
eAttr.addField("noVerbose", 0);
eAttr.addField("Verbose", 1);
addAttribute(aVerbose);
//aTesselationType
aTesselationType = eAttr.create("tesselationType", "tesselationType", 0);
eAttr.addField("Structural", 0);
eAttr.addField("Shear", 1);
addAttribute(aTesselationType);
//aInputGeo
aInputGeo = tAttr.create("inputGeo", "inputGeo", MFnData::kMesh);
tAttr.setReadable(false);
addAttribute(aInputGeo);
//aOutputGeo
aOutputGeo = tAttr.create("outputGeo", "outputGeo", MFnData::kMesh);
tAttr.setWritable(false);
tAttr.setStorable(false);
addAttribute(aOutputGeo);
//aCurrentFrame
aCurrentFrame = nAttr.create("currentFrame", "currentFrame", MFnNumericData::kFloat);
addAttribute(aCurrentFrame);
//AttributeAffects
attributeAffects(aTesselationType, aOutputGeo);
attributeAffects(aInputGeo, aOutputGeo);
attributeAffects(aCurrentFrame, aOutputGeo);
return MStatus::kSuccess;
};
示例10: MFnCompoundAttrAddEnum
void MFnCompoundAttrAddEnum( MFnCompoundAttribute &attr, const char* full, const char* brief, const char** pEnumStrings, unsigned short count, unsigned short def )
{
MStatus status;
MFnEnumAttribute enumAttr;
MObject enumObj = enumAttr.create( full, brief, def, &status );
for(short index = 0; index < count; ++index)
enumAttr.addField( pEnumStrings[index], index );
attr.addChild( enumObj );
}
示例11: addAttribute
MStatus
OpenSubdivShader::initialize()
{
MStatus stat;
MFnTypedAttribute typedAttr;
MFnNumericAttribute numAttr;
MFnEnumAttribute enumAttr;
aLevel = numAttr.create("level", "lv", MFnNumericData::kLong, 1);
numAttr.setInternal(true);
numAttr.setMin(1);
numAttr.setSoftMax(5);
aScheme = enumAttr.create("scheme", "sc");
enumAttr.addField("Catmull-Clark", kCatmark);
enumAttr.addField("Loop", kLoop);
enumAttr.addField("Bilinear", kBilinear);
enumAttr.setInternal(true);
aKernel = enumAttr.create("kernel", "kn");
enumAttr.addField("CPU", OpenSubdiv::OsdKernelDispatcher::kCPU);
if (OpenSubdiv::OsdKernelDispatcher::HasKernelType(OpenSubdiv::OsdKernelDispatcher::kOPENMP))
enumAttr.addField("OpenMP", OpenSubdiv::OsdKernelDispatcher::kOPENMP);
if (OpenSubdiv::OsdKernelDispatcher::HasKernelType(OpenSubdiv::OsdKernelDispatcher::kCL))
enumAttr.addField("CL", OpenSubdiv::OsdKernelDispatcher::kCL);
if (OpenSubdiv::OsdKernelDispatcher::HasKernelType(OpenSubdiv::OsdKernelDispatcher::kCUDA))
enumAttr.addField("CUDA", OpenSubdiv::OsdKernelDispatcher::kCUDA);
enumAttr.setInternal(true);
aDiffuse = numAttr.createColor("diffuse", "d");
numAttr.setDefault(1.0f, 1.0f, 1.0f);
aSpecular = numAttr.createColor("specular", "s");
numAttr.setDefault(1.0f, 1.0f, 1.0f);
aAmbient = numAttr.createColor("ambient", "a");
numAttr.setDefault(1.0f, 1.0f, 1.0f);
aShininess = numAttr.create("shininess", "shin", MFnNumericData::kFloat, 16.0f);
numAttr.setMin(0);
numAttr.setMax(128.0f);
aWireframe = numAttr.create("wireframe", "wf", MFnNumericData::kBoolean);
addAttribute(aLevel);
addAttribute(aScheme);
addAttribute(aKernel);
addAttribute(aDiffuse);
addAttribute(aSpecular);
addAttribute(aAmbient);
addAttribute(aShininess);
addAttribute(aWireframe);
return MS::kSuccess;
}
示例12: initialize
//
// DESCRIPTION:
MStatus fresnel::initialize()
{
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
MFnGenericAttribute gAttr;
MFnEnumAttribute eAttr;
MFnMessageAttribute mAttr;
MStatus status;
outColor = nAttr.createColor("outColor", "outColor");
MAKE_OUTPUT(nAttr);
CHECK_MSTATUS(addAttribute( outColor ));
//---------------------------- automatically created attributes start ------------------------------------
filename = tAttr.create("filename", "filename", MFnNumericData::kString);
CHECK_MSTATUS(addAttribute( filename ));
name = eAttr.create("name", "name", 0, &status);
status = eAttr.addField( "aluminium", 0 );
status = eAttr.addField( "amorphous carbon", 1 );
status = eAttr.addField( "silver", 2 );
status = eAttr.addField( "gold", 3 );
status = eAttr.addField( "copper", 4 );
MAKE_INPUT(eAttr);
CHECK_MSTATUS(addAttribute( name ));
luxOutFresnel = nAttr.create("luxOutFresnel", "luxOutFresnel", MFnNumericData::kFloat);
MAKE_OUTPUT(nAttr);
CHECK_MSTATUS(addAttribute( luxOutFresnel ));
CHECK_MSTATUS ( attributeAffects( filename, luxOutFresnel));
CHECK_MSTATUS ( attributeAffects( filename, outColor));
//---------------------------- automatically created attributes end ------------------------------------
return MS::kSuccess;
}
示例13: 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;
}
示例14: 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;
}
示例15: setMeshInterpolationAttribute
bool ToMayaMeshConverter::setMeshInterpolationAttribute( MObject &object, std::string interpolation )
{
MStatus st;
MFnMesh fnMesh(object, &st);
if ( !st )
{
return false;
}
int interpolationValue = 0;
FromMayaMeshConverter fromMaya(object);
const IECore::Parameter::PresetsContainer &presets = fromMaya.interpolationParameter()->presets();
IECore::Parameter::PresetsContainer::const_iterator it;
if ( interpolation != "default" )
{
int index = 0;
for ( it = presets.begin(); it != presets.end(); it++, index++ )
{
if ( interpolation == it->first || interpolation == IECore::staticPointerCast< IECore::StringData >(it->second)->readable() )
{
interpolationValue = index;
break;
}
}
if ( it == presets.end() )
{
return false;
}
}
MPlug interpPlug = fnMesh.findPlug( "ieMeshInterpolation", &st );
if ( !st )
{
MFnEnumAttribute fnAttrib;
MObject newAttr = fnAttrib.create( "ieMeshInterpolation", "interp", 0, &st );
if ( !st )
{
return false;
}
int index = 0;
for ( it = presets.begin(); it != presets.end(); it++ )
{
if ( it->first == "default" )
{
continue;
}
fnAttrib.addField( it->first.c_str(), index );
index++;
}
// looks like the attribute does not exist yet..
st = fnMesh.addAttribute( newAttr );
if ( !st )
{
return false;
}
interpPlug = fnMesh.findPlug( "ieMeshInterpolation", &st );
if ( !st )
{
return false;
}
}
st = interpPlug.setValue( interpolationValue );
if ( !st )
{
return false;
}
return true;
}