本文整理汇总了C++中MFnEnumAttribute::setStorable方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnEnumAttribute::setStorable方法的具体用法?C++ MFnEnumAttribute::setStorable怎么用?C++ MFnEnumAttribute::setStorable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnEnumAttribute
的用法示例。
在下文中一共展示了MFnEnumAttribute::setStorable方法的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: 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"));
};
示例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 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;
}
示例5: 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;
}
示例6: 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 );
}
示例7: 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;
}
示例8: initialize
MStatus Point::initialize() {
MFnNumericAttribute nAttr;
input_display = nAttr.create("display", "display", MFnNumericData::kInt, 1);
nAttr.setKeyable(true);
nAttr.setMin(0);
nAttr.setMax(1);
addAttribute(input_display);
input_box = nAttr.create("box", "box", MFnNumericData::kInt, 0);
nAttr.setKeyable(true);
nAttr.setMin(0);
nAttr.setMax(1);
addAttribute(input_box);
input_cross = nAttr.create("cross", "cross", MFnNumericData::kInt, 1);
nAttr.setKeyable(true);
nAttr.setMin(0);
nAttr.setMax(1);
addAttribute(input_cross);
input_tick = nAttr.create("tick", "tick", MFnNumericData::kInt, 0);
nAttr.setKeyable(true);
nAttr.setMin(0);
nAttr.setMax(1);
addAttribute(input_tick);
input_axis = nAttr.create("axis", "axis", MFnNumericData::kInt, 0);
nAttr.setKeyable(true);
nAttr.setMin(0);
nAttr.setMax(1);
addAttribute(input_axis);
MFnEnumAttribute eAttr;
input_color = eAttr.create("color", "color", MFnData::kNumeric);
eAttr.addField("Black", 0);
eAttr.addField("Grey", 1);
eAttr.addField("White", 2);
eAttr.addField("Red", 3);
eAttr.addField("Light red", 4);
eAttr.addField("Dark red", 5);
eAttr.addField("Green", 6);
eAttr.addField("Light green", 7);
eAttr.addField("Dark green", 8);
eAttr.addField("Blue", 9);
eAttr.addField("Light blue", 10);
eAttr.addField("Dark blue", 11);
eAttr.addField("Purple", 12);
eAttr.addField("Magenta", 13);
eAttr.addField("Brown", 14);
eAttr.addField("Yellow", 15);
eAttr.addField("Dark yellow", 16);
eAttr.addField("Orange", 17);
eAttr.setDefault(8);
eAttr.setKeyable(true);
eAttr.setStorable(true);
addAttribute(input_color);
colors.append(MColor(0.0f, 0.0f, 0.0f)); // black
colors.append(MColor(0.5f, 0.5f, 0.5f)); // grey
colors.append(MColor(1.0f, 1.0f, 1.0f)); // white
colors.append(MColor(1.0f, 0.0f, 0.0f)); // red
colors.append(MColor(1.0f, 0.6899999976158142f, 0.6899999976158142f)); // light_red
colors.append(MColor(0.5f, 0.0f, 0.0f)); // dark_red
colors.append(MColor(0.0f, 1.0f, 0.0f)); // green
colors.append(MColor(0.5f, 1.0f, 0.5f)); // light_green
colors.append(MColor(0.0f, 0.25f, 0.0f)); // dark_green
colors.append(MColor(0.1889999955892563f, 0.6299999952316284f, 0.6299999952316284f)); // blue
colors.append(MColor(0.3919999897480011f, 0.8629999756813049f, 1.0f)); // light_blue
colors.append(MColor(0.0f, 0.01600000075995922f, 0.37599998712539673f)); // dark_blue
colors.append(MColor(0.25f, 0.0f, 0.25f)); // purple
colors.append(MColor(1.0f, 0.0f, 1.0f)); // magenta
colors.append(MColor(0.75f, 0.2f, 0.0f)); // brown
colors.append(MColor(1.0f, 1.0f, 0.0f)); // yellow
colors.append(MColor(0.62117999792099f, 0.6299999952316284f, 0.1889999955892563f)); // dark_yellow
colors.append(MColor(1.0f, 0.5f, 0.0f)); // orange
return MS::kSuccess;
}
示例9: 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);
//.........这里部分代码省略.........
示例10: initialize
//initialize
MStatus Ocio_log_convert::initialize()
{
//MFnSets
MFnEnumAttribute eAttr;
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
//a_verbose
a_verbose = eAttr.create("verbose", "verbose", 1);
eAttr.addField("no verbose", 0);
eAttr.addField("verbose", 1);
addAttribute(a_verbose);
//a_input_color
a_input_color = nAttr.createColor("input_color", "input_color");
nAttr.setUsedAsColor(true);
nAttr.setStorable(true);
addAttribute(a_input_color);
//a_output_color
a_output_color = nAttr.createColor("output_color", "output_color");
nAttr.setUsedAsColor(true);
nAttr.setStorable(false);
addAttribute(a_output_color);
//a_env_or_file
a_env_or_file = eAttr.create("env_or_file", "env_or_file", 0);
eAttr.addField("OCIO Environment Variable", 0);
eAttr.addField("Custom Path", 1);
eAttr.setStorable(true);
addAttribute(a_env_or_file);
//a_last_env_or_file
a_last_env_or_file = nAttr.create("last_env_or_file", "last_env_or_file", MFnNumericData::kInt, 0);
nAttr.setHidden(true);
nAttr.setStorable(true);
addAttribute(a_last_env_or_file);
//a_config_file_path
a_config_file_path = tAttr.create("config_file_path", "config_file_path", MFnData::kString);
tAttr.setUsedAsFilename(true);
tAttr.setStorable(true);
addAttribute(a_config_file_path);
//a_last_config_file_path
a_last_config_file_path = tAttr.create("last_config_file_path", "last_config_file_path", MFnData::kString);
tAttr.setHidden(true);
tAttr.setStorable(true);
addAttribute(a_last_config_file_path);
//a_operation
a_operation = eAttr.create("operation", "operation", 0);
eAttr.addField("Log to Lin", 0);
eAttr.addField("Lin to Log", 1);
addAttribute(a_operation);
//a_last_operation
a_last_operation = nAttr.create("last_operation", "last_operation", MFnNumericData::kInt, 0);
nAttr.setHidden(true);
nAttr.setStorable(true);
addAttribute(a_last_operation);
//Attribute affects
attributeAffects(a_input_color, a_output_color);
attributeAffects(a_env_or_file, a_output_color);
attributeAffects(a_config_file_path, a_output_color);
attributeAffects(a_operation, a_output_color);
return MStatus::kSuccess;
}
示例11: 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);
//.........这里部分代码省略.........
示例12: doIt
MStatus unCreateRibbonSystem::doIt( const MArgList& args )
{
bool create = true;
MSelectionList activeList;
MStatus stat = MGlobal::getActiveSelectionList(activeList);
if (MS::kSuccess != stat)
{
MessageBox(0,"please select one joint first!",0,0);
return MS::kFailure;
}
if(activeList.length() != 1)
{
MessageBox(0,"please select ONLY one joint!",0,0);
return MS::kFailure;
}
MItSelectionList iter(activeList);
MDagPath dagPath;
for ( ; !iter.isDone(); iter.next())
{
stat = iter.getDagPath(dagPath);
break;
}
if(!stat)
{
MessageBox(0,"can't getDagPath!",0,0);
return MS::kFailure;
}
if(!dagPath.hasFn(MFn::kJoint))
{
MessageBox(0,"muse select joint node!",0,0);
return MS::kFailure;
}
MFnIkJoint joint(dagPath);
if(args.length())
create = args.asBool(0);
if(!create)
{
if(!joint.hasAttribute("unRibbonEnabled"))
{
MessageBox(0,"no ribbon system exists!",0,0);
return MS::kFailure;
}
removeRibbonAttributes(joint);
return MS::kSuccess;
}
if(joint.hasAttribute("unRibbonEnabled"))
{
MessageBox(0,"ribbon system already exists!",0,0);
return MS::kSuccess;
}
if(joint.hasAttribute("unParticleEnabled"))
{
if(MessageBox(0,"will delete particle system and attach a ribbon system to the joint,continue?",0,MB_YESNO) == IDNO)return MS::kFailure;
removeParticleAttributes(joint);
}
MFnNumericAttribute attr;
unRibbonEnabled = attr.create("unRibbonEnabled","enabled",MFnNumericData::kBoolean,true);
attr.setStorable(true);
unRibbonVisible = attr.create("unRibbonVisible","visible",MFnNumericData::kBoolean,true);
attr.setStorable(true);
attr.setKeyable(true);
unRibbonAbove = attr.create("unRibbonAbove","above",MFnNumericData::kFloat,20.0f);
attr.setStorable(true);
attr.setMin(0.0f);
attr.setMax(5000.0f);
attr.setKeyable(true);
unRibbonBelow = attr.create("unRibbonBelow","below",MFnNumericData::kFloat,20.0f);
attr.setStorable(true);
attr.setMin(0.0f);
attr.setMax(5000.0f);
attr.setKeyable(true);
unRibbonEdgesPerSecond = attr.create("unRibbonEdgesPerSecond","EdgePerSec",MFnNumericData::kShort,10);
attr.setStorable(true);
attr.setMin(0);
attr.setMax(100);
unRibbonEdgeLife = attr.create("unRibbonEdgeLife","EdgeLife",MFnNumericData::kFloat,2.0f);
attr.setStorable(true);
attr.setMin(0.001f);
attr.setMax(100.0f);
unRibbonGravity = attr.create("unRibbonGravity","Gravity",MFnNumericData::kFloat,0.0f);
attr.setStorable(true);
attr.setMin(-1000.0f);
attr.setMax(1000.0f);
unRibbonTextureRows = attr.create("unRibbonTextureRows","TextureRows",MFnNumericData::kShort,1);
attr.setStorable(true);
attr.setMin(1);
attr.setMax(16);
unRibbonTextureCols = attr.create("unRibbonTextureCols","TextureCols",MFnNumericData::kShort,1);
attr.setStorable(true);
attr.setMin(1);
attr.setMax(16);
//.........这里部分代码省略.........
示例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 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;
}
示例15: 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);
//.........这里部分代码省略.........