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


C++ MFnStringData类代码示例

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


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

示例1: initialize

//------------------------------------------------------------------------------
//
MStatus AdskPrepareRenderGlobals::initialize()
{    
   MStatus stat;  
   MFnStringData stringFn;
   MObject emptyStr = stringFn.create( &stat );
   
   MObject* attrib[3];
   attrib[0] = &aRepName;
   attrib[1] = &aRepLabel;
   attrib[2] = &aRepType;
   const char* longName[] = {"repName", "repLabel", "repType"};
   const char* shortName[] = {"rna", "rla", "rty"};
   
   MFnTypedAttribute stringAttrFn;
   for (int i = 0; i < 3; i++)
   {      
      *attrib[i] = stringAttrFn.create(longName[i], shortName[i], MFnData::kString, emptyStr);     
      stat = MPxNode::addAttribute(*attrib[i]);
      CHECK_MSTATUS_AND_RETURN_IT(stat);
   }
   
   MFnNumericAttribute boolAttrFn;
   aUseRegEx = boolAttrFn.create("useRegExp", "urx", MFnNumericData::kBoolean, 0);  
   stat = MPxNode::addAttribute(aUseRegEx);
   CHECK_MSTATUS_AND_RETURN_IT(stat);

   return  stat;
}
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:30,代码来源:adskPrepareRenderGlobals.cpp

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

示例3: initialize

MStatus DynamicEnum::initialize()
{
	MFnNumericAttribute nAttr;
	MFnTypedAttribute tAttr;
	MFnStringData sData;
	MStatus status; // Status will be used to hold the MStatus value

	// returned by each api function call. It is important
	// to check the status returned by a call to aid in
	// debugging. Failed API calls can result in subtle
	// errors that can be difficult to track down, you may
	// wish to use the CHECK_MSTATUS macro for any API
	// call where you do not need to provide your own
	// error handling.
	//

	// Attribute Initialization:
	aFilePath = tAttr.create( "filepath", "file", MFnData::kString, &status );
	CHECK_MSTATUS( status );
	CHECK_MSTATUS( tAttr.setKeyable( true ) );
	CHECK_MSTATUS( tAttr.setStorable( true ) );
	CHECK_MSTATUS( tAttr.setDefault( sData.create("") ) );

	aGridName = tAttr.create( "grid", "grd", MFnData::kString, &status );
	CHECK_MSTATUS( status );
	CHECK_MSTATUS( tAttr.setKeyable( true ) );
	CHECK_MSTATUS( tAttr.setStorable( true ) );
	CHECK_MSTATUS( tAttr.setDefault( sData.create("") ) );

	aOutColor = nAttr.createColor( "outColor", "oc", &status );
	CHECK_MSTATUS( status );
	CHECK_MSTATUS( nAttr.setHidden( false ) );
	CHECK_MSTATUS( nAttr.setReadable( true ) );
	CHECK_MSTATUS( nAttr.setWritable( false ) );

	// Next we will add the attributes we have defined to the node
	//
	CHECK_MSTATUS( addAttribute( aFilePath ) );
	CHECK_MSTATUS( addAttribute( aGridName ) );
	CHECK_MSTATUS( addAttribute( aOutColor ) );

	// The attributeAffects() method is used to indicate when the input
	// attribute affects the output attribute. This knowledge allows Maya
	// to optimize dependencies in the graph in more complex nodes where
	// there may be several inputs and outputs, but not all the inputs
	// affect all the outputs.
	//
	CHECK_MSTATUS( attributeAffects( aFilePath, aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aGridName, aOutColor ) );

	return( MS::kSuccess );
}
开发者ID:yaoyansi,项目名称:mymagicbox,代码行数:52,代码来源:dynamic_enum.cpp

示例4: addStrParameter

MStatus PRTAttrs::addStrParameter(MFnDependencyNode & node, MObject & attr, const MString & name, MString & value ) {
	MStatus           stat;
	MStatus           stat2;
	MFnStringData		  stringData;
	MFnTypedAttribute sAttr;

	attr = sAttr.create(longName(name), briefName(name), MFnData::kString, stringData.create(value, &stat2), &stat );
	MCHECK(stat2);
	MCHECK(stat);
	MCHECK(addParameter(node, attr, sAttr));

	MPlug plug(node.object(), attr);
	MCHECK(plug.setValue(value));

	return MS::kSuccess;
}
开发者ID:Esri,项目名称:esri-cityengine-sdk,代码行数:16,代码来源:PRTAttrs.cpp

示例5: initialize

// The initialize routine is called after the node has been created.
// It sets up the input and output attributes and adds them to the
// node. Finally the dependencies are arranged so that when the
// inputs change Maya knowns to call compute to recalculate the output
// value.
//
MStatus stringFormat::initialize()
{
	MFnNumericAttribute numAttr;
	MFnTypedAttribute	typedAttr;
	MFnStringData		stringData;
	MStatus				stat;
	MStatus				stat2;

	// Setup the input attributes
	//
	attrFormat = typedAttr.create("format", "f", MFnData::kString, 
								  stringData.create(&stat2), &stat);
	CHECK_MSTATUS( stat2 );
	CHECK_MSTATUS( stat );
 	CHECK_MSTATUS( typedAttr.setStorable( true ) );
 	CHECK_MSTATUS( typedAttr.setKeyable( true ) );

	attrValues = numAttr.create("values", "v", MFnNumericData::kDouble, 
								0, &stat);
	CHECK_MSTATUS( stat );
 	CHECK_MSTATUS( numAttr.setArray( true ) );
	CHECK_MSTATUS( numAttr.setReadable( false ) );
 	CHECK_MSTATUS( numAttr.setIndexMatters( true ) );
 	CHECK_MSTATUS( numAttr.setStorable( true ) );
 	CHECK_MSTATUS( numAttr.setKeyable( true ) );

	attrOutput = typedAttr.create( "output", "o", MFnData::kString,
								   stringData.create(&stat2), &stat);
	CHECK_MSTATUS( stat2 );
	CHECK_MSTATUS( stat );
	CHECK_MSTATUS( typedAttr.setWritable( false ) );
	CHECK_MSTATUS( typedAttr.setStorable( false ) );

	// Add the attributes to the node
	//
	CHECK_MSTATUS( addAttribute( attrFormat ) );
	CHECK_MSTATUS( addAttribute( attrValues ) );
	CHECK_MSTATUS( addAttribute( attrOutput ) );

	// Set the attribute dependencies
	//
	CHECK_MSTATUS( attributeAffects( attrFormat, attrOutput ) );
	CHECK_MSTATUS( attributeAffects( attrValues, attrOutput ) );

	return MS::kSuccess;
} 
开发者ID:DimondTheCat,项目名称:xray,代码行数:52,代码来源:stringFormatNode.cpp

