本文整理汇总了C++中MFnTypedAttribute::setHidden方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnTypedAttribute::setHidden方法的具体用法?C++ MFnTypedAttribute::setHidden怎么用?C++ MFnTypedAttribute::setHidden使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnTypedAttribute
的用法示例。
在下文中一共展示了MFnTypedAttribute::setHidden方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
MStatus testNpassiveNode::initialize()
{
MStatus stat;
MFnTypedAttribute tAttr;
inputGeom = tAttr.create("inputGeom", "ing", MFnData::kMesh, MObject::kNullObj, &stat );
//statCheck(stat, "failed to create inputGeom");
tAttr.setWritable(true);
tAttr.setStorable(true);
tAttr.setHidden(true);
currentState = tAttr.create("currentState", "cus", MFnData::kNObject, MObject::kNullObj, &stat );
// statCheck(stat, "failed to create currentState");
tAttr.setWritable(true);
tAttr.setStorable(false);
tAttr.setHidden(true);
startState = tAttr.create( "startState", "sts", MFnData::kNObject, MObject::kNullObj, &stat );
//statCheck(stat, "failed to create startState");
tAttr.setWritable(true);
tAttr.setStorable(false);
tAttr.setHidden(true);
MFnUnitAttribute uniAttr;
currentTime = uniAttr.create( "currentTime", "ctm" , MFnUnitAttribute::kTime, 0.0, &stat );
addAttribute(inputGeom);
addAttribute(currentTime);
addAttribute(startState);
addAttribute(currentState);
attributeAffects(inputGeom, startState);
attributeAffects(inputGeom, currentState);
attributeAffects(currentTime, currentState);
attributeAffects(currentTime, startState);
return MStatus::kSuccess;
}
示例2: initialize
MStatus AlembicCurvesDeformNode::initialize()
{
MStatus status;
MFnUnitAttribute uAttr;
MFnTypedAttribute tAttr;
MFnNumericAttribute nAttr;
MFnGenericAttribute gAttr;
MFnStringData emptyStringData;
MObject emptyStringObject = emptyStringData.create("");
// input time
mTimeAttr = uAttr.create("inTime", "tm", MFnUnitAttribute::kTime, 0.0);
status = uAttr.setStorable(true);
status = uAttr.setKeyable(true);
status = addAttribute(mTimeAttr);
// input file name
mFileNameAttr =
tAttr.create("fileName", "fn", MFnData::kString, emptyStringObject);
status = tAttr.setStorable(true);
status = tAttr.setUsedAsFilename(true);
status = tAttr.setKeyable(false);
status = addAttribute(mFileNameAttr);
// input identifier
mIdentifierAttr =
tAttr.create("identifier", "if", MFnData::kString, emptyStringObject);
status = tAttr.setStorable(true);
status = tAttr.setKeyable(false);
status = addAttribute(mIdentifierAttr);
// output for list of ArbGeomParams
mGeomParamsList = tAttr.create("ExocortexAlembic_GeomParams", "exo_gp",
MFnData::kString, emptyStringObject);
status = tAttr.setStorable(true);
status = tAttr.setKeyable(false);
status = tAttr.setHidden(false);
status = tAttr.setInternal(true);
status = addAttribute(mGeomParamsList);
// output for list of UserAttributes
mUserAttrsList = tAttr.create("ExocortexAlembic_UserAttributes", "exo_ua",
MFnData::kString, emptyStringObject);
status = tAttr.setStorable(true);
status = tAttr.setKeyable(false);
status = tAttr.setHidden(false);
status = tAttr.setInternal(true);
status = addAttribute(mUserAttrsList);
// create a mapping
status = attributeAffects(mTimeAttr, outputGeom);
status = attributeAffects(mFileNameAttr, outputGeom);
status = attributeAffects(mIdentifierAttr, outputGeom);
return status;
}
示例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: addAttribute
MStatus
PolyColourNode::initialize()
{
MStatus status;
MFnTypedAttribute attrFn;
MFnNumericAttribute attrNum;
MFnEnumAttribute enumFn;
m_inMesh = attrFn.create("inMesh", "im", MFnMeshData::kMesh);
attrFn.setStorable(false);
attrFn.setHidden(true);
/*
m_cpList = attrFn.create("inputComponents", "ics",MFnComponentListData::kComponentList);
attrFn.setStorable(true);
attrFn.setHidden(true);
attrFn.setConnectable(false);
*/
m_colors = attrFn.create("colors", "cols", MFnData::kDoubleArray);
attrFn.setStorable(false);
attrFn.setHidden(true);
m_colorsDest = attrFn.create("colorsDest", "colsd", MFnData::kDoubleArray);
attrFn.setStorable(false);
attrFn.setHidden(true);
//attrFn.setConnectable(false);
//m_verts = attrFn.create("verts", "vts",MFnData::kIntArray);
//attrFn.setStorable(true);
//attrFn.setHidden(false);
status = addAttribute( m_inMesh );
// status = addAttribute( m_cpList );
status = addAttribute( m_colors );
status = addAttribute( m_colorsDest );
//status = addAttribute( m_verts );
// status = attributeAffects( m_inMesh, m_outMesh );
// status = attributeAffects( m_cpList, m_outMesh );
return status;
}
示例5:
MStatus ParameterisedHolder<B>::initialize()
{
MStatus s;
MFnTypedAttribute tAttr;
MFnNumericAttribute nAttr;
aParameterisedClassName = tAttr.create( "className", "clas", MFnData::kString );
tAttr.setReadable(true);
tAttr.setWritable(true);
tAttr.setStorable(true);
tAttr.setConnectable(false);
tAttr.setHidden(true);
s = B::addAttribute( aParameterisedClassName );
assert(s);
aParameterisedVersion = nAttr.create("version", "ver", MFnNumericData::kInt, 1, &s );
assert(s);
nAttr.setReadable(true);
nAttr.setWritable(true);
nAttr.setStorable(true);
nAttr.setConnectable(false);
nAttr.setHidden(true);
s = B::addAttribute( aParameterisedVersion );
assert(s);
aParameterisedSearchPathEnvVar = tAttr.create("searchPathEnvVar", "spev", MFnData::kString );
tAttr.setReadable(true);
tAttr.setWritable(true);
tAttr.setStorable(true);
tAttr.setConnectable(false);
tAttr.setHidden(true);
s = B::addAttribute( aParameterisedSearchPathEnvVar );
assert(s);
MPxManipContainer::addToManipConnectTable( id );
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: addAttribute
//----------------------------------------------------------------------------------------------------------------------
// this method creates the attributes for our node and sets some default values etc
//----------------------------------------------------------------------------------------------------------------------
MStatus OceanNode::initialize(){
// Attributes to check whether the amplitude or wind vector have changed
m_wdx = 0.0;
m_wdz = 1.0;
m_ws = 100.0;
m_amp = 100.0;
m_res = 0;
MStatus status;
// an emum attribute for use with the resolution
MFnEnumAttribute enumAttr;
// resolution
m_resolution = enumAttr.create("resolution", "res", 0, &status);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to create \"resolution\" attribute");
enumAttr.addField("128x128", RES128);
enumAttr.addField("256x256", RES256);
enumAttr.addField("512x512", RES512);
enumAttr.addField("1024x1024", RES1024);
enumAttr.setKeyable(true);
status = addAttribute(m_resolution);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to add \"resolution\" attribute to OceanNode");
// now we are going to add several number attributes
MFnNumericAttribute numAttr;
// amplitde
m_amplitude = numAttr.create( "amplitude", "amp", MFnNumericData::kDouble, 100.0, &status );
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL( status , "Unable to create \"amplitude\" attribute" );
numAttr.setChannelBox( true );
// add attribute
status = addAttribute( m_amplitude );
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL( status , "Unable to add \"amplitude\" attribute to OceanNode" );
// frequency
m_frequency = numAttr.create("frequency", "frq", MFnNumericData::kDouble, 0.5, &status);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to create \"frequency\" attribute");
numAttr.setChannelBox(true);
status = addAttribute(m_frequency);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to add \"frequency\" attribute to OceanNodee");
// the wind speed inputs
MFnNumericAttribute windDirectionAttr;
m_windDirectionX = windDirectionAttr.create( "windDirectionX", "wdx", MFnNumericData::kDouble, 0.0, &status);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL( status, "Unable to create \"wdx\" attribute");
windDirectionAttr.setChannelBox(true);
windDirectionAttr.setMin(0.0);
windDirectionAttr.setMax(1.0);
// add attribute
status = addAttribute( m_windDirectionX );
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to add \"wdx\" attribute to OceanNode")
m_windDirectionZ = windDirectionAttr.create( "windDirectionZ", "wdz", MFnNumericData::kDouble, 0.5, &status);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL( status, "Unable to create \"wdy\" attribute");
windDirectionAttr.setChannelBox(true);
windDirectionAttr.setMin(0.0);
windDirectionAttr.setMax(1.0);
// add attribute
status = addAttribute( m_windDirectionZ );
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to add \"wdz\" attribute to OceanNode");
m_windSpeed = numAttr.create( "windSpeed", "ws", MFnNumericData::kDouble, 100.0, &status);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL( status, "Unable to create \"ws\" attribute");
numAttr.setChannelBox(true);
// add attribute
status = addAttribute( m_windSpeed );
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to add \"ws\" attribute to OceanNode");
MFnNumericAttribute chopAttr;
m_choppiness = chopAttr.create("chopiness", "chp", MFnNumericData::kDouble, 0.0, &status);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to create \"chopiness\" attribute");
chopAttr.setChannelBox(true);
chopAttr.setMax(2.0);
chopAttr.setMin(0.0);
// add attribute
status = addAttribute(m_choppiness);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to add \"choppiness\" attribute to OceanNode");
// now the time inputs
MFnNumericAttribute timeAttr;
m_time = timeAttr.create("time", "t", MFnNumericData::kDouble, 0.0, &status);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to create \"t\" attribute");
// Add the attribute
status = addAttribute(m_time);
timeAttr.setHidden(true);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to add \"t\" attribute to OceanNode");
// create the output attribute
MFnTypedAttribute typeAttr;
m_output = typeAttr.create("output", "out", MFnData::kMesh, &status);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to create \"output\" attribute");
typeAttr.setStorable(false);
typeAttr.setHidden(true);
status = addAttribute(m_output);
CHECK_STATUS_AND_RETURN_MSTATUS_IF_FAIL(status, "Unable to add \"output\" attribute to OceanNode");
//.........这里部分代码省略.........
示例9: addAttribute
//----------------------------------------------------------------------------
MStatus BPT_InsertVtx::initialize()
//----------------------------------------------------------------------------
{
MFnEnumAttribute FnEnumAttr;
MFnTypedAttribute FnTypedAttr;
MFnNumericAttribute FnFloatAttr;
MStatus status;
IVinMesh = FnTypedAttr.create("inMesh","in",MFnData::kMesh);
FnTypedAttr.setStorable(true);
//FnTypedAttr.setCached(false);
FnTypedAttr.setInternal(true);
IVoutMesh = FnTypedAttr.create("outMesh","out",MFnData::kMesh);
FnTypedAttr.setStorable(true);
FnTypedAttr.setWritable(false);
IVcount = FnFloatAttr.create("count","c",MFnNumericData::kLong);
FnFloatAttr.setStorable(true);
FnFloatAttr.setInternal(true);
FnFloatAttr.setKeyable(true);
FnFloatAttr.setMin(1);
FnFloatAttr.setSoftMax(15);
IVselEdgeIDs = FnTypedAttr.create("edgeIDs","eID",MFnData::kIntArray);
FnTypedAttr.setStorable(true);
FnTypedAttr.setHidden(true);
FnTypedAttr.setConnectable(false);
IVselVertIDs = FnTypedAttr.create("vertIDs","vID",MFnData::kIntArray);
FnTypedAttr.setStorable(true);
FnTypedAttr.setHidden(true);
FnTypedAttr.setConnectable(false);
IVoptions = FnTypedAttr.create("options","op",MFnData::kIntArray);
FnTypedAttr.setStorable(true);
FnTypedAttr.setHidden(true);
FnTypedAttr.setConnectable(false);
IVslide = FnFloatAttr.create("slide","sl",MFnNumericData::kDouble);
FnFloatAttr.setStorable(true);
FnFloatAttr.setInternal(true);
// FnFloatAttr.setMin(0.0);
// FnFloatAttr.setMax(1.0);
FnFloatAttr.setKeyable(true);
IVnormal = FnFloatAttr.create("alongNormal","an",MFnNumericData::kDouble);
FnFloatAttr.setStorable(true);
FnFloatAttr.setDefault(0.0);
FnFloatAttr.setKeyable(true);
IVslideRelative = FnFloatAttr.create("slideRelative","sr",MFnNumericData::kLong);
FnFloatAttr.setStorable(true);
FnFloatAttr.setMin(0.0);
FnFloatAttr.setMax(1.0);
FnFloatAttr.setKeyable(true);
IVnormalRelative = FnFloatAttr.create("normalRelative","nr",MFnNumericData::kLong);
FnFloatAttr.setStorable(true);
FnFloatAttr.setMin(0.0);
FnFloatAttr.setMax(1.0);
FnFloatAttr.setKeyable(true);
IVwhichSide = FnFloatAttr.create("side","si",MFnNumericData::kLong);
FnFloatAttr.setStorable(true);
FnFloatAttr.setMin(0.0);
FnFloatAttr.setMax(1.0);
FnFloatAttr.setKeyable(true);
IVSlideLimited = FnFloatAttr.create("slideLimited","sll",MFnNumericData::kLong);
FnFloatAttr.setStorable(true);
FnFloatAttr.setMin(0.0);
FnFloatAttr.setMax(1.0);
FnFloatAttr.setKeyable(false);
IVspin = FnFloatAttr.create("spin","sp",MFnNumericData::kLong);
FnFloatAttr.setStorable(true);
FnFloatAttr.setMin(0.0);
FnFloatAttr.setKeyable(true);
FnFloatAttr.setInternal(true);
//.........这里部分代码省略.........
示例10: MCHECKERR
// Create and Add Attributes
//
// 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
MayaPolySmooth::initialize() {
MStatus stat;
MFnCompoundAttribute cAttr;
MFnEnumAttribute eAttr;
MFnGenericAttribute gAttr;
MFnLightDataAttribute lAttr;
MFnMatrixAttribute mAttr;
MFnMessageAttribute msgAttr;
MFnNumericAttribute nAttr;
MFnTypedAttribute tAttr;
MFnUnitAttribute uAttr;
// MAYA_NODE_BUILDER:BEG [ATTRIBUTE CREATION] ==========
// a_inputPolymesh : This is a description for this attribute
a_inputPolymesh = tAttr.create("inputPolymesh", "ip", MFnData::kMesh, MObject::kNullObj, &stat);
MCHECKERR( stat, "cannot create MayaPolySmooth::inputPolymesh" );
stat = tAttr.setReadable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::inputPolymesh.setReadable()" );
stat = tAttr.setWritable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::inputPolymesh.setWritable()" );
stat = tAttr.setHidden(true);
MCHECKERR( stat, "cannot MayaPolySmooth::inputPolymesh.setHidden()" );
stat = addAttribute( a_inputPolymesh );
MCHECKERR( stat, "cannot MayaPolySmooth::addAttribute(a_inputPolymesh)" );
// a_output : This is a description for this attribute
a_output = tAttr.create("output", "out", MFnData::kMesh, MObject::kNullObj, &stat);
MCHECKERR( stat, "cannot create MayaPolySmooth::output" );
stat = tAttr.setReadable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::output.setReadable()" );
stat = tAttr.setWritable(false);
MCHECKERR( stat, "cannot MayaPolySmooth::output.setWritable()" );
stat = tAttr.setHidden(true);
MCHECKERR( stat, "cannot MayaPolySmooth::output.setHidden()" );
stat = addAttribute( a_output );
MCHECKERR( stat, "cannot MayaPolySmooth::addAttribute(a_output)" );
// a_subdivisionLevels : The number of recursive quad subdivisions to perform on each face.
a_subdivisionLevels = nAttr.create("subdivisionLevels", "sl", MFnNumericData::kInt, 0.0, &stat);
MCHECKERR( stat, "cannot create MayaPolySmooth::subdivisionLevels" );
stat = nAttr.setDefault(2);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setDefault(2)" );
stat = nAttr.setMin(0);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setMin(0)" );
stat = nAttr.setMax(10);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setMax(10)" );
stat = nAttr.setSoftMax(4);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setSoftMax(4)" );
stat = nAttr.setReadable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setReadable()" );
stat = nAttr.setWritable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::subdivisionLevels.setWritable()" );
stat = addAttribute( a_subdivisionLevels );
MCHECKERR( stat, "cannot MayaPolySmooth::addAttribute(a_subdivisionLevels)" );
// a_recommendedIsolation : The number of recursive quad subdivisions to perform on each face.
a_recommendedIsolation = nAttr.create("recommendedIsolation", "ri", MFnNumericData::kInt, 0.0, &stat);
MCHECKERR( stat, "cannot create MayaPolySmooth::recommendedIsolation" );
stat = nAttr.setDefault(2);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setDefault(0)" );
stat = nAttr.setMin(0);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setMin(0)" );
stat = nAttr.setMax(10);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setSoftMax(10)" );
stat = nAttr.setReadable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setReadable()" );
stat = nAttr.setWritable(false);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setWritable()" );
stat = nAttr.setHidden(false);
MCHECKERR( stat, "cannot MayaPolySmooth::recommendedIsolation.setHidden()" );
stat = addAttribute( a_recommendedIsolation );
MCHECKERR( stat, "cannot MayaPolySmooth::addAttribute(a_recommendedIsolation)" );
// a_vertBoundaryMethod : Controls how boundary edges and vertices are interpolated. <ul> <li>Smooth, Edges: Renderman: InterpolateBoundaryEdgeOnly</li> <li>Smooth, Edges and Corners: Renderman: InterpolateBoundaryEdgeAndCorner</li> </ul>
a_vertBoundaryMethod = eAttr.create("vertBoundaryMethod", "vbm", 0, &stat);
MCHECKERR( stat, "cannot create MayaPolySmooth::vertBoundaryMethod" );
stat = eAttr.addField("Interpolate Edges", k_BoundaryMethod_InterpolateBoundaryEdgeOnly);
MCHECKERR( stat, "cannot MayaPolySmooth::vertBoundaryMethod.addField(Interpolate Edges, k_BoundaryMethod_InterpolateBoundaryEdgeOnly)" );
stat = eAttr.addField("Interpolate Edges And Corners", k_BoundaryMethod_InterpolateBoundaryEdgeAndCorner);
MCHECKERR( stat, "cannot MayaPolySmooth::vertBoundaryMethod.addField(Interpolate Edges And Corners, k_BoundaryMethod_InterpolateBoundaryEdgeAndCorner)" );
stat = eAttr.setDefault(k_BoundaryMethod_InterpolateBoundaryEdgeOnly);
MCHECKERR( stat, "cannot MayaPolySmooth::vertBoundaryMethod.setDefault(k_BoundaryMethod_InterpolateBoundaryEdgeOnly)" );
stat = eAttr.setReadable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::vertBoundaryMethod.setReadable()" );
stat = eAttr.setWritable(true);
MCHECKERR( stat, "cannot MayaPolySmooth::vertBoundaryMethod.setWritable()" );
//.........这里部分代码省略.........
示例11: initialize
MStatus Trimmer::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
//
{
// This sample creates a single input float attribute and a single
// output float attribute.
//
MFnTypedAttribute tAttr;
MFnNumericAttribute nAttr;
MStatus stat;
maxLength = nAttr.create( "percentLength", "l", MFnNumericData::kFloat, 1.0f, &stat );
if ( !stat ) return stat;
nAttr.setMin( 0 );
nAttr.setMax( 1.0f );
nAttr.setWritable( true );
nAttr.setStorable( true );
inputData = tAttr.create( "input", "in", GrowerData::id, MObject::kNullObj, &stat );
if ( !stat ) return stat;
tAttr.setWritable( true );
tAttr.setReadable( true );
tAttr.setStorable(false);
tAttr.setHidden( true );
outputData = tAttr.create( "output", "out", GrowerData::id, MObject::kNullObj, &stat );
if ( !stat ) return stat;
tAttr.setWritable( false );
tAttr.setReadable( true );
tAttr.setStorable(false);
// Add the attributes we have created to the node
//
stat = addAttribute( maxLength );
if (!stat) {
stat.perror("addAttribute");
return stat;
}
stat = addAttribute( inputData );
if (!stat) {
stat.perror("addAttribute");
return stat;
}
stat = addAttribute( outputData );
if (!stat) {
stat.perror("addAttribute");
return stat;
}
// 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.
//
stat = attributeAffects( maxLength, outputData );
if (!stat) {
stat.perror("attributeAffects");
return stat;
}
stat = attributeAffects( inputData, outputData );
if (!stat) {
stat.perror("attributeAffects");
return stat;
}
return MS::kSuccess;
}
示例12: initialize
MStatus puttyNode::initialize()
{
MStatus status;
MFnNumericAttribute nAttr;
MFnEnumAttribute eAttr;
MFnTypedAttribute tAttr;
MFnMatrixAttribute mAttr;
// the script
aScript = tAttr.create( "script", "scr", MFnData::kString);
tAttr.setStorable(true);
tAttr.setKeyable(false);
SYS_ERROR_CHECK( addAttribute( aScript ), "adding aScript" );
aCmdBaseName = tAttr.create( "cmdBaseName", "cbn", MFnData::kString);
tAttr.setStorable(true);
tAttr.setKeyable(false);
tAttr.setHidden(true);
SYS_ERROR_CHECK( addAttribute( aCmdBaseName ), "adding aCmdBaseName" );
// refresh
aSource = nAttr.create( "source", "src", MFnNumericData::kBoolean, 0 );
nAttr.setHidden(true);
SYS_ERROR_CHECK( addAttribute( aSource ), "adding aSource" );
// it is important that script sourced is initialised false and not storable
// so this way the function gets sourced on maya startup
aScriptSourced = nAttr.create( "scriptSourced", "ssrc", MFnNumericData::kBoolean, 0 );
nAttr.setStorable(false);
nAttr.setHidden(true);
SYS_ERROR_CHECK( addAttribute( aScriptSourced ), "adding aScriptSourced" );
aNodeReady = nAttr.create( "nodeReady", "nr", MFnNumericData::kBoolean, 0 );
nAttr.setHidden(true);
SYS_ERROR_CHECK( addAttribute( aNodeReady ), "adding aNodeReady" );
aDynDirty = nAttr.create( "dynDirty", "dd", MFnNumericData::kBoolean, 0 );
nAttr.setHidden(true);
SYS_ERROR_CHECK( addAttribute( aDynDirty ), "adding aDynDirty" );
// space
aDefSpace = eAttr.create("deformerSpace", "dsp", MSD_SPACE_OBJECT, &status);
eAttr.addField("object (default)", MSD_SPACE_OBJECT);
eAttr.addField("world (automatic conversion)", MSD_SPACE_WORLD);
eAttr.setKeyable(false);
eAttr.setStorable(true);
SYS_ERROR_CHECK( addAttribute( aDefSpace ), "adding aDefSpace" );
// envelope
aDefEnvelope = eAttr.create("deformerEnvelope", "de", MSD_ENVELOPE_AUTO, &status);
eAttr.addField("auto", MSD_ENVELOPE_AUTO);
eAttr.addField("user", MSD_ENVELOPE_USER);
eAttr.setKeyable(false);
eAttr.setStorable(true);
SYS_ERROR_CHECK( addAttribute( aDefEnvelope ), "adding aDefEnvelope" );
// weights
aDefWeights = eAttr.create("deformerWeights", "dw", MSD_WEIGHTS_AUTO, &status);
eAttr.addField("auto", MSD_WEIGHTS_AUTO);
eAttr.addField("user", MSD_WEIGHTS_USER);
eAttr.setKeyable(false);
eAttr.setStorable(true);
SYS_ERROR_CHECK( addAttribute( aDefWeights ), "adding aDefWeights" );
/////////////////////////////////////////////////////////////////////////////
// current values
aCurrPosition = tAttr.create( "currentPosition", "cpos", MFnData::kVectorArray);
tAttr.setStorable(false);
tAttr.setKeyable(false);
tAttr.setConnectable(false);
tAttr.setWritable(false);
SYS_ERROR_CHECK( addAttribute( aCurrPosition ), "adding aCurrPos" );
aCurrWeight = tAttr.create( "currentWeight", "cwgh", MFnData::kDoubleArray);
tAttr.setStorable(false);
tAttr.setKeyable(false);
tAttr.setConnectable(false);
tAttr.setWritable(false);
SYS_ERROR_CHECK( addAttribute( aCurrWeight ), "adding aCurrWeight" );
aCurrMultiIndex = nAttr.create("currentMultiIndex","cmi",MFnNumericData::kInt);
nAttr.setStorable(false);
nAttr.setKeyable(false);
nAttr.setConnectable(false);
nAttr.setWritable(false);
SYS_ERROR_CHECK( addAttribute( aCurrMultiIndex ), "adding aCurrMultiIndex" );
aCurrWorldMatrix = mAttr.create("currentWorldMatrix","cwm");
mAttr.setStorable(false);
mAttr.setKeyable(false);
mAttr.setConnectable(false);
mAttr.setWritable(false);
SYS_ERROR_CHECK( addAttribute( aCurrWorldMatrix ), "adding aCurrObjectName" );
/*
//.........这里部分代码省略.........
示例13: 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;
}
示例14: initialize
MStatus rigidBodyNode::initialize()
{
MStatus status;
MFnMessageAttribute fnMsgAttr;
MFnNumericAttribute fnNumericAttr;
MFnMatrixAttribute fnMatrixAttr;
MFnTypedAttribute typedAttr;
ia_collisionShape = fnMsgAttr.create("inCollisionShape", "incs", &status);
MCHECKSTATUS(status, "creating inCollisionShape attribute")
status = addAttribute(ia_collisionShape);
MCHECKSTATUS(status, "adding inCollisionShape attribute")
ia_solver = fnMsgAttr.create("solver", "solv", &status);
MCHECKSTATUS(status, "creating solver attribute")
status = addAttribute(ia_solver);
MCHECKSTATUS(status, "adding solver attribute")
ia_mass = fnNumericAttr.create("mass", "ma", MFnNumericData::kDouble, 1.0, &status);
MCHECKSTATUS(status, "creating mass attribute")
fnNumericAttr.setKeyable(true);
status = addAttribute(ia_mass);
MCHECKSTATUS(status, "adding mass attribute")
ia_restitution = fnNumericAttr.create("restitution", "rst", MFnNumericData::kDouble, 0.1, &status);
MCHECKSTATUS(status, "creating restitution attribute")
fnNumericAttr.setKeyable(true);
status = addAttribute(ia_restitution);
MCHECKSTATUS(status, "adding restitution attribute")
ia_friction = fnNumericAttr.create("friction", "fc", MFnNumericData::kDouble, 0.5, &status);
MCHECKSTATUS(status, "creating friction attribute")
fnNumericAttr.setKeyable(true);
status = addAttribute(ia_friction);
MCHECKSTATUS(status, "adding friction attribute")
ia_linearDamping = fnNumericAttr.create("linearDamping", "ld", MFnNumericData::kDouble, 0.3, &status);
MCHECKSTATUS(status, "creating linearDamping attribute")
fnNumericAttr.setKeyable(true);
status = addAttribute(ia_linearDamping);
MCHECKSTATUS(status, "adding linearDamping attribute")
ia_angularDamping = fnNumericAttr.create("angularDamping", "ad", MFnNumericData::kDouble, 0.3, &status);
MCHECKSTATUS(status, "creating angularDamping attribute")
fnNumericAttr.setKeyable(true);
status = addAttribute(ia_angularDamping);
MCHECKSTATUS(status, "adding angularDamping attribute")
ia_initialPosition = fnNumericAttr.createPoint("initialPosition", "inpo", &status);
MCHECKSTATUS(status, "creating initialPosition attribute")
status = addAttribute(ia_initialPosition);
MCHECKSTATUS(status, "adding initialPosition attribute")
ia_initialRotation = fnNumericAttr.createPoint("initialRotation", "inro", &status);
MCHECKSTATUS(status, "creating initialRotation attribute")
status = addAttribute(ia_initialRotation);
MCHECKSTATUS(status, "adding initialRotation attribute")
ia_initialVelocity = fnNumericAttr.createPoint("initialVelocity", "inve", &status);
MCHECKSTATUS(status, "creating initialVelocity attribute")
status = addAttribute(ia_initialVelocity);
MCHECKSTATUS(status, "adding initialVelocity attribute")
ia_initialSpin = fnNumericAttr.createPoint("initialSpin", "insp", &status);
MCHECKSTATUS(status, "creating initialSpin attribute")
status = addAttribute(ia_initialSpin);
MCHECKSTATUS(status, "adding initialSpin attribute")
ia_externalForce = fnNumericAttr.createPoint("externalForce", "exfo", &status);
MCHECKSTATUS(status, "creating externalForce attribute")
status = addAttribute(ia_externalForce);
MCHECKSTATUS(status, "adding externalForce attribute")
ia_externalTorque = fnNumericAttr.createPoint("externalTorque", "exto", &status);
MCHECKSTATUS(status, "creating externalTorque attribute")
status = addAttribute(ia_externalTorque);
MCHECKSTATUS(status, "adding externalTorque attribute")
ca_rigidBody = fnNumericAttr.create("ca_rigidBody", "carb", MFnNumericData::kBoolean, 0, &status);
MCHECKSTATUS(status, "creating ca_rigidBody attribute")
fnNumericAttr.setConnectable(false);
fnNumericAttr.setHidden(true);
fnNumericAttr.setStorable(false);
fnNumericAttr.setKeyable(false);
status = addAttribute(ca_rigidBody);
MCHECKSTATUS(status, "adding ca_rigidBody attribute")
ca_rigidBodyParam = fnNumericAttr.create("ca_rigidBodyParam", "carbp", MFnNumericData::kBoolean, 0, &status);
MCHECKSTATUS(status, "creating ca_rigidBodyParam attribute")
fnNumericAttr.setConnectable(false);
fnNumericAttr.setHidden(true);
fnNumericAttr.setStorable(false);
fnNumericAttr.setKeyable(false);
status = addAttribute(ca_rigidBodyParam);
MCHECKSTATUS(status, "adding ca_rigidBodyParam attribute")
ca_solver = fnNumericAttr.create("ca_solver", "caso", MFnNumericData::kBoolean, 0, &status);
MCHECKSTATUS(status, "creating ca_solver attribute")
fnNumericAttr.setConnectable(false);
fnNumericAttr.setHidden(true);
//.........这里部分代码省略.........
示例15: 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 );
//.........这里部分代码省略.........