当前位置: 首页>>代码示例>>C++>>正文


C++ MFnUnitAttribute::setStorable方法代码示例

本文整理汇总了C++中MFnUnitAttribute::setStorable方法的典型用法代码示例。如果您正苦于以下问题:C++ MFnUnitAttribute::setStorable方法的具体用法?C++ MFnUnitAttribute::setStorable怎么用?C++ MFnUnitAttribute::setStorable使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MFnUnitAttribute的用法示例。


在下文中一共展示了MFnUnitAttribute::setStorable方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: initialize

MStatus timeControl::initialize()
{
	MStatus status;

	MFnNumericAttribute nAttr;
	MFnUnitAttribute uAttr;

	aOutTime = uAttr.create( "outTime", "outTime", MFnUnitAttribute::kTime, 0.0 );
	uAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aOutTime ) );

	aOutWeight = nAttr.create( "outWeight", "outWeight", MFnNumericData::kDouble, 0.0 );
	nAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aOutWeight ) );

	aInTime = uAttr.create( "inTime", "inTime", MFnUnitAttribute::kTime, 0.0 );
	uAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aInTime ) );
	CHECK_MSTATUS( attributeAffects( aInTime, aOutTime ) );

	aWeight = nAttr.create( "weight", "weight", MFnNumericData::kDouble, 10.0 );
	nAttr.setStorable( true );
	nAttr.setKeyable( true );
	CHECK_MSTATUS( addAttribute( aWeight ) );
	CHECK_MSTATUS( attributeAffects( aWeight, aOutWeight ) );

	aOffset = nAttr.create( "offset", "offset", MFnNumericData::kDouble, 0.0 );
	nAttr.setStorable( true );
	nAttr.setKeyable( true );
	CHECK_MSTATUS( addAttribute( aOffset ) );
	CHECK_MSTATUS( attributeAffects( aOffset, aOutTime ) );

	aMult = nAttr.create( "mult", "mult", MFnNumericData::kDouble, 1.0 );
	nAttr.setStorable( true );
	nAttr.setKeyable( true );
	CHECK_MSTATUS( addAttribute( aMult ) );
	CHECK_MSTATUS( attributeAffects( aMult, aOutTime ) );

	aLimitAble = nAttr.create( "limitAble", "limitAble", MFnNumericData::kBoolean, false );
	nAttr.setStorable( true );
	nAttr.setKeyable( true );
	CHECK_MSTATUS( addAttribute( aLimitAble ) );
	CHECK_MSTATUS( attributeAffects( aLimitAble, aOutTime ) );

	aMinTime = uAttr.create( "minTime", "minTime", MFnUnitAttribute::kTime, 1.0 );
	uAttr.setStorable( true );
	uAttr.setKeyable( true );
	CHECK_MSTATUS( addAttribute( aMinTime ) );
	CHECK_MSTATUS( attributeAffects( aMinTime, aOutTime ) );

	aMaxTime = uAttr.create( "maxTime", "maxTime", MFnUnitAttribute::kTime, 20.0 );
	uAttr.setStorable( true );
	uAttr.setKeyable( true );
	CHECK_MSTATUS( addAttribute( aMaxTime ) );
	CHECK_MSTATUS( attributeAffects( aMaxTime, aOutTime ) );


	return MS::kSuccess;
}
开发者ID:jonntd,项目名称:mayadev-1,代码行数:59,代码来源:timeControl.cpp

示例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;
}
开发者ID:ADN-DevTech,项目名称:Maya-Training-Material,代码行数:25,代码来源:arrowLocatorNode.cpp

示例3: initialize

MStatus ArrayAngleConstructorNode::initialize()
{
    MStatus status;

    MFnNumericAttribute N;
    MFnTypedAttribute T;
    MFnUnitAttribute U;

    aSize = N.create("size", "size", MFnNumericData::kInt, 8.0, &status);
    N.setKeyable(true);
    N.setStorable(true);
    N.setWritable(true);
    N.setDefault(8);

    aInput = U.create("input", "i", MFnUnitAttribute::kAngle, 0.0, &status);
    U.setKeyable(false);
    U.setStorable(true);
    U.setWritable(true);
    U.setArray(true);

    aOutput = T.create("output", "o", MFnData::kDoubleArray, &status);
    T.setKeyable(false);
    T.setChannelBox(false);
    T.setWritable(false);
    T.setStorable(false);

    addAttribute(aSize);
    addAttribute(aInput);
    addAttribute(aOutput);

    attributeAffects(aSize, aOutput);
    attributeAffects(aInput, aOutput);

    return MS::kSuccess;
}
开发者ID:sonictk,项目名称:arrayNodes,代码行数:35,代码来源:n_ctorAngle.cpp

示例4: initialize

MStatus simpleEvaluationNode::initialize()
{
	MFnNumericAttribute nAttr;
	MFnUnitAttribute    uAttr;
	MStatus				status;

	input = nAttr.create( "input", "in", MFnNumericData::kFloat, 2.0 );
 	nAttr.setStorable(true);

	aTimeInput = uAttr.create( "inputTime", "itm", MFnUnitAttribute::kTime, 0.0 );
	uAttr.setWritable(true);
	uAttr.setStorable(true);
    uAttr.setReadable(true);
    uAttr.setKeyable(true);

	output = nAttr.create( "output", "out", MFnNumericData::kFloat, 0.0 );
	nAttr.setWritable(false);
	nAttr.setStorable(false);

	status = addAttribute( input );
		if (!status) { status.perror("addAttribute"); return status;}
	status = addAttribute( aTimeInput );
		if (!status) { status.perror("addAttribute"); return status;}
	status = addAttribute( output );
		if (!status) { status.perror("addAttribute"); return status;}

	status = attributeAffects( input, output );
		if (!status) { status.perror("attributeAffects"); return status;}
	status = attributeAffects( aTimeInput, output );
		if (!status) { status.perror("attributeAffects"); return status;}

	return MS::kSuccess;
}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:33,代码来源:simpleEvaluationNode.cpp

示例5: 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;
}
开发者ID:BlackGinger,项目名称:ExocortexCrate,代码行数:57,代码来源:AlembicCurves.cpp

示例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;
	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;
}
开发者ID:JerryKon,项目名称:Maya-Training-Material,代码行数:21,代码来源:arrowLocatorNode.cpp

示例7:

//- 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;
}
开发者ID:ADN-DevTech,项目名称:Maya-Training-Material,代码行数:23,代码来源:arrowLocatorNode.cpp

示例8: 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;
}
开发者ID:bungnoid,项目名称:jhMeshBlur,代码行数:75,代码来源:jhMeshBlur.cpp

示例9: initialize

MStatus retargetLocator::initialize()
{
    MFnNumericAttribute nAttr;
	MFnMatrixAttribute mAttr;
	MFnEnumAttribute eAttr;
	MFnUnitAttribute uAttr;
	MFnCompoundAttribute cAttr;
	MFnTypedAttribute tAttr;
	
	aOutput = nAttr.create( "output", "output", MFnNumericData::kDouble );
	nAttr.setStorable( false );
	CHECK_MSTATUS( addAttribute( aOutput ) );

	aDiscMatrix = mAttr.create( "discMatrix", "discMatrix" );
	mAttr.setStorable( true );
	CHECK_MSTATUS( addAttribute( aDiscMatrix ) );
	CHECK_MSTATUS( attributeAffects( aDiscMatrix, aOutput ) );

	aDiscAxis = eAttr.create( "discAxis", "discAxis", 0 );
	eAttr.addField( "X", 0 );
	eAttr.addField( "Y", 1 );
	eAttr.addField( "Z", 2 );
	eAttr.setStorable( true );
	eAttr.setChannelBox( true );
	eAttr.setReadable( true );
	CHECK_MSTATUS( addAttribute( aDiscAxis ) );
	CHECK_MSTATUS( attributeAffects( aDiscAxis, aOutput ) );


	aDiscDivision = nAttr.create( "discDivision", "discDivision", MFnNumericData::kInt, 32 );
	nAttr.setMin( 1 );
	nAttr.setMax( 32 );
	nAttr.setStorable( true );
	nAttr.setChannelBox( true );
	CHECK_MSTATUS( addAttribute( aDiscDivision ) );
	CHECK_MSTATUS( attributeAffects( aDiscDivision, aOutput ) );


	aDiscAngle = uAttr.create( "discAngle", "discAngle", MFnUnitAttribute::kAngle, 0.0 );
	uAttr.setStorable( true );
	uAttr.setChannelBox( true );
	CHECK_MSTATUS( addAttribute( aDiscAngle ) );
	CHECK_MSTATUS( attributeAffects( aDiscAngle, aOutput ) );


	aDiscOffsetX = nAttr.create( "discOffsetX", "discOffsetX", MFnNumericData::kDouble, 0.0 );
	aDiscOffsetY = nAttr.create( "discOffsetY", "discOffsetY", MFnNumericData::kDouble, 0.0 );
	aDiscOffsetZ = nAttr.create( "discOffsetZ", "discOffsetZ", MFnNumericData::kDouble, 0.0 );
	aDiscOffset  = nAttr.create( "discOffset", "discOffset", aDiscOffsetX, aDiscOffsetY, aDiscOffsetZ );
	uAttr.setStorable( true );
	uAttr.setChannelBox( true );
	CHECK_MSTATUS( addAttribute( aDiscOffset ) );
	CHECK_MSTATUS( attributeAffects( aDiscOffset, aOutput ) );

	aDiscSizeX = nAttr.create( "discSizeX", "discSizeX", MFnNumericData::kDouble, 1.0 );
	aDiscSizeY = nAttr.create( "discSizeY", "discSizeY", MFnNumericData::kDouble, 1.0 );
	aDiscSizeZ = nAttr.create( "discSizeZ", "discSizeZ", MFnNumericData::kDouble, 1.0 );
	aDiscSize  = nAttr.create( "discSize", "discSize", aDiscSizeX, aDiscSizeY, aDiscSizeZ );
	uAttr.setStorable( true );
	uAttr.setChannelBox( true );
	CHECK_MSTATUS( addAttribute( aDiscSize ) );
	CHECK_MSTATUS( attributeAffects( aDiscSize, aOutput ) );


	aDiscActiveColor = nAttr.createColor( "discActiveColor", "discActiveColor" );
	nAttr.setStorable( true );
	nAttr.setUsedAsColor(true);
	nAttr.setDefault(1.0f, 1.0f, 1.0f);
	CHECK_MSTATUS( addAttribute( aDiscActiveColor ) );
	CHECK_MSTATUS( attributeAffects( aDiscActiveColor, aOutput ) );


	aDiscLeadColor = nAttr.createColor( "discLeadColor", "discLeadColor" );
	nAttr.setStorable( true );
	nAttr.setUsedAsColor(true);
	nAttr.setDefault(.263f, 1.0f, .639f);
	CHECK_MSTATUS( addAttribute( aDiscLeadColor ) );
	CHECK_MSTATUS( attributeAffects( aDiscLeadColor, aOutput ) );


	aDiscDefaultColor = nAttr.createColor( "discDefaultColor", "discDefaultColor" );
	nAttr.setStorable( true );
	nAttr.setUsedAsColor(true);
	nAttr.setDefault(.0f, .016f, .376f);
	CHECK_MSTATUS( addAttribute( aDiscDefaultColor ) );
	CHECK_MSTATUS( attributeAffects( aDiscDefaultColor, aOutput ) );

	aDiscFillAlpha = nAttr.create( "discFillAlpha", "discFillAlpha", MFnNumericData::kFloat, 0.1f );
	nAttr.setStorable( true );
	nAttr.setMin( 0.0f );
	nAttr.setMax( 1.0f );
	CHECK_MSTATUS( addAttribute( aDiscFillAlpha ) );
	CHECK_MSTATUS( attributeAffects( aDiscFillAlpha, aOutput ) );

	aDiscLineAlpha = nAttr.create( "discLineAlpha", "discLineAlpha", MFnNumericData::kFloat, 1.0f );
	nAttr.setStorable( true );
	nAttr.setMin( 0.0f );
	nAttr.setMax( 1.0f );
	CHECK_MSTATUS( addAttribute( aDiscLineAlpha ) );
	CHECK_MSTATUS( attributeAffects( aDiscLineAlpha, aOutput ) );
//.........这里部分代码省略.........
开发者ID:jonntd,项目名称:mayadev-1,代码行数:101,代码来源:retargetLocator.cpp

示例10: 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);
//.........这里部分代码省略.........
开发者ID:matsbtegner,项目名称:alembic,代码行数:101,代码来源:AlembicNode.cpp

示例11: initialize

MStatus SurfaceAttach::initialize() {
    MFnTypedAttribute fnTypeAttr;
    MFnNumericAttribute fnNumAttr;
    MFnUnitAttribute fnUnitAttr;
    MFnCompoundAttribute fnCompoundAttr;
    MFnEnumAttribute fnEnumAttr;
    MFnMatrixAttribute fnMatAttr;

    MStatus stat;

    // Input Attributes
    direction = fnEnumAttr.create("direction", "dire", 0);
    fnEnumAttr.addField("U", 0);
    fnEnumAttr.addField("V", 1);

    surface = fnTypeAttr.create("surface", "surface", MFnData::kNurbsSurface);

    parentInverse = fnMatAttr.create("parentInverse", "ps", MFnMatrixAttribute::kDouble);
    fnMatAttr.setKeyable(true);

    samples = fnNumAttr.create("samples", "samples", MFnNumericData::kInt, 1000);
    fnNumAttr.setKeyable(true);
    fnNumAttr.setMin(1.0);

    staticLength = fnNumAttr.create("staticLength", "staticLength", MFnNumericData::kDouble, 0.0001);
    fnNumAttr.setKeyable(true);
    fnNumAttr.setMin(0.0001);

    offset = fnNumAttr.create("offset", "offset", MFnNumericData::kDouble, 0.0);
    fnNumAttr.setKeyable(true);

    genus = fnEnumAttr.create("type", "type", 0);
    fnEnumAttr.addField("Parametric", 0);

    fnEnumAttr.addField("Percentage", 1);
    fnEnumAttr.addField("FixedLength", 2);
    fnEnumAttr.setKeyable(true);

    reverse = fnNumAttr.create("reverse", "reverse", MFnNumericData::kBoolean, false);
    fnNumAttr.setKeyable(true);

    inU = fnNumAttr.create("inU", "U", MFnNumericData::kDouble, 0.5);
    fnNumAttr.setKeyable(true);

    inV = fnNumAttr.create("inV", "V", MFnNumericData::kDouble, 0.5);
    fnNumAttr.setKeyable(true);

    inUV = fnCompoundAttr.create("inUV", "inUV");
    fnCompoundAttr.setKeyable(true);
    fnCompoundAttr.setArray(true);
    fnCompoundAttr.addChild(inU);
    fnCompoundAttr.addChild(inV);
    fnCompoundAttr.setUsesArrayDataBuilder(true);

    // Output Attributes
    translateX = fnNumAttr.create("translateX", "translateX", MFnNumericData::kDouble);
    fnNumAttr.setWritable(false);
    fnNumAttr.setStorable(false);

    translateY = fnNumAttr.create("translateY", "translateY", MFnNumericData::kDouble);
    fnNumAttr.setWritable(false);
    fnNumAttr.setStorable(false);

    translateZ = fnNumAttr.create("translateZ", "translateZ", MFnNumericData::kDouble);
    fnNumAttr.setWritable(false);
    fnNumAttr.setStorable(false);

    translate = fnNumAttr.create("translate", "translate", translateX, translateY, translateZ);
    fnNumAttr.setWritable(false);
    fnNumAttr.setStorable(false);

    rotateX = fnUnitAttr.create("rotateX", "rotateX", MFnUnitAttribute::kAngle);
    fnUnitAttr.setWritable(false);
    fnUnitAttr.setStorable(false);

    rotateY = fnUnitAttr.create("rotateY", "rotateY", MFnUnitAttribute::kAngle);
    fnUnitAttr.setWritable(false);
    fnUnitAttr.setStorable(false);

    rotateZ = fnUnitAttr.create("rotateZ", "rotateZ", MFnUnitAttribute::kAngle);
    fnUnitAttr.setWritable(false);
    fnUnitAttr.setStorable(false);

    rotate = fnNumAttr.create("rotate", "rotate", rotateX, rotateY, rotateZ);
    fnNumAttr.setWritable(false);

    out = fnCompoundAttr.create("out", "out");
    fnCompoundAttr.setWritable(false);
    fnCompoundAttr.setArray(true);
    fnCompoundAttr.addChild(translate);
    fnCompoundAttr.addChild(rotate);
    fnCompoundAttr.setUsesArrayDataBuilder(true);

    // These aren't going to fail, give me a break :)
    // Add Attributes
    SurfaceAttach::addAttribute(direction);
    SurfaceAttach::addAttribute(surface);
    SurfaceAttach::addAttribute(parentInverse);
    SurfaceAttach::addAttribute(samples);
    SurfaceAttach::addAttribute(staticLength);
//.........这里部分代码省略.........
开发者ID:illmillrig,项目名称:SurfaceAttach,代码行数:101,代码来源:SurfaceAttach.cpp

示例12: initialize

MStatus NBuddyEMPSaverNode::initialize()

{
    MStatus status;

    MFnTypedAttribute typedAttr; //Typed attributes
    MFnUnitAttribute unitAttr;
    MFnStringData stringData; //String Attributes
    MFnNumericAttribute numFn; //Numerics
    MFnPluginData dataFn;

    //Create the body input array attribute
    _inBodies = typedAttr.create("inBodies","inb" , naiadBodyData::id , MObject::kNullObj , &status);
    NM_CheckMStatus(status, "ERROR creating inBodies attribute.\n");
    typedAttr.setStorable( false );
    typedAttr.setKeyable( false );
    typedAttr.setWritable(true);
    typedAttr.setReadable(false);
    typedAttr.setArray( true );
    status = addAttribute( _inBodies );
    NM_CheckMStatus(status, "ERROR adding inBodies attribute.\n");

    //Attribute for the folder in which to put the emp files
    _empOutputPath = typedAttr.create( "empOutputPath", "ef", MFnData::kString ,stringData.create(MString("/home/jimmi/dev/naiad/emopen/maya/naiadForMaya/test.#.emp")), &status);
    NM_CheckMStatus( status, "Failed to create empOutputPath attribute");
    typedAttr.setStorable( true );
    status = addAttribute( _empOutputPath );
    NM_CheckMStatus( status, "Failed to add empOutputPath plug");

    //Time input
    _time = unitAttr.create( "time", "tm", MFnUnitAttribute::kTime, 0.0, &status );
    NM_CheckMStatus( status, "Failed to create time attribute");
    unitAttr.setStorable(true);
    unitAttr.setWritable(true);
    status = addAttribute( _time );
    NM_CheckMStatus( status, "Failed to add time plug");

    _framePadding = numFn.create( "framePadding", "fp", MFnNumericData::kInt, 4 , &status );
    NM_CheckMStatus( status, "Failed to create framePadding attribute");
    numFn.setStorable(true);
    numFn.setWritable(true);
    status = addAttribute( _framePadding );
    NM_CheckMStatus( status, "Failed to add framePadding plug");
 
    _timeStep = numFn.create( "timeStep", "ts", MFnNumericData::kInt, 0 , &status );
    NM_CheckMStatus( status, "Failed to create timeStep attribute");
    numFn.setStorable(true);
    numFn.setWritable(true);
    status = addAttribute( _timeStep );
    NM_CheckMStatus( status, "Failed to add timeStep plug");

    // an dummy output trigger to force evaluation of the node
    _outTrigger = numFn.create("outTrigger", "ot", MFnNumericData::kBoolean);
    NM_CheckMStatus( status, "Failed to create outTrigger attribute");
    numFn.setStorable(false);
    numFn.setWritable(false);
    status = addAttribute( _outTrigger );
    NM_CheckMStatus( status, "Failed to add outTrigger plug");

    //Attribute Affects
    attributeAffects( _inBodies, _outTrigger );
    attributeAffects( _time, _outTrigger );
    attributeAffects( _framePadding, _outTrigger );
    attributeAffects( _timeStep, _outTrigger );
    attributeAffects( _empOutputPath, _outTrigger );

    return MS::kSuccess;
}
开发者ID:chunkified,项目名称:Naiad-Buddies,代码行数:68,代码来源:EMPSaverNode.cpp

示例13: 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;
}
开发者ID:DimondTheCat,项目名称:xray,代码行数:77,代码来源:swissArmyManip.cpp


注:本文中的MFnUnitAttribute::setStorable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。