示例6: CHECK_MSTATUS


//.........这里部分代码省略.........
	info_overlay = nAttr.create("info_overlay", "info_overlay",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( info_overlay ));

	cache_trees = nAttr.create("cache_trees", "cache_trees",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( cache_trees ));

	aperture_diffraction = nAttr.create("aperture_diffraction", "aperture_diffraction",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( aperture_diffraction ));

	post_process_diffraction = nAttr.create("post_process_diffraction", "post_process_diffraction",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( post_process_diffraction ));

	render_foreground_alpha = nAttr.create("render_foreground_alpha", "render_foreground_alpha",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( render_foreground_alpha ));

	splat_filter = eAttr.create("splat_filter", "splat_filter", 0, &stat);
	stat = eAttr.addField( "fastbox", 0 );
	stat = eAttr.addField( "radial", 1 );
	stat = eAttr.addField( "mn_cubic", 2 );
	CHECK_MSTATUS(addAttribute( splat_filter ));

	splat_filter_cubic_b = nAttr.create("splat_filter_cubic_b", "splat_filter_cubic_b",  MFnNumericData::kFloat, 0.6);
	CHECK_MSTATUS(addAttribute( splat_filter_cubic_b ));

	splat_filter_cubic_ring = nAttr.create("splat_filter_cubic_ring", "splat_filter_cubic_ring",  MFnNumericData::kFloat, 0.2);
	CHECK_MSTATUS(addAttribute( splat_filter_cubic_ring ));

	downsize_filter = eAttr.create("downsize_filter", "downsize_filter", 0, &stat);
	stat = eAttr.addField( "mn_cubic", 0 );
	stat = eAttr.addField( "gauss", 1 );
	stat = eAttr.addField( "sharp", 2 );
	CHECK_MSTATUS(addAttribute( downsize_filter ));

	downsize_filter_cubic_radius = nAttr.create("downsize_filter_cubic_radius", "downsize_filter_cubic_radius",  MFnNumericData::kFloat, 2);
	CHECK_MSTATUS(addAttribute( downsize_filter_cubic_radius ));

	vignetting = nAttr.create("vignetting", "vignetting",  MFnNumericData::kBoolean, true);
	CHECK_MSTATUS(addAttribute( vignetting ));

	gpu = nAttr.create("gpu", "gpu",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( gpu ));

	selected_gpu_device = eAttr.create("selected_gpu_device", "selected_gpu_device", 0, &stat);
	stat = eAttr.addField( "CUDA", 0 );
	stat = eAttr.addField( "OPEN_CL", 1 );
	CHECK_MSTATUS(addAttribute( selected_gpu_device ));

	glass_acceleration = nAttr.create("glass_acceleration", "glass_acceleration",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( glass_acceleration ));

	environmentType = eAttr.create("environmentType", "environmentType", 1, &stat);
	stat = eAttr.addField( "Off", 0 );
	stat = eAttr.addField( "Color/Map", 1 );
	stat = eAttr.addField( "Sun", 2 );
	CHECK_MSTATUS(addAttribute( environmentType ));

	environmentColor = nAttr.createColor("environmentColor", "environmentColor");
	nAttr.setDefault(0.4,0.4,1.0);
	CHECK_MSTATUS(addAttribute( environmentColor ));

	environmentSun = mAttr.create("environmentSun", "environmentSun");
	CHECK_MSTATUS(addAttribute( environmentSun ));

	turbidity = nAttr.create("turbidity", "turbidity",  MFnNumericData::kFloat, 2.0);
	CHECK_MSTATUS(addAttribute( turbidity ));

	extra_atmospheric = nAttr.create("extra_atmospheric", "extra_atmospheric",  MFnNumericData::kBoolean, false);
	CHECK_MSTATUS(addAttribute( extra_atmospheric ));

	sun_layer = nAttr.create("sun_layer", "sun_layer",  MFnNumericData::kInt, 0);
	CHECK_MSTATUS(addAttribute( sun_layer ));

	sky_layer = nAttr.create("sky_layer", "sky_layer",  MFnNumericData::kInt, 0);
	CHECK_MSTATUS(addAttribute( sky_layer ));

	sky_model = eAttr.create("sky_model", "sky_model", 0, &stat);
	stat = eAttr.addField( "original", 0 );
	stat = eAttr.addField( "captured-simulation", 1 );
	CHECK_MSTATUS(addAttribute( sky_model ));

	environmentMapType = eAttr.create("environmentMapType", "environmentMapType", 0, &stat);
	stat = eAttr.addField( "Spherical", 0 );
	stat = eAttr.addField( "Lat-Long", 1 );
	CHECK_MSTATUS(addAttribute( environmentMapType ));

	environmentMapMultiplier = nAttr.create("environmentMapMultiplier", "environmentMapMultiplier",  MFnNumericData::kFloat, 1.0);
	CHECK_MSTATUS(addAttribute( environmentMapMultiplier ));

	MFnStringData	fnStringData;
	MObject	defaultString;

	defaultString = fnStringData.create( "notepad.exe" );
	preferredTextEditor = tAttr.create("preferredTextEditor", "preferredTextEditor",  MFnNumericData::kString, defaultString);
	CHECK_MSTATUS(addAttribute( preferredTextEditor ));

