本文整理汇总了C++中MFnUnitAttribute::setDefault方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnUnitAttribute::setDefault方法的具体用法?C++ MFnUnitAttribute::setDefault怎么用?C++ MFnUnitAttribute::setDefault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MFnUnitAttribute
的用法示例。
在下文中一共展示了MFnUnitAttribute::setDefault方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: initialize
MStatus SwirlDeformer::initialize()
{
MFnMatrixAttribute mAttr;
deformSpace = mAttr.create( "deformSpace", "dSp" );
mAttr.setStorable( false );
MFnUnitAttribute unitFn;
startDist = unitFn.create( "startDist", "sd", MFnUnitAttribute::kDistance );
unitFn.setDefault( MDistance( 0.0, MDistance::uiUnit() ) );
unitFn.setMin( MDistance( 0.0, MDistance::uiUnit() ) );
unitFn.setKeyable( true );
endDist = unitFn.create( "endDist", "ed", MFnUnitAttribute::kDistance );
unitFn.setDefault( MDistance( 3.0, MDistance::uiUnit() ) );
unitFn.setMin( MDistance( 0.0, MDistance::uiUnit() ) );
unitFn.setKeyable( true );
addAttribute( deformSpace );
addAttribute( startDist );
addAttribute( endDist );
attributeAffects( deformSpace, outputGeom );
attributeAffects( startDist, outputGeom );
attributeAffects( endDist, outputGeom );
return MS::kSuccess;
}
示例2: initialize
MStatus arrowLocator::initialize()
{
//Here we create a new attribute type that handles units: angle, distance or time
MFnUnitAttribute uAttr;
windDirection = uAttr.create("windDirection", "wd", MFnUnitAttribute::kAngle, 0.0);
uAttr.setStorable(true);
uAttr.setWritable(true);
uAttr.setReadable(true);
uAttr.setKeyable(true);
uAttr.setDefault(MAngle(0.0, MAngle::kDegrees));
addAttribute(windDirection);
//- TODO: To make connection between your custom node and your custom
//- TODO: manipulator node, you need to name your custom manipulator
//- TODO: after your custom node type name, also in your custom node's initialize()
//- TODO: function, you need to call MPxManipContainer::addToManipConnectTable().
//- TODO: This method adds the user defined node as an entry in the manipConnectTable
//- TODO: so that when this node is selected the user can use the show manip tool to
//- TODO: get the user defined manipulator associated with this node.
//...
return MS::kSuccess;
}
示例3: initialize
MStatus BasicLocator::initialize()
{
MFnUnitAttribute unitFn;
MFnNumericAttribute numFn;
MStatus stat;
xWidth = unitFn.create( "xWidth", "xw", MFnUnitAttribute::kDistance );
unitFn.setDefault( MDistance(1.0, MDistance::uiUnit()) );
unitFn.setMin( MDistance(0.0, MDistance::uiUnit()) );
unitFn.setKeyable( true );
stat = addAttribute( xWidth );
if (!stat)
{
stat.perror( "Unable to add \"xWidth\" attribute" );
return stat;
}
zWidth = unitFn.create( "zWidth", "zw", MFnUnitAttribute::kDistance );
unitFn.setDefault( MDistance(1.0, MDistance::uiUnit()) );
unitFn.setMin( MDistance(0.0, MDistance::uiUnit()) );
unitFn.setKeyable( true );
stat = addAttribute( zWidth );
if (!stat)
{
stat.perror( "Unable to add \"zWidth\" attribute" );
return stat;
}
dispType = numFn.create( "dispType", "att", MFnNumericData::kShort );
numFn.setDefault( 0);
numFn.setMin( 0 );
numFn.setMax( 2 );
numFn.setKeyable( true );
stat = addAttribute( dispType );
if (!stat)
{
stat.perror( "Unable to add \"dispType\" attribute" );
return stat;
}
// Notify Maya that there is an associated manipulator for this particular type of node
MPxManipContainer::addToManipConnectTable( const_cast<MTypeId &>( typeId ) );
return MS::kSuccess;
}
示例4:
//- The initialize 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
//-
/*static*/ MStatus arrowLocator::initialize()
{
//- Here we create a new attribute type that handles units: angle, distance or time
MFnUnitAttribute uAttr;
windDirection = uAttr.create("windDirection", "wd", MFnUnitAttribute::kAngle, 0.0);
uAttr.setStorable(true);
uAttr.setWritable(true);
uAttr.setReadable(true);
uAttr.setKeyable(true);
uAttr.setMin(0.0);
uAttr.setMax(2*PI);
uAttr.setDefault(MAngle(0.0, MAngle::kRadians));
addAttribute(windDirection);
return MS::kSuccess;
}
示例5: initialize
MStatus footPrint::initialize()
{
MFnUnitAttribute unitFn;
MStatus stat;
size = unitFn.create( "size", "sz", MFnUnitAttribute::kDistance );
unitFn.setDefault( 1.0 );
stat = addAttribute( size );
if (!stat) {
stat.perror("addAttribute");
return stat;
}
return MS::kSuccess;
}
示例6:
//- The initialize 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
//-
/*static*/ MStatus arrowLocator::initialize()
{
//- Here we create a new attribute type that handles units: angle, distance or time
MFnUnitAttribute uAttr;
//- TODO: Create a angle attribute with long name "windDirection" and short name "wd"
windDirection = //...
uAttr.setStorable(true);
uAttr.setWritable(true);
uAttr.setReadable(true);
uAttr.setKeyable(true);
//- TODO: Set the min and max value this attribute can have 0, 2PI
//...
//...
uAttr.setDefault(MAngle(0.0, MAngle::kRadians));
addAttribute(windDirection);
return MS::kSuccess;
}
示例7:
MStatus TransformationMatrixParameterHandler<T>::setUnitVecDefaultValues( MPlug vecPlug, Imath::Vec3<T> &defaultValue ) const
{
if( vecPlug.numChildren() != 3 )
{
return MS::kFailure;
}
MFnUnitAttribute fnU;
for( unsigned int i=0; i<3; i++ )
{
fnU.setObject( vecPlug.child(i).attribute() );
if( !fnU.setDefault( defaultValue[i] ) )
{
return MS::kFailure;
}
}
return MS::kSuccess;
}
示例8: initialize
MStatus kgLocator::initialize()
{
MFnUnitAttribute unitFn;
MStatus stat;
//Let us inherit the attributes,
//in case we need it
MString parentClass("MPxLocatorNode");
stat = inheritAttributesFrom( parentClass );
//Create the height attribute
height = unitFn.create( "height", "h", MFnUnitAttribute::kDistance );
unitFn.setDefault( MDistance( 2.0, MDistance::uiUnit() ) );
unitFn.setMin( MDistance( 0.0, MDistance::uiUnit() ) );
stat = addAttribute( height );
if (!stat )
{
stat.perror( "Unable to add \"height\" attribute");
return stat;
}
//generates points for drwing the locator
getPoints( pts );
// Notify Maya that there is an associated manipulator for this particular type of node
MPxManipContainer::addToManipConnectTable( const_cast<MTypeId &>( id ) );
return MS::kSuccess;
}
示例9: initialize
MStatus swissArmyLocator::initialize()
{
MFnUnitAttribute unitFn;
MFnNumericAttribute numericFn;
MStatus stat;
MString method("swissArmyLocator::initialize");
MStatus s;
int counter = 0;
// aSize
aSize = unitFn.create("size", "sz", MFnUnitAttribute::kDistance,
0.0, &s); e;
unitFn.setDefault(10.0);
unitFn.setStorable(true);
unitFn.setWritable(true);
// aPoint
aPointX = numericFn.create("pointX", "ptx",
MFnNumericData::kDouble, 0.0, &s); e;
aPointY = numericFn.create("pointY", "pty",
MFnNumericData::kDouble, 0.0, &s); e;
aPointZ = numericFn.create("pointZ", "ptz",
MFnNumericData::kDouble, 0.0, &s); e;
aPoint = numericFn.create("point", "pt",
aPointX,
aPointY,
aPointZ, &s); e;
// aArrow1Angle
aArrow1Angle = unitFn.create("arrow1Angle", "a1a",
MFnUnitAttribute::kAngle, 0.0, &s); e;
// aArrow2Direction
aArrow2DirectionX = numericFn.create("arrow2DirectionX", "a2x",
MFnNumericData::kDouble, 1.0, &s); e;
aArrow2DirectionY = numericFn.create("arrow2DirectionY", "a2y",
MFnNumericData::kDouble, 0.0, &s); e;
aArrow2DirectionZ = numericFn.create("arrow2DirectionZ", "a2z",
MFnNumericData::kDouble, 0.0, &s); e;
aArrow2Direction = numericFn.create("arrow2Direction", "dir",
aArrow2DirectionX,
aArrow2DirectionY,
aArrow2DirectionZ, &s); e;
// aArrow3Angle
aArrow3Angle = unitFn.create("arrow3Angle", "a3a",
MFnUnitAttribute::kAngle, 0.0, &s); e;
// aArrow4Distance
aArrow4Distance = unitFn.create("arrow2Distance", "dis",
MFnUnitAttribute::kDistance, 0.0, &s); e;
// aState;
aState = numericFn.create("state", "s",
MFnNumericData::kLong, 0, &s); e;
// aToggle;
aToggle = numericFn.create("toggle", "t",
MFnNumericData::kBoolean, false, &s); e;
s = addAttribute(aPoint); e;
s = addAttribute(aArrow1Angle); e;
s = addAttribute(aArrow2Direction); e;
s = addAttribute(aArrow3Angle); e;
s = addAttribute(aArrow4Distance); e;
s = addAttribute(aState); e;
s = addAttribute(aToggle); e;
stat = addAttribute(aSize);
if (!stat) {
stat.perror("addAttribute");
return stat;
}
MPxManipContainer::addToManipConnectTable(id);
return MS::kSuccess;
}