//	------------- automatically created attributes end ----------- // 

	return stat;

}
开发者ID:MassW,项目名称:OpenMaya,代码行数:101,代码来源:mtin_renderGlobalsNode.cpp

示例7: CHECK_MSTATUS

MStatus mtmEnvLight::initialize()
{
    MFnTypedAttribute tAttr; 
    MFnNumericAttribute nAttr; 
    MFnLightDataAttribute lAttr;
	MFnEnumAttribute eAttr;
	MFnMessageAttribute mAttr;
	MStatus stat;

    //aColor = nAttr.createColor( "color", "c" );
    //CHECK_MSTATUS ( nAttr.setKeyable(true) );
    //CHECK_MSTATUS ( nAttr.setStorable(true) );
    //CHECK_MSTATUS ( nAttr.setDefault(0.0f, 0.58824f, 0.644f) );

    aLightColor = nAttr.createColor( "lightColor", "lightColor" );
    CHECK_MSTATUS ( nAttr.setKeyable(true) );
    CHECK_MSTATUS ( nAttr.setStorable(true) );
    nAttr.setDefault(0.7f, 0.58824f, 0.344f);

	aShadowColor = nAttr.createColor( "shadowColor", "sc" );
    CHECK_MSTATUS ( nAttr.setKeyable(true) );
    CHECK_MSTATUS ( nAttr.setStorable(true) );
    CHECK_MSTATUS ( nAttr.setDefault(0.0f, 0.0f, 0.0f) );

    aPosition = nAttr.createPoint( "position", "pos" );
    CHECK_MSTATUS ( nAttr.setKeyable(true) );
    CHECK_MSTATUS ( nAttr.setStorable(true) );

    aInputDirection = nAttr.createPoint( "inputDirection", "id" );
    CHECK_MSTATUS ( nAttr.setKeyable(true) );
    CHECK_MSTATUS ( nAttr.setStorable(true) );
    CHECK_MSTATUS ( nAttr.setDefault(-1.0f, 0.0f, 0.0f) );

    aInputAmbient = nAttr.create( "ambientOn", "an", MFnNumericData::kBoolean);
    CHECK_MSTATUS ( nAttr.setKeyable(true) );
    CHECK_MSTATUS ( nAttr.setStorable(true) );
    CHECK_MSTATUS ( nAttr.setHidden(false) );
    CHECK_MSTATUS ( nAttr.setDefault(true) );

    aInputDiffuse = nAttr.create( "emitDiffuse", "dn", MFnNumericData::kBoolean);
    CHECK_MSTATUS ( nAttr.setKeyable(true) );
    CHECK_MSTATUS ( nAttr.setStorable(true) );
    CHECK_MSTATUS ( nAttr.setHidden(false) );
    CHECK_MSTATUS ( nAttr.setDefault(true) );

    aInputSpecular = nAttr.create( "emitSpecular", "sn", MFnNumericData::kBoolean);
    CHECK_MSTATUS ( nAttr.setKeyable(true) );
    CHECK_MSTATUS ( nAttr.setStorable(true) );
    CHECK_MSTATUS ( nAttr.setHidden(false) );
    CHECK_MSTATUS ( nAttr.setDefault(true) );

    aIntensity = nAttr.create( "intensity", "i", MFnNumericData::kFloat);
    CHECK_MSTATUS ( nAttr.setKeyable(true) );
    CHECK_MSTATUS ( nAttr.setStorable(true) );
    CHECK_MSTATUS ( nAttr.setHidden(false) );
    CHECK_MSTATUS ( nAttr.setDefault(1.0f) );

	samplingquality = nAttr.create( "samplingquality", "samplingquality", MFnNumericData::kFloat, 1.0);
	envmap = tAttr.create( "envmap", "envmap", MFnNumericData::kString);
	tAttr.setUsedAsFilename(true);
	areamap = tAttr.create( "areamap", "areamap", MFnNumericData::kString);
	tAttr.setUsedAsFilename(true);
	areafullsphere = nAttr.create( "areafullsphere", "areafullsphere", MFnNumericData::kBoolean, true);
	envintensity = nAttr.createColor( "envintensity", "envintensity" );
	nAttr.setDefault(1.0f, 1.0f, 1.0f);
	raybackground = nAttr.create( "raybackground", "raybackground", MFnNumericData::kBoolean, false);
	castshadow = nAttr.create( "castshadow", "castshadow", MFnNumericData::kBoolean, true);
	envtype = eAttr.create( "envtype", "envtype", 0, &stat);
	stat = eAttr.addField( "Direct Lighting", 0 );
	stat = eAttr.addField( "Ambient Occlusion", 1 );
	stat = eAttr.addField( "Full Irradiance", 2 );
	stat = eAttr.addField( "Raytrace Background", 3 );
	eAttr.setDefault(0);		
	doraysamples = nAttr.create( "doraysamples", "doraysamples", MFnNumericData::kBoolean, false);
	doadaptive = nAttr.create( "doadaptive", "doadaptive", MFnNumericData::kBoolean, false);
	domaxdist = nAttr.create( "domaxdist", "domaxdist", MFnNumericData::kBoolean, false);
	maxdist = nAttr.create( "maxdist", "maxdist", MFnNumericData::kFloat, 10.0);
	coneangle = nAttr.create( "coneangle", "coneangle", MFnNumericData::kFloat, 45.0);
	envtint = nAttr.createColor( "envtint", "envtint" );
	nAttr.setDefault(1.0f, 1.0f, 1.0f);
	shadowI = nAttr.create( "shadowI", "shadowI", MFnNumericData::kFloat, 1.0);
	samples = nAttr.create( "samples", "samples", MFnNumericData::kInt, 32);
	MFnStringData fnStringData;
	MObject defaultObjectMask;
	defaultObjectMask = fnStringData.create( "*" );
	objectmask = tAttr.create( "objectmask", "objectmask", MFnNumericData::kString, defaultObjectMask);
	usePortalGeometry = nAttr.create( "usePortalGeometry", "usePortalGeometry", MFnNumericData::kBoolean, false);
	portalGeometry = mAttr.create( "portalGeometry", "portalGeometry");
	mAttr.setConnectable(true);
	mAttr.accepts(MFnData::kAny);
	
// Outputs

    aLightDirection = nAttr.createPoint( "lightDirection", "ld" );
    CHECK_MSTATUS ( nAttr.setStorable(false) );
    CHECK_MSTATUS ( nAttr.setHidden(true) );
    CHECK_MSTATUS ( nAttr.setReadable(true) );
    CHECK_MSTATUS ( nAttr.setWritable(false) );
    CHECK_MSTATUS ( nAttr.setDefault(-1.0f, 0.0f, 0.0f) );

//.........这里部分代码省略.........
开发者ID:MassW,项目名称:OpenMaya,代码行数:101,代码来源:mtm_envlight.cpp

示例8: initialize

MStatus uiDrawManager::initialize()
{
    MStatus status;

    MFnNumericAttribute nAttr;
    MFnEnumAttribute eAttr;
    MFnTypedAttribute typedAttr;

    // Add ui type attribute
    aUIType = eAttr.create("uiType", "ut", uiDrawManager::kText);
    eAttr.addField("text", uiDrawManager::kText);
    eAttr.addField("line", uiDrawManager::kLine);
    eAttr.addField("point", uiDrawManager::kPoint);
    eAttr.addField("rect", uiDrawManager::kRect);    
    eAttr.addField("quad", uiDrawManager::kQuad);
    eAttr.addField("sphere", uiDrawManager::kSphere);
    eAttr.addField("circle", uiDrawManager::kCircle);    
    eAttr.addField("arc", uiDrawManager::kArc);    
    eAttr.addField("line list", uiDrawManager::kLineList);
    eAttr.addField("line strip", uiDrawManager::kLineStrip);
    eAttr.addField("point list", uiDrawManager::kPointList);
    eAttr.addField("icon", uiDrawManager::kIcon);
    eAttr.addField("cone", uiDrawManager::kCone);
    eAttr.addField("box", uiDrawManager::kBox);
    MPxNode::addAttribute(aUIType);

    // Add color attribute
    aPrimitiveColor = nAttr.create("primitiveColor", "pc", MFnNumericData::k3Float);
    nAttr.setDefault(1.0f, 0.0f, 0.0f);
    nAttr.setUsedAsColor(true);
    MPxNode::addAttribute(aPrimitiveColor);

    // Add transparency attribute
    aPrimitiveTransparency = nAttr.create("primitiveTransparency", "pt", MFnNumericData::kFloat, 0.0);
    nAttr.setSoftMin(0.0);
    nAttr.setSoftMax(1.0);    
    MPxNode::addAttribute(aPrimitiveTransparency);

    // add line width and line style attributes
    aLineWidth = nAttr.create("lineWidth", "lw", MFnNumericData::kFloat, 2.0);
    MPxNode::addAttribute(aLineWidth);

    aLineStyle = eAttr.create("lineStyle", "ls", MUIDrawManager::kSolid);
    eAttr.addField("solid", MUIDrawManager::kSolid);
    eAttr.addField("shortdotted", MUIDrawManager::kShortDotted);
    eAttr.addField("shortdashed", MUIDrawManager::kShortDashed);
    eAttr.addField("dashed", MUIDrawManager::kDashed);
    eAttr.addField("dotted", MUIDrawManager::kDotted);
    MPxNode::addAttribute(aLineStyle);

    // Add filled attribute
    aIsFilled = nAttr.create("isFilled", "if", MFnNumericData::kBoolean, 0);    
    MPxNode::addAttribute(aIsFilled);

    // Add shaded attribute
    aShaded = nAttr.create("shaded", "sd", MFnNumericData::kBoolean, 0);    
    MPxNode::addAttribute(aShaded);

    // Add radius attribute
    aRadius = nAttr.create("radius", "ra", MFnNumericData::kDouble, 1.0);
    MPxNode::addAttribute(aRadius);

    // add 2D attributes
    aDraw2D = nAttr.create("draw2D", "d2", MFnNumericData::kBoolean, 0);
    MPxNode::addAttribute(aDraw2D);

    aPosition = nAttr.create("position", "pos", MFnNumericData::k3Double);
    nAttr.setDefault(0.0, 0.0, 0.001);
    MPxNode::addAttribute(aPosition);

    // Add text attributes.
    MFnStringData stringFn;
    MObject defaultText = stringFn.create("uiDrawManager-Text");
    aText = typedAttr.create("text", "t", MFnData::kString, defaultText);
    MPxNode::addAttribute(aText);    

    aTextFontSize = nAttr.create("textFontSize", "tfs", MFnNumericData::kInt, MUIDrawManager::kDefaultFontSize);
    nAttr.setMin(-1);
    nAttr.setMax(99);    
    MPxNode::addAttribute(aTextFontSize);

    unsigned int nFont = MUIDrawManager::getFontList(uiDrawManagerData::fFontList);
    if (nFont == 0)
    {
        perror("No font available!");
    }
    aFontFaceName = eAttr.create("fontFaceName", "ffn", 0);
    for (unsigned int i = 0; i < nFont; i++)
    {
        MString str = uiDrawManagerData::fFontList[i];
        eAttr.addField(str, (short)i);
    }
    MPxNode::addAttribute(aFontFaceName);

    aTextAlignment = eAttr.create("textAlignment", "ta", MUIDrawManager::kLeft);
    eAttr.addField("left", MUIDrawManager::kLeft);
    eAttr.addField("center", MUIDrawManager::kCenter);
    eAttr.addField("right", MUIDrawManager::kRight);
    MPxNode::addAttribute(aTextAlignment);    

//.........这里部分代码省略.........
开发者ID:BigRoy,项目名称:Maya-devkit,代码行数:101,代码来源:uiDrawManager.cpp

示例9: initialize

MStatus OccLightNode::initialize()
{
	MFnTypedAttribute   tAttr;
	MFnStringData       tDefault;
	MFnNumericAttribute nAttr;
	MFnEnumAttribute    eAttr;
	MFnLightDataAttribute lAttr;
	MStatus status;
	MObject string;

	// Create input attributes
	aRmanShader = tAttr.create( MString("rmanShader"), MString("rms"), MFnData::kString, tDefault.create(getTypeName()), &status );
	MAKE_INPUT(tAttr);

	aRmanShaderType = tAttr.create( MString("rmanShaderType"), MString("rst"), MFnData::kString, tDefault.create(getShaderClasscification()), &status );
	MAKE_INPUT(tAttr);

	aRmanShaderLong = tAttr.create( MString("rmanShaderLong"), MString("rml"), MFnData::kString, aRmanShaderLong, &status );
	MAKE_INPUT(tAttr);

	aRmanShaderLif = tAttr.create(  MString("rmanShaderLif"),  MString("lif"), MFnData::kString, aRmanShaderLif, &status );
	MAKE_INPUT(tAttr);

	aRmanParams = tAttr.create(  MString("rmanParams"),  MString("rpr"), MFnData::kStringArray, aRmanParams, &status );
	MAKE_INPUT(tAttr);

	aRmanDetails = tAttr.create(  MString("rmanDetails"),  MString("rdt"), MFnData::kStringArray, aRmanDetails, &status );
	MAKE_INPUT(tAttr);

	aRmanTypes = tAttr.create(  MString("rmanTypes"),  MString("rty"), MFnData::kStringArray, aRmanTypes, &status );
	MAKE_INPUT(tAttr);

	aRmanDefaults = tAttr.create(  MString("rmanDefaults"),  MString("rdf"), MFnData::kStringArray, aRmanDefaults, &status );
	MAKE_INPUT(tAttr);

	aRmanArraySizes = tAttr.create(  MString("rmanArraySizes"),  MString("ras"), MFnData::kIntArray, aRmanArraySizes, &status );
	MAKE_INPUT(tAttr);

	aRmanLifCmds = tAttr.create(  MString("rmanLifCmds"),  MString("rlc"), MFnData::kStringArray, aRmanLifCmds, &status );
	MAKE_INPUT(tAttr);

	aRmanMethods = tAttr.create(  MString("rmanMethods"),  MString("rmt"), MFnData::kStringArray, aRmanMethods, &status );
	MAKE_INPUT(tAttr);

	aRmanIsOutput = tAttr.create(  MString("rmanIsOutput"),  MString("rio"), MFnData::kIntArray, aRmanIsOutput, &status );
	MAKE_INPUT(tAttr);

	aRmanAccept = tAttr.create(  MString("rmanAccept"),  MString("rma"), MFnData::kStringArray, aRmanAccept, &status );
	MAKE_INPUT(tAttr);


	aOutColor = nAttr.createColor("outColor", "oc");
	MAKE_OUTPUT(nAttr);
	aOutTransparency = nAttr.createColor("outTransparency", "ot");
	MAKE_OUTPUT(nAttr);

	IfMErrorWarn( addAttribute( aRmanShader ) );
	IfMErrorWarn( addAttribute( aRmanShaderType ) );
	IfMErrorWarn( addAttribute( aRmanShaderLong ) );
	IfMErrorWarn( addAttribute( aRmanShaderLif ) );
	IfMErrorWarn( addAttribute( aRmanParams ) );
	IfMErrorWarn( addAttribute( aRmanDetails ) );
	IfMErrorWarn( addAttribute( aRmanTypes ) );
	IfMErrorWarn( addAttribute( aRmanDefaults ) );
	IfMErrorWarn( addAttribute( aRmanArraySizes ) );
	IfMErrorWarn( addAttribute( aRmanLifCmds ) );
	IfMErrorWarn( addAttribute( aRmanMethods) );
	IfMErrorWarn( addAttribute( aRmanIsOutput) );
	IfMErrorWarn( addAttribute( aRmanAccept) );

	IfMErrorWarn( addAttribute( aOutColor ) );
	IfMErrorWarn( addAttribute( aOutTransparency ) );

	initialize_shader_parameters();

	return MS::kSuccess;
}
开发者ID:maya2renderer,项目名称:maya2renderer,代码行数:77,代码来源:rmOccLight_node.cpp

示例10: initialize

MStatus liqDisplacementNode::initialize()
{
  MFnTypedAttribute   tAttr;
  MFnStringData       tDefault;
  MFnNumericAttribute nAttr;
  MFnMessageAttribute mAttr;
  MFnEnumAttribute    eAttr;
  MStatus status;

  // Create input attributes

  aRmanShader = tAttr.create( MString("rmanShader"), MString("rms"), MFnData::kString, aRmanShader, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLong = tAttr.create( MString("rmanShaderLong"), MString("rml"), MFnData::kString, aRmanShaderLong, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLif = tAttr.create(  MString("rmanShaderLif"),  MString("lif"), MFnData::kString, aRmanShaderLif, &status );
  MAKE_INPUT(tAttr);

  aRmanParams = tAttr.create(  MString("rmanParams"),  MString("rpr"), MFnData::kStringArray, aRmanParams, &status );
  MAKE_INPUT(tAttr);

  aRmanDetails = tAttr.create(  MString("rmanDetails"),  MString("rdt"), MFnData::kStringArray, aRmanDetails, &status );
  MAKE_INPUT(tAttr);

  aRmanTypes = tAttr.create(  MString("rmanTypes"),  MString("rty"), MFnData::kStringArray, aRmanTypes, &status );
  MAKE_INPUT(tAttr);

  aRmanDefaults = tAttr.create(  MString("rmanDefaults"),  MString("rdf"), MFnData::kStringArray, aRmanDefaults, &status );
  MAKE_INPUT(tAttr);

  aRmanArraySizes = tAttr.create(  MString("rmanArraySizes"),  MString("ras"), MFnData::kIntArray, aRmanArraySizes, &status );
  MAKE_INPUT(tAttr);

  aRmanLifCmds = tAttr.create(  MString("rmanLifCmds"),  MString("rlc"), MFnData::kStringArray, aRmanLifCmds, &status );
  MAKE_INPUT(tAttr);

  aPreviewPrimitive = eAttr.create( "previewPrimitive", "pvp", 7, &status );
  eAttr.addField( "Sphere",   0 );
  eAttr.addField( "Cube",     1 );
  eAttr.addField( "Cylinder", 2 );
  eAttr.addField( "Torus",    3 );
  eAttr.addField( "Plane",    4 );
  eAttr.addField( "Teapot",   5 );
  eAttr.addField( "Custom",   6 );
  eAttr.addField( "(globals)",7 );
  MAKE_NONKEYABLE_INPUT(eAttr);
  CHECK_MSTATUS(eAttr.setConnectable(false));

  aPreviewCustomPrimitive = tAttr.create(  MString("previewCustomPrimitive"),  MString("pcp"), MFnData::kString, aPreviewCustomPrimitive, &status );
  MAKE_INPUT(tAttr);

  aPreviewCustomBackplane = tAttr.create(  MString("previewCustomBackplane"),  MString("pcb"), MFnData::kString, aPreviewCustomBackplane, &status );
  MAKE_INPUT(tAttr);

  aPreviewObjectSize = nAttr.create("previewObjectSize", "pos", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewPixelSamples = nAttr.create("previewPixelSamples", "pxs",  MFnNumericData::kInt, 3, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));


  aPreviewShadingRate = nAttr.create("previewShadingRate", "psr", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewBackplane = nAttr.create("previewBackplane", "pbp", MFnNumericData::kBoolean, true, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aShaderSpace = tAttr.create( MString("shaderSpace"), MString("ssp"), MFnData::kString, aShaderSpace, &status );
  MAKE_INPUT(tAttr);

  aDisplacementBound = nAttr.create("displacementBound", "db", MFnNumericData::kDouble, 0.0, &status);
  MAKE_INPUT(nAttr);

  MObject defaultSpaceObj = tDefault.create( MString("shader"), &status);
  aDisplacementBoundSpace = tAttr.create( MString("displacementBoundSpace"), MString("dbs"), MFnData::kString, defaultSpaceObj, &status );
  MAKE_INPUT(tAttr);

  aOutputInShadow = nAttr.create("outputInShadow", "ois",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);

  // refreshPreview must be true to allow refresh
  aRefreshPreview = nAttr.create("refreshPreview", "rfp",  MFnNumericData::kBoolean, 0.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setHidden(true));

  // Create output attributes
  aDisplacement = nAttr.create("displacement", "d", MFnNumericData::kFloat, 0.0, &status);
  MAKE_OUTPUT(nAttr);
  aOutColor = nAttr.createColor("outColor", "oc");
  MAKE_OUTPUT(nAttr);
  aAssignedObjects = mAttr.create("liqAssignedObjects", "ao");
  MAKE_OUTPUT(mAttr);

  CHECK_MSTATUS(addAttribute(aRmanShader));
//.........这里部分代码省略.........
开发者ID:virtualritz,项目名称:liquidmaya,代码行数:101,代码来源:liqDisplacementNode.cpp

示例11: initialize

MStatus liqSurfaceNode::initialize()
{
  MFnTypedAttribute   tAttr;
  MFnStringData       tDefault;
  MFnNumericAttribute nAttr;
  MFnEnumAttribute    eAttr;
  MFnMessageAttribute mAttr;
  MFnLightDataAttribute lAttr;
  MStatus status;

  // Create input attributes

  aRmanShader = tAttr.create( MString("rmanShader"), MString("rms"), MFnData::kString, aRmanShader, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLong = tAttr.create( MString("rmanShaderLong"), MString("rml"), MFnData::kString, aRmanShaderLong, &status );
  MAKE_INPUT(tAttr);

  aRmanShaderLif = tAttr.create(  MString("rmanShaderLif"),  MString("lif"), MFnData::kString, aRmanShaderLif, &status );
  MAKE_INPUT(tAttr);

  aRmanParams = tAttr.create(  MString("rmanParams"),  MString("rpr"), MFnData::kStringArray, aRmanParams, &status );
  MAKE_INPUT(tAttr);

  aRmanDetails = tAttr.create(  MString("rmanDetails"),  MString("rdt"), MFnData::kStringArray, aRmanDetails, &status );
  MAKE_INPUT(tAttr);

  aRmanTypes = tAttr.create(  MString("rmanTypes"),  MString("rty"), MFnData::kStringArray, aRmanTypes, &status );
  MAKE_INPUT(tAttr);

  aRmanDefaults = tAttr.create(  MString("rmanDefaults"),  MString("rdf"), MFnData::kStringArray, aRmanDefaults, &status );
  MAKE_INPUT(tAttr);

  aRmanArraySizes = tAttr.create(  MString("rmanArraySizes"),  MString("ras"), MFnData::kIntArray, aRmanArraySizes, &status );
  MAKE_INPUT(tAttr);

  aRmanLifCmds = tAttr.create(  MString("rmanLifCmds"),  MString("rlc"), MFnData::kStringArray, aRmanLifCmds, &status );
  MAKE_INPUT(tAttr);

  aPreviewPrimitive = eAttr.create( "previewPrimitive", "pvp", 7, &status );
  eAttr.addField( "Sphere",   0 );
  eAttr.addField( "Cube",     1 );
  eAttr.addField( "Cylinder", 2 );
  eAttr.addField( "Torus",    3 );
  eAttr.addField( "Plane",    4 );
  eAttr.addField( "Teapot",   5 );
  eAttr.addField( "Custom",   6 );
  eAttr.addField( "(globals)",7 );
  MAKE_NONKEYABLE_INPUT(eAttr);
  CHECK_MSTATUS(eAttr.setConnectable(false));

  aPreviewCustomPrimitive = tAttr.create(  MString("previewCustomPrimitive"),  MString("pcp"), MFnData::kString, aPreviewCustomPrimitive, &status );
  MAKE_INPUT(tAttr);

  aPreviewCustomBackplane = tAttr.create(  MString("previewCustomBackplane"),  MString("pcb"), MFnData::kString, aPreviewCustomBackplane, &status );
  MAKE_INPUT(tAttr);

  aPreviewCustomLightRig = tAttr.create(  MString("previewCustomLights"),  MString("pcl"), MFnData::kString, aPreviewCustomLightRig, &status );
  MAKE_INPUT(tAttr);

  aPreviewObjectSize = nAttr.create("previewObjectSize", "pos", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewPixelSamples = nAttr.create("previewPixelSamples", "pxs",  MFnNumericData::kInt, 3, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewShadingRate = nAttr.create("previewShadingRate", "psr", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewBackplane = nAttr.create("previewBackplane", "pbp", MFnNumericData::kBoolean, true, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aPreviewIntensity = nAttr.create("previewIntensity", "pi", MFnNumericData::kDouble, 1.0, &status);
  MAKE_NONKEYABLE_INPUT(nAttr);
  CHECK_MSTATUS(nAttr.setConnectable(false));

  aGLPreviewTexture = nAttr.createColor("GLPreviewTexture", "gpt");
  nAttr.setDefault( -1.0, -1.0, -1.0 );
  nAttr.setDisconnectBehavior( MFnAttribute::kReset );
  MAKE_INPUT(nAttr);



  aColor = nAttr.createColor("color", "cs");
  nAttr.setDefault( 1.0, 1.0, 1.0 );
  nAttr.setDisconnectBehavior( MFnAttribute::kReset );
  MAKE_INPUT(nAttr);

  aOpacity = nAttr.createColor("opacity", "os");
  nAttr.setDefault( 1.0, 1.0, 1.0 );
  MAKE_INPUT(nAttr);

  aShaderSpace = tAttr.create( MString("shaderSpace"), MString("ssp"), MFnData::kString, aShaderSpace, &status );
  MAKE_INPUT(tAttr);

  aDisplacementBound = nAttr.create("displacementBound", "db", MFnNumericData::kDouble, 0.0, &status);
//.........这里部分代码省略.........
开发者ID:virtualritz,项目名称:liquidmaya,代码行数:101,代码来源:liqSurfaceNode.cpp

示例12: fprintf


//.........这里部分代码省略.........
        MDataHandle grassSegmentLengthHandle = io_dataBlock.inputValue( ia_grassSegmentLength, & status);
        const float grassSegmentLength = grassSegmentLengthHandle.asFloat();
        CHECK_MSTATUS( status );

        MDataHandle grassNumSegmentsHandle = io_dataBlock.inputValue( ia_grassNumSegments, & status);
        const long grassNumSegments = grassNumSegmentsHandle.asLong();
        CHECK_MSTATUS( status );

        MFloatVector& windDirVec = io_dataBlock.inputValue( ia_windDirection, & status).asFloatVector();
        const Vcore::Vec3 windDirection = Vec3(windDirVec.x, windDirVec.y, windDirVec.z);
        CHECK_MSTATUS( status );

        MDataHandle grassBendAmountHandle = io_dataBlock.inputValue( ia_grassBendAmount, & status);
        const float grassBendAmount = grassBendAmountHandle.asFloat();
        CHECK_MSTATUS( status );

        MDataHandle windSpreadHandle = io_dataBlock.inputValue( ia_windSpread, & status);
        const float windSpread = windSpreadHandle.asFloat();
        CHECK_MSTATUS( status );

        MDataHandle clockHandle = io_dataBlock.inputValue( ia_clock, & status);
        const float clock = clockHandle.asLong();
        CHECK_MSTATUS( status );

        //Colours
        //-------------------
        MFloatVector& grassBaseColour1Vec = io_dataBlock.inputValue( ia_grassBaseColour1, & status).asFloatVector();
        const Vcore::Vec3 grassBaseColour1 = Vec3(grassBaseColour1Vec.x, grassBaseColour1Vec.y, grassBaseColour1Vec.z);
        CHECK_MSTATUS( status );

        MFloatVector& grassTipColour1Vec = io_dataBlock.inputValue( ia_grassTipColour1, & status).asFloatVector();
        const Vcore::Vec3 grassTipColour1 = Vec3(grassTipColour1Vec.x, grassTipColour1Vec.y, grassTipColour1Vec.z);
        CHECK_MSTATUS( status );

        MFloatVector& grassBaseColour2Vec = io_dataBlock.inputValue( ia_grassBaseColour2, & status).asFloatVector();
        const Vcore::Vec3 grassBaseColour2 = Vec3(grassBaseColour2Vec.x, grassBaseColour2Vec.y, grassBaseColour2Vec.z);
        CHECK_MSTATUS( status );

        MFloatVector& grassTipColour2Vec = io_dataBlock.inputValue( ia_grassTipColour2, & status).asFloatVector();
        const Vcore::Vec3 grassTipColour2 = Vec3(grassTipColour2Vec.x, grassTipColour2Vec.y, grassTipColour2Vec.z);
        CHECK_MSTATUS( status );

        char rib[4096];
        sprintf( rib, "seed=%d;roughness=%f;planeHeight=%d;planeSize=%d;resolution=%d;gridSize=%d;grassMultiplier=%d;baseWidth=%f;grassSegmentLength=%f;grassNumSegments=%d;windDirectionX=%f;windDirectionY=%f;windDirectionZ=%f;grassBendAmount=%f;windSpread=%f;clock=%d;smooth=%d;grassBaseColour1X=%f;grassBaseColour1Y=%f;grassBaseColour1Z=%f;grassTipColour1X=%f;grassTipColour1Y=%f;grassTipColour1Z=%f;grassBaseColour2X=%f;grassBaseColour2Y=%f;grassBaseColour2Z=%f;grassTipColour2X=%f;grassTipColour2Y=%f;grassTipColour2Z=%f;",
            (int) seed, 
            (float) roughness, 
            (int) planeHeight, 
            (int) planeSize, 
            (int) rmanResolution , 
            (int) gridSize, 
            (int) grassMultiplier, 
            (float) baseWidth,
            (float) grassSegmentLength, 
            (int) grassNumSegments, 
            (float) windDirection.x, 
            (float) windDirection.y,
            (float) windDirection.z,
            (float) grassBendAmount, 
            (float) windSpread,
            (int) clock,
            (int) smooth,
            (float) grassBaseColour1.x,
            (float) grassBaseColour1.y,
            (float) grassBaseColour1.z,
            (float) grassTipColour1.x,
            (float) grassTipColour1.y,
            (float) grassTipColour1.z,
            (float) grassBaseColour2.x,
            (float) grassBaseColour2.y,
            (float) grassBaseColour2.z,
            (float) grassTipColour2.x,
            (float) grassTipColour2.y,
            (float) grassTipColour2.z
        );        
        
        // We must set a value for the plug we have been asked to evaluate,
        // even if we are not going to use it. We set it in the data-block,
        // and to set it we use outputValue().
        //
        // Here we are calculating a string value, and that value will 
        // be used by the caller in a "rib-gen" operation - a process in 
        // which a RIB file is generated for Renderman.
        //
        // Notice also that strings in Maya or more complicated than numbers.
        // We need to make a data object for the string data.
        
        MFnStringData stringDataFn;
        MObject stringDataObj = stringDataFn.create( rib, & status );
        CHECK_MSTATUS( status );
        
        MDataHandle ribHandle = io_dataBlock.outputValue( i_plug );
        ribHandle.set( stringDataObj );
        io_dataBlock.setClean( i_plug );
    }
    
    else {
        //Shouldn't be here.
        return MStatus::kSuccess;
    }
}
开发者ID:Mystfit,项目名称:VIslandsGrass,代码行数:101,代码来源:VmIslandNode.cpp

示例13: addAttribute

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

示例14: 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

示例15: initialize

// initialize
// ------------
//! Initialises the Attributes on the node, and set the evaluation dependencies
MStatus NBuddySurfaceToBodyNode::initialize()

{
    MStatus status;

    //Function sets needed
    MFnStringData stringData;
    MFnPluginData dataFn;
    MFnMatrixData matrixFn;
    MFnGenericAttribute genFn;
    MFnTypedAttribute typedAttr;
    MFnNumericAttribute numAttr;
    MFnMatrixAttribute  mAttr;

    //Attribute that specifies if the object should be converted to worldspace or localspace
    _useTransform = numAttr.create( "useTransform", "ut",  MFnNumericData::kBoolean, true, &status );
    NM_CheckMStatus(status, "ERROR creating useWorldSpace attribute.\n");
    status = addAttribute( _useTransform );

    //The input transform for the object
    _inTransform = mAttr.create("inTransform","it", MFnMatrixAttribute::kDouble, &status);
    mAttr.setStorable( true );
    mAttr.setConnectable(true);
    NM_CheckMStatus(status, "ERROR creating inTransform attribute.\n");
    status = addAttribute( _inTransform );
    NM_CheckMStatus(status, "ERROR adding inTransform attribute.\n");

    //Create the inSurface plug
    _inSurface = genFn.create( "inSurface", "surf", &status);
    NM_CheckMStatus( status, "Failed to create inSurface GenericAttribute");
    genFn.addAccept(MFnData::kNurbsSurface);
    genFn.addAccept(MFnData::kMesh);
    genFn.addAccept(MFnData::kSubdSurface);
    genFn.setStorable(false);
    genFn.setCached(false);
    status = addAttribute( _inSurface );
    NM_CheckMStatus(status, "ERROR adding inSurface attribute.\n");

    // Create the attribute for the body output
    _outBody = typedAttr.create("outBody","ob" , naiadBodyData::id , MObject::kNullObj , &status);
    NM_CheckMStatus(status, "ERROR creating outBody attribute.\n");
    typedAttr.setKeyable( false  );
    typedAttr.setWritable( false );
    typedAttr.setReadable( true  );
    typedAttr.setStorable( false );
    status = addAttribute( _outBody );
    NM_CheckMStatus(status, "ERROR adding outBody attribute.\n");

    // Create the attribute for the body name
    _bodyName = typedAttr.create( "bodyName", "bn", MFnData::kString ,stringData.create( MString("mesh-body") ), &status);
    NM_CheckMStatus( status, "Failed to create bodyName attribute");
    typedAttr.setStorable( true );
    typedAttr.setArray( false );
    status = addAttribute( _bodyName );
    NM_CheckMStatus( status, "Failed to add bodyName plug");

    //Tesselation settings
    _subDivide = numAttr.create( "subDivide", "td", MFnNumericData::kInt , 0, &status);
    NM_CheckMStatus( status, "Failed to create subDivide attribute");
    numAttr.setStorable( true );
    numAttr.setArray( false );
    status = addAttribute( _subDivide );
    NM_CheckMStatus( status, "Failed to add bodyName plug");

    // Attribute affects
    attributeAffects( _bodyName, _outBody );
    attributeAffects( _subDivide, _outBody );
    attributeAffects( _inSurface, _outBody );
    attributeAffects( _useTransform, _outBody );
    attributeAffects( _inTransform, _outBody );

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


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