Example #1
0
MStatus mpBox::initialize()
{

    MFnNumericAttribute nAttr;
    MFnEnumAttribute enumAttr;
    // add the custom attributes for mpBox  //
    _COMMON_ATTR_INIT_;
    aXsize = nAttr.create( "xsize", "xsz", MFnNumericData::kFloat);
    nAttr.setDefault(0.5f);
    nAttr.setKeyable(1);
    nAttr.setReadable(1);
    nAttr.setWritable(1);
    nAttr.setStorable(1);

    aYsize = nAttr.create( "ysize", "ysz", MFnNumericData::kFloat);
    nAttr.setDefault(0.5f);
    nAttr.setKeyable(1);
    nAttr.setReadable(1);
    nAttr.setWritable(1);
    nAttr.setStorable(1);

    aZsize = nAttr.create( "zsize", "zsz", MFnNumericData::kFloat);
    nAttr.setDefault(0.5f);
    nAttr.setKeyable(1);
    nAttr.setReadable(1);
    nAttr.setWritable(1);
    nAttr.setStorable(1);

    aDrawType = enumAttr.create( "drawType" , "dt");
    enumAttr.addField("wireframe", 0);
    enumAttr.addField("shaded", 1);
    enumAttr.addField("normal", 2);
    enumAttr.setHidden(false);
    enumAttr.setKeyable(true);
    enumAttr.setDefault(2);

    addAttribute(aXsize);
    addAttribute(aYsize);
    addAttribute(aZsize);
    addAttribute(aDrawType);

    return MS::kSuccess;
}
Example #2
0
// DESCRIPTION:
//
MStatus PtexColorNode::initialize()
{
	MStatus status;

	MFnNumericAttribute numericAttribute;

	// Input attributes

	MFnTypedAttribute fileNameAttribute;
	aPtexFileName = fileNameAttribute.create( "ptexFileName", "f", MFnData::kString );
	MAKE_INPUT( fileNameAttribute );
	fileNameAttribute.setConnectable(false);

	MFnEnumAttribute enumAttribute;
	aPtexFilterType = enumAttribute.create( "ptexFilterType", "t", 0, &status );
	MCHECKERROR( status, "create filterType attribute" );
	enumAttribute.addField( "Point",      0 );
	enumAttribute.addField( "Bilinear",   1 );
	enumAttribute.addField( "Box",        2 );
	enumAttribute.addField( "Gaussian",   3 );
	enumAttribute.addField( "Bicubic",    4 );
	enumAttribute.addField( "BSpline",    5 );
	enumAttribute.addField( "CatmullRom", 6 );
	enumAttribute.addField( "Mitchell",   7 );
	enumAttribute.setHidden( false );
	MAKE_INPUT( enumAttribute );
	enumAttribute.setConnectable(false);
	MCHECKERROR( status, "Error adding shapeType attribute." );

	MFnNumericAttribute filterSizeAttribute;
	aPtexFilterSize = filterSizeAttribute.create( "ptexFilterSize", "s", MFnNumericData::kFloat, 1.0 );
	MAKE_INPUT( filterSizeAttribute );
	filterSizeAttribute.setConnectable(false);

	// Implicit shading network attributes

	MObject child1 = numericAttribute.create( "uCoord", "u", MFnNumericData::kFloat);
	MObject child2 = numericAttribute.create( "vCoord", "v", MFnNumericData::kFloat);
	aUVPos = numericAttribute.create( "uvCoord", "uv", child1, child2);
	MAKE_INPUT( numericAttribute );
	CHECK_MSTATUS( numericAttribute.setHidden(true) );

	child1 = numericAttribute.create( "uvFilterSizeX", "fsx", MFnNumericData::kFloat);
	child2 = numericAttribute.create( "uvFilterSizeY", "fsy", MFnNumericData::kFloat);
	aUVSize = numericAttribute.create( "uvFilterSize", "fs", child1, child2 );
	MAKE_INPUT( numericAttribute );
	CHECK_MSTATUS( numericAttribute.setHidden(true) );

	// Output attributes
	aOutColor = numericAttribute.createColor("outColor", "oc");
	MAKE_OUTPUT(numericAttribute);

	// Add attributes to the node database.
	CHECK_MSTATUS( addAttribute(aPtexFileName) );
	CHECK_MSTATUS( addAttribute(aPtexFilterType) );
	CHECK_MSTATUS( addAttribute(aPtexFilterSize) );
	CHECK_MSTATUS( addAttribute(aUVPos) );
	CHECK_MSTATUS( addAttribute(aUVSize) );

	CHECK_MSTATUS( addAttribute(aOutColor) );

	// All input affect the output color
	CHECK_MSTATUS( attributeAffects( aPtexFileName,   aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aPtexFilterSize, aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aPtexFilterType, aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aUVPos,          aOutColor ) );
	CHECK_MSTATUS( attributeAffects( aUVSize,         aOutColor ) );

	return MS::kSuccess;
}
MStatus worldSettingNode::initialize()
{
	MStatus stat;
	MFnNumericAttribute numAttr;
	MFnEnumAttribute enumAttr;

	backgroundTypes=enumAttr.create("BackgroundTypes","wbaty",0);
	enumAttr.addField("Single Color",0);
	enumAttr.addField("Gradient",1);
	enumAttr.addField("Texture",2);
	enumAttr.addField("Sunsky",3);
	enumAttr.addField("DarkTide's Sunsky",4);
	//MCHECKERROR(stat, "create background types");
	enumAttr.setKeyable(true);
	enumAttr.setStorable(true);
	enumAttr.setHidden(true);

	volumeInitTypes=enumAttr.create("VolumeTypes","wvoty",0);
	enumAttr.addField("None",0);
	enumAttr.addField("Single Scatter",1);
    enumAttr.addField("Sky",2);
	//MCHECKERROR(stat, "create volume types");
	enumAttr.setKeyable(true);
	enumAttr.setStorable(true);

	DSSkyColorSpaces=enumAttr.create("DarkTideSunskyColorSpaces","wdasu",0);
	enumAttr.addField("CIEE",0);
	enumAttr.addField("CIED50",1);
	enumAttr.addField("sRBGD65",2);
	enumAttr.addField("sRGBD50",3);
	//MCHECKERROR(stat, "create DarkTide's sunsky color spaces");
	enumAttr.setKeyable(true);
	enumAttr.setStorable(true);

	backgroundColor=numAttr.createColor("BackgroundColor","wbaco");
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setDefault(0.0,0.0,0.0);

	//gradient attribute
	horizonColor=numAttr.createColor("HorizonColor","whoco");
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setDefault(0.1,0.8,0.5);

	zenithColor=numAttr.createColor("ZenithColor","wzeco");
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setDefault(0.4,0.5,0.1);

	horGroundColor=numAttr.createColor("HorGroundColor","whgco");
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setDefault(0.4,0.5,0.6);

	zenGroundColor=numAttr.createColor("ZenGroundColor","wzgco");
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setDefault(0.9,0.5,0.2);

	//texture attribute
	texRotation=numAttr.create("TextureRotation","wtero",MFnNumericData::kFloat,0.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(0.0f);
	numAttr.setMax(360.0f);

	//sunsky attribute
	turbidity=numAttr.create("Turbidity","wtu",MFnNumericData::kFloat,1.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(1.0f);
	numAttr.setMax(20.0f);

	AHorBrght=numAttr.create("AHorBrght","wahb",MFnNumericData::kFloat,0.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(0.0f);
	numAttr.setMax(10.0f);

	BHorSprd=numAttr.create("BHorSprd","wbhs",MFnNumericData::kFloat,0.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(0.0f);
	numAttr.setMax(10.0f);

	CSunBrght=numAttr.create("CSunBrght","wcsb",MFnNumericData::kFloat,0.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(0.0f);
	numAttr.setMax(10.0f);

	DSunSize=numAttr.create("DSunsize","wdss",MFnNumericData::kFloat,0.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(0.0f);
	numAttr.setMax(10.0f);

	EBacklight=numAttr.create("EBacklight","webl",MFnNumericData::kFloat,0.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(0.0f);
	numAttr.setMax(10.0f);

	xDirection=numAttr.create("xDirection","wxd",MFnNumericData::kDouble,0.000);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(-1.000);
	numAttr.setMax(1.000);


	yDirection=numAttr.create("yDirection","wyd",MFnNumericData::kDouble,0.000);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(-1.000);
	numAttr.setMax(1.000);

	zDirection=numAttr.create("zDirection","wzd",MFnNumericData::kDouble,0.000);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(-1.000);
	numAttr.setMax(1.000);

	realSun=numAttr.create("AddRealSun","wads",MFnNumericData::kBoolean,0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);

	sunPower=numAttr.create("SunPower","wsupo",MFnNumericData::kFloat,0.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(0.0);
	numAttr.setMax(10.0);

	skyLight=numAttr.create("Skylight","wsk",MFnNumericData::kBoolean,1);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);

	skySamples=numAttr.create("SkySamples","wsksa",MFnNumericData::kInt,1);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(1);
	numAttr.setMax(128);

	//DarkTide's sunsky attribute
	DSTurbidity=numAttr.create("DarkTideTurbidity","wdatu",MFnNumericData::kFloat,2.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(2.0);
	numAttr.setMax(12.0);

	renderDSA=numAttr.create("BrightnessOfHorizonGradient","wbhg",MFnNumericData::kFloat,-10.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(-10.0);
	numAttr.setMax(10.0);

	renderDSB=numAttr.create("LuminanceOfHorizon","wloh",MFnNumericData::kFloat,-10.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(-10.0);
	numAttr.setMax(10.0);

	renderDSC=numAttr.create("SolarRegionIntensity","wsri",MFnNumericData::kFloat,0.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(0.0);
	numAttr.setMax(50.0);

	renderDSD=numAttr.create("WidthOfCircumsolarRegion","wwocr",MFnNumericData::kFloat,0.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(0.0);
	numAttr.setMax(50.0);

	renderDSE=numAttr.create("BackgroundLight","wbl",MFnNumericData::kFloat,0.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(-30.0);
	numAttr.setMax(30.0);

	//sun direction shared with sunsky
	 DSAltitude=numAttr.create("Altitude","wal",MFnNumericData::kFloat,0.0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);
	numAttr.setMin(-1.0);
	numAttr.setMax(2.0);

	DSNight=numAttr.create("Night","wni",MFnNumericData::kBoolean,0);
	numAttr.setKeyable(true);
	numAttr.setStorable(true);

	 DSRealSun=numAttr.create("AddDSRealSun","wadrs",MFnNumericData::kBoolean,0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);

	 DSSunPower=numAttr.create("DSSunPower","wdsp",MFnNumericData::kFloat,0.0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);
	 numAttr.setMin(0.0);
	 numAttr.setMax(10.0);

	 DSSkyLight=numAttr.create("AddDSSkyLight","wadsl",MFnNumericData::kBoolean,0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);

	 DSSkyPower=numAttr.create("DSSkyPower","wdssp",MFnNumericData::kFloat,0.0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);
	 numAttr.setMin(0.0);
	 numAttr.setMax(10000.0);

	 DSSkySamples=numAttr.create("DSSkySamples","wdsss",MFnNumericData::kInt,1);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);
	 numAttr.setMin(1);
	 numAttr.setMax(256);

	 DSSkyBright=numAttr.create("Brightness","wbr",MFnNumericData::kFloat,0.0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);
	 numAttr.setMin(0.0);
	 numAttr.setMax(10.0);

	 DSExposure=numAttr.create("Exposure","wex",MFnNumericData::kFloat,0.0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);
	 numAttr.setMin(0.0);
	 numAttr.setMax(10.0);

	 DSGammaEncoding=numAttr.create("GammaEncoding","wgaen",MFnNumericData::kBoolean,0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);

	//these  appear in each type of background
	 useIBL=numAttr.create("UseIBL","wibl",MFnNumericData::kBoolean,0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);

	 IBLSamples=numAttr.create("IBLSamples","wibls",MFnNumericData::kInt,1);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);
	 numAttr.setMin(1);
	 numAttr.setMax(512);

	 backgroundDiffuse=numAttr.create("DiffusePhotons","wdiph",MFnNumericData::kBoolean,0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);

	 backgoundCaustic=numAttr.create("CausticPhotons","wcaph",MFnNumericData::kBoolean,0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);

	 backgoundPower=numAttr.create("BackgroundPower","wbapo",MFnNumericData::kFloat,0.0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);
	 numAttr.setMin(0.0);
	 numAttr.setMax(10000.0);

	volumeStepSize=numAttr.create("StepSize","wvstsi",MFnNumericData::kInt,0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);
	 numAttr.setMin(0);
	 numAttr.setMax(100);

	volumeAdaptive=numAttr.create("Adaptive","wvad",MFnNumericData::kBoolean,0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);

	volumeOptimize=numAttr.create("Optimize","wvop",MFnNumericData::kBoolean,0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);

	volumeAttMapScale=numAttr.create("AttGridResolution","wvagr",MFnNumericData::kInt,1);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);
	 numAttr.setMin(1);
	 numAttr.setMax(50);

	 volumeSkyST=numAttr.create("Scale","wvsc",MFnNumericData::kDouble,0.0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);
	 numAttr.setMin(0.0001);
	 numAttr.setMax(10.000);

	volumeAlpha=numAttr.create("Alpha","wval",MFnNumericData::kDouble,0.0);
	 numAttr.setKeyable(true);
	 numAttr.setStorable(true);
	 numAttr.setMin(0.0001);
	 numAttr.setMax(10.000);

	//the node needs an output, even we dont need it...
	worldOutput=numAttr.create("WorldSettingOutput","wwso",MFnNumericData::kBoolean);
	numAttr.setDefault(true);
	numAttr.setHidden(true);

	setAttribute();


	return stat;
}
Example #4
0
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 );
        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 ( 6 );
        status = addAttribute( ia_rmanResolution );
        CHECK_MSTATUS( status );
    }

    //Plane size attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_planeSize = numericAttrFn.create( "planeSizeScale", "pS", 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( 200 );
        numericAttrFn.setDefault ( 20 );
        status = addAttribute( ia_planeSize );
        CHECK_MSTATUS( status );
    }


     //Plane size attribute
    {
        MFnNumericAttribute numericAttrFn;
        ia_gridSize = numericAttrFn.create( "gridSize", "gS", 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_gridSize );
        CHECK_MSTATUS( status );
    }

     //Grass multiplier - Affects how many instances are spawned
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassMultiplier = numericAttrFn.create( "grassInstanceMultiplier", "gM", 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( 100 );
        numericAttrFn.setDefault ( 1 );
        status = addAttribute( ia_grassMultiplier );
        CHECK_MSTATUS( status );
    }


        //Grass multiplier - Affects how many instances are spawned
    {
        MFnNumericAttribute numericAttrFn;
        ia_baseWidth = numericAttrFn.create( "grassBaseWidth", "bW", 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.01f );
        numericAttrFn.setMax( 2.0f ); 
        numericAttrFn.setDefault ( 0.6f );
        status = addAttribute( ia_baseWidth );
        CHECK_MSTATUS( status );
    }



    //Grass segment length - Length of segment pieces
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassSegmentLength = numericAttrFn.create( "grassSegmentLength", "gSL", 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.001f );
        numericAttrFn.setMax( 10.0f );
        numericAttrFn.setDefault ( 1.0f );
        status = addAttribute( ia_grassSegmentLength );
        CHECK_MSTATUS( status );
    }

     //Number of segments per piece of grass
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassNumSegments = numericAttrFn.create( "numberOfGrassSegments", "nGS", 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( 3 );
        numericAttrFn.setMax( 20 );
        numericAttrFn.setDefault ( 5 );
        status = addAttribute( ia_grassNumSegments );
        CHECK_MSTATUS( status );
    }

    //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_windDirection = numericAttrFn.createPoint( "windDirection", "wDir");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(1.0f, 0.0f, 1.0f);
        status = addAttribute( ia_windDirection );
        CHECK_MSTATUS( status );
    }

    //Grass bend factor
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassBendAmount = numericAttrFn.create( "grassBendFactor", "gBF", 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.0f );
        numericAttrFn.setMax( 1.0f );
        numericAttrFn.setDefault ( 0.0f );
        status = addAttribute( ia_grassBendAmount );
        CHECK_MSTATUS( status );
    }

    //Wind strength
    {
        MFnNumericAttribute numericAttrFn;
        ia_windSpread = numericAttrFn.create( "windSpread", "wS", 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.01f );
        numericAttrFn.setMax( 10.0f );
        numericAttrFn.setDefault ( 5.0f );
        status = addAttribute( ia_windSpread );
        CHECK_MSTATUS( status );
    }



        //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassBaseColour1 = numericAttrFn.createColor( "grassBaseColour1", "bCol1");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.0f,0.251f,0.167f);
        status = addAttribute( ia_grassBaseColour1 );
        CHECK_MSTATUS( status );
    }

            //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassTipColour1 = numericAttrFn.createColor( "grassTipColour1", "tCol1");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.395f,0.551f,0.257f);
        status = addAttribute( ia_grassTipColour1 );
        CHECK_MSTATUS( status );
    }

            //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassBaseColour2 = numericAttrFn.createColor( "grassBaseColour2", "bCol2");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.275f,0.243f,0.043f);
        status = addAttribute( ia_grassBaseColour2 );
        CHECK_MSTATUS( status );
    }

            //Initial grass bend direction
    {
        MFnNumericAttribute numericAttrFn;
        ia_grassTipColour2 = numericAttrFn.createColor( "grassTipColour2", "tCol2");
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( true );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setDefault(0.611f,0.587f,0.257f);
        status = addAttribute( ia_grassTipColour2 );
        CHECK_MSTATUS( status );
    }





     //Clock attribute. Passes maya frame counter into node
    {
        MFnNumericAttribute numericAttrFn;
        ia_clock = numericAttrFn.create( "clock", "clk", MFnNumericData::kLong, false, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( false );
        numericAttrFn.setKeyable( true );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( false );
        numericAttrFn.setMin( 0 );
        numericAttrFn.setDefault( 0 );
        status = addAttribute( ia_clock );
        CHECK_MSTATUS( status );
    }

    
    // "drawStyle"
    //
    // How we should draw in Maya.
    //
    // We will use this value in our Maya plug-in, but we
    // will NOT use it in Renderman. Note elsewhere that
    // this value will not be sent to Renderman, nor will
    // it have any effect on RIB generation.
    //
    // We think of this as an input attribute - hence the
    // prefix "ia_" for "input attribute". 
    {
        MFnEnumAttribute enumAttrFn;
        ia_drawStyle = enumAttrFn.create( "drawStyle", "ds", 1, & status );
        CHECK_MSTATUS( status );
        enumAttrFn.setReadable( true );
        enumAttrFn.setWritable( true );
        enumAttrFn.setStorable( true );
        enumAttrFn.setKeyable( true );
        enumAttrFn.setConnectable( true );
        enumAttrFn.setHidden( false );
        enumAttrFn.addField( "Bounds", 0 );
        enumAttrFn.addField( "Sub bounds", 1 );
        enumAttrFn.addField( "Geometry", 2 );
        enumAttrFn.addField( "Terrain slope normals", 3 );
        enumAttrFn.addField( "Point instances", 4 );
        enumAttrFn.addField( "Wind Velocity", 5 );
        enumAttrFn.addField( "All", 6 );
        enumAttrFn.setDefault(3);
        status = addAttribute( ia_drawStyle );
        CHECK_MSTATUS( status );
    }
    
    // "update"
    //
    // A 'dummy' attribute, and a powerful one. Although
    // the value of this attribute is actually meaningless,
    // when we ask for it we trigger an important computation
    // processs.
    //
    // We think of this as an input attribute - hence the
    // prefix "oa_" for "computation attribute". This signifies
    // that we don't really care about it's final value, but
    // that we know it's going to compute a lot of stuff. 
    {
        MFnNumericAttribute numericAttrFn;
        oa_update = numericAttrFn.create( "update", "upd", MFnNumericData::kBoolean, false, & status );
        CHECK_MSTATUS( status );
        numericAttrFn.setReadable( true );
        numericAttrFn.setWritable( true );
        numericAttrFn.setStorable( false );
        numericAttrFn.setKeyable( false );
        numericAttrFn.setConnectable( true );
        numericAttrFn.setHidden( true );
        status = addAttribute( oa_update );
        CHECK_MSTATUS( status );
    }


   
    
    
    // "rib"
    //
    // A string which contains all the attributes, and that
    //  we need to have (and indeed will see again) on the 
    // Renderman side of things.
    //
    // We think of this as an output attribute - hence the
    // prefix "oa_" for "output attribute". The value
    // computed for this attribute (the string) is important,
    // an is used by whatever is asking for it.
    {
        MFnTypedAttribute typedAttrFn;
        oa_rib = typedAttrFn.create( "rib", "rb", MFnData::kString, MObject::kNullObj, & status );
        CHECK_MSTATUS( status );
        typedAttrFn.setReadable( true );
        typedAttrFn.setWritable( true );
        typedAttrFn.setStorable( false );
        typedAttrFn.setKeyable( false );
        typedAttrFn.setConnectable( true );
        typedAttrFn.setHidden( true );
        status = addAttribute( oa_rib );
        CHECK_MSTATUS( status );
    }


    
    // This section tells Maya what attribute effects
    // which attribute. When input attributes change, 
    // make the attributes they effect "dirty". That 
    // means that, when Maya asks for a dirty attribute, 
    // it will need to be computed and "cleaned".
    //
    // Changing an effecting "input" attribute does not
    // trigger a computation of it's effected "output"
    // attribute. It just tells Maya that - if the effected
    // attribute is ever asked for, it will have to call
    // the compute method to calculate it.
    //
    // For complex relationships between attributes,
    // an attributeEffects() call must exist for each
    // relationship. If A effects B, and B effects C,
    // then we will need to make two attributeEffects()
    // calls - one for A effecting B and one for B 
    // effecting C. Maya will not figure out that, if A
    // effects B, and B effets C, then A must effect C.
    //
    // Below we see that most "input" attributes effect
    // both our internal update and the rib generation
    // the same way in each case. But it's not always 
    // exactly the same like this.
    //
    // Notice also that ia_drawStyle does not effect
    // any of the attributes. It's something that's just
    // used in the draw method.
    
    attributeAffects( ia_seed, oa_update );
    attributeAffects( ia_seed, oa_rib );
    
    attributeAffects( ia_roughness, oa_update );
    attributeAffects( ia_roughness, oa_rib );

    attributeAffects( ia_smooth, oa_update );
    attributeAffects( ia_smooth, oa_rib );

    attributeAffects( ia_planeHeight, oa_update );
    attributeAffects( ia_planeHeight, oa_rib );

    attributeAffects( ia_resolution, oa_update );
    attributeAffects( ia_rmanResolution, oa_rib );
    
    attributeAffects( ia_planeSize, oa_update );
    attributeAffects( ia_planeSize, oa_rib );

    attributeAffects( ia_gridSize, oa_update );
    attributeAffects( ia_gridSize, oa_rib );

    attributeAffects( ia_grassMultiplier, oa_update );
    attributeAffects( ia_grassMultiplier, oa_rib );

    attributeAffects( ia_baseWidth, oa_update );
    attributeAffects( ia_baseWidth, oa_rib );

    attributeAffects( ia_grassSegmentLength, oa_update );
    attributeAffects( ia_grassSegmentLength, oa_rib );

    attributeAffects( ia_grassNumSegments, oa_update );
    attributeAffects( ia_grassNumSegments, oa_rib );

    attributeAffects( ia_grassBendAmount, oa_update );
    attributeAffects( ia_grassBendAmount, oa_rib );

    attributeAffects( ia_windDirection, oa_update );
    attributeAffects( ia_windDirection, oa_rib );

    attributeAffects( ia_windSpread, oa_update );
    attributeAffects( ia_windSpread, oa_rib );

    attributeAffects( ia_clock, oa_update );
    attributeAffects( ia_clock, oa_rib );

    attributeAffects( ia_grassBaseColour1, oa_update);
    attributeAffects( ia_grassBaseColour1, oa_rib);

    attributeAffects( ia_grassTipColour1, oa_update);
    attributeAffects( ia_grassTipColour1, oa_rib);

    attributeAffects( ia_grassBaseColour2, oa_update);
    attributeAffects( ia_grassBaseColour2, oa_rib);

    attributeAffects( ia_grassTipColour2, oa_update);
    attributeAffects( ia_grassTipColour2, oa_rib);


    
    
    fprintf( stderr, "VmIslandNode::initialize() done\n" );

    return MStatus::kSuccess;
}
Example #5
0
MStatus meshOpNode::initialize()
//
//	Description:
//		This method is called to create and initialize all of the attributes
//      and attribute dependencies for this node type.  This is only called 
//		once when the node type is registered with Maya.
//
//	Return Values:
//		MS::kSuccess
//		MS::kFailure
//		
{
	MStatus				status;

	MFnTypedAttribute attrFn;
	MFnEnumAttribute enumFn;

	cpList = attrFn.create("inputComponents", "ics",
		MFnComponentListData::kComponentList);
	attrFn.setStorable(true);	// To be stored during file-save

	opType = enumFn.create("operationType", "oprt", 0, &status);
	enumFn.addField("subd_edges", 0);
	enumFn.addField("subd_faces", 1);
	enumFn.setHidden(false);
	enumFn.setKeyable(true);
	enumFn.setStorable(true);	// To be stored during file-save

	inMesh = attrFn.create("inMesh", "im", MFnMeshData::kMesh);
	attrFn.setStorable(true);	// To be stored during file-save

	// Attribute is read-only because it is an output attribute
	//
	outMesh = attrFn.create("outMesh", "om", MFnMeshData::kMesh);
	attrFn.setStorable(false);
	attrFn.setWritable(false);

	// Add the attributes we have created to the node
	//
	status = addAttribute( cpList );
		if (!status)
		{
			status.perror("addAttribute");
			return status;
		}
	status = addAttribute( opType );
		if (!status)
		{
			status.perror("addAttribute");
			return status;
		}
	status = addAttribute( inMesh );
		if (!status)
		{
			status.perror("addAttribute");
			return status;
		}
	status = addAttribute( outMesh);
		if (!status)
		{
			status.perror("addAttribute");
			return status;
		}

	// Set up a dependency between the input and the output.  This will cause
	// the output to be marked dirty when the input changes.  The output will
	// then be recomputed the next time the value of the output is requested.
	//
	status = attributeAffects( inMesh, outMesh );
		if (!status)
		{
			status.perror("attributeAffects");
			return status;
		}

	status = attributeAffects( cpList, outMesh );
		if (!status)
		{
			status.perror("attributeAffects");
			return status;
		}

	status = attributeAffects( opType, outMesh );
		if (!status)
		{
			status.perror("attributeAffects");
			return status;
		}

	return MS::kSuccess;

}
MStatus NuiMayaDeviceGrabber::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.
	//
	MFnNumericAttribute nAttr;
	MFnTypedAttribute	typedAttr;
	MFnUnitAttribute	unitAttr;
	MFnEnumAttribute	enumAttr;
	MStatus				stat;

	aTime = unitAttr.create( "time", "tm",
		MFnUnitAttribute::kTime,
		0.0, &stat );
	stat = addAttribute( aTime );
	if (!stat) { stat.perror("addAttribute time"); return stat;}

	aUseCache = nAttr.create( "useCache", "uc", MFnNumericData::kBoolean, false );
	// Attribute will be written to files when this type of node is stored
	nAttr.setStorable(true);
	// Attribute is keyable and will show up in the channel box
	stat = addAttribute( aUseCache );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aDeviceOn = nAttr.create( "deviceOn", "do", MFnNumericData::kBoolean, false );
	// Attribute will be written to files when this type of node is stored
	nAttr.setStorable(true);
	// Attribute is keyable and will show up in the channel box
	stat = addAttribute( aDeviceOn );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aDeviceMode = enumAttr.create( "deviceMode", "dm", NuiRGBDDeviceController::EDeviceMode_VertexColorCamera, &stat );
	if (!stat) { stat.perror("create DeviceMode attribute"); return stat;}
	stat = enumAttr.addField( "Depth,Color", NuiRGBDDeviceController::EDeviceMode_DepthColor );
	if (!stat) { stat.perror("add enum type DepthColor"); return stat;}
	stat = enumAttr.addField( "Depth,Color,Player", NuiRGBDDeviceController::EDeviceMode_VertexColorCamera );
	if (!stat) { stat.perror("add enum type DepthColorPlayer"); return stat;}
	stat = enumAttr.addField( "Depth,Color,Skeleton", NuiRGBDDeviceController::EDeviceMode_VertexColorSkeleton );
	if (!stat) { stat.perror("add enum type DepthColorSkeleton"); return stat;}
	stat = enumAttr.addField( "Depth,Color,Skeleton,Face", NuiRGBDDeviceController::EDeviceMode_VertexColorSkeletonFace );
	if (!stat) { stat.perror("add enum type DepthColorSkeletonFace"); return stat;}
	stat = enumAttr.addField( "Depth,Color,Skeleton,Gesture", NuiRGBDDeviceController::EDeviceMode_VertexColorSkeletonGesture );
	if (!stat) { stat.perror("add enum type DepthColorSkeletonGesture"); return stat;}
	stat = enumAttr.addField( "Color", NuiRGBDDeviceController::EDeviceMode_Color );
	if (!stat) { stat.perror("add enum type Color"); return stat;}
	stat = enumAttr.addField( "Depth", NuiRGBDDeviceController::EDeviceMode_Vertex );
	if (!stat) { stat.perror("add enum type Depth"); return stat;}
	stat = enumAttr.addField( "Skeleton", NuiRGBDDeviceController::EDeviceMode_Skeleton );
	if (!stat) { stat.perror("add enum type Skeleton"); return stat;}
	stat = enumAttr.addField( "Fusion", NuiRGBDDeviceController::EDeviceMode_Fusion );
	if (!stat) { stat.perror("add enum type fusion"); return stat;}
	CHECK_MSTATUS( enumAttr.setHidden( false ) );
	CHECK_MSTATUS( enumAttr.setKeyable( false ) );
	stat = addAttribute( aDeviceMode );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aNearMode = nAttr.create( "nearMode", "ne", MFnNumericData::kBoolean, false );
	// Attribute will be written to files when this type of node is stored
	nAttr.setStorable(true);
	// Attribute is keyable and will show up in the channel box
	stat = addAttribute( aNearMode );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aElevationAngle = nAttr.create( "elevationAngle", "ea", MFnNumericData::kInt, 0 );
	// Attribute will be written to files when this type of node is stored
	nAttr.setStorable(true);
	nAttr.setKeyable(true);
	nAttr.setMin(-27);
	nAttr.setMax(27);
	// Attribute is keyable and will show up in the channel box
	stat = addAttribute( aElevationAngle );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aPreviewerOn = nAttr.create( "previewerOn", "po", MFnNumericData::kBoolean, false );
	// Attribute will be written to files when this type of node is stored
	nAttr.setStorable(true);
	// Attribute is keyable and will show up in the channel box
	stat = addAttribute( aPreviewerOn );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aKinFuOn = nAttr.create( "fusionOn", "fo", MFnNumericData::kBoolean, false );
	// Attribute will be written to files when this type of node is stored
	nAttr.setStorable(true);
	// Attribute is keyable and will show up in the channel box
	stat = addAttribute( aKinFuOn );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aVolumeVoxelSize = nAttr.create( "volumeVoxelSize", "vvs", MFnNumericData::kFloat, 0.01f );
	// Attribute will be written to files when this type of node is stored
	nAttr.setStorable(true);
	nAttr.setKeyable(true);
	nAttr.setMin(0.005f);
	nAttr.setMax(0.02f);
	// Attribute is keyable and will show up in the channel box
	stat = addAttribute( aVolumeVoxelSize );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aShowInvalid = nAttr.create("showInvalid", "siv", MFnNumericData::kBoolean, false, &stat);
	MCHECKERROR( stat, "create showInvalid attribute" )
	nAttr.setKeyable(true);
	ADD_ATTRIBUTE( aShowInvalid );

	aShowOnlyBody = nAttr.create("showOnlyBody", "sc", MFnNumericData::kBoolean, false, &stat);
	MCHECKERROR( stat, "create showOnlyBody attribute" )
	nAttr.setKeyable(true);
	ADD_ATTRIBUTE( aShowOnlyBody );

	aShowMesh = nAttr.create("showMesh", "sm", MFnNumericData::kBoolean, false, &stat);
	MCHECKERROR( stat, "create showMesh attribute" )
	nAttr.setKeyable(true);
	ADD_ATTRIBUTE( aShowMesh );

	aMinDepth = nAttr.create( "nearPlane", "np", MFnNumericData::kShort, 400 );
	// Attribute will be written to files when this type of node is stored
	nAttr.setStorable(true);
	nAttr.setKeyable(true);
	nAttr.setMin(400);
	nAttr.setMax(4500);
	// Attribute is keyable and will show up in the channel box
	stat = addAttribute( aMinDepth );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aMaxDepth = nAttr.create( "farPlane", "fp", MFnNumericData::kShort, 4200 );
	// Attribute will be written to files when this type of node is stored
	nAttr.setStorable(true);
	nAttr.setKeyable(true);
	nAttr.setMin(400);
	nAttr.setMax(4500);
	// Attribute is keyable and will show up in the channel box
	stat = addAttribute( aMaxDepth );
	if (!stat) { stat.perror("addAttribute"); return stat;}


	// ----------------------- OUTPUTS -------------------------
	aOutputMappable = typedAttr.create( "outputPointCloud", "opc",
		NuiMayaMappableData::id,
		MObject::kNullObj, &stat );
	if (!stat) { stat.perror("create outputPointCloud attribute"); return stat;}
	typedAttr.setWritable( false );
	typedAttr.setStorable(false);
	stat = addAttribute( aOutputMappable );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aOutputSkeleton = typedAttr.create( "outputSkeleton", "osk",
		NuiMayaSkeletonData::id,
		MObject::kNullObj, &stat );
	if (!stat) { stat.perror("create outputSkeleton attribute"); return stat;}
	typedAttr.setWritable( false );
	typedAttr.setStorable(false);
	stat = addAttribute( aOutputSkeleton );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aOutputMesh = typedAttr.create( "outputMesh", "om",
		MFnData::kMesh,
		MObject::kNullObj, &stat );
	MCHECKERROR( stat, "create outputSurface attribute" )
		typedAttr.setWritable( false );
	ADD_ATTRIBUTE( aOutputMesh );

	aOutputGesture = typedAttr.create( "outputGesture", "ogs",
		NuiMayaGestureData::id,
		MObject::kNullObj, &stat );
	if (!stat) { stat.perror("create outputGesture attribute"); return stat;}
	typedAttr.setWritable( false );
	typedAttr.setStorable(false);
	stat = addAttribute( aOutputGesture );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aOutputFacialModel = typedAttr.create( "outputFacialModel", "ofm",
		NuiMayaFacialModelData::id,
		MObject::kNullObj, &stat );
	if (!stat) { stat.perror("create outputFacialModel attribute"); return stat;}
	typedAttr.setWritable( false );
	stat = addAttribute( aOutputFacialModel );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aFaceRotateX = nAttr.create( "faceRotateX", "frX", MFnNumericData::kDouble, 0.0, &stat );
	if (!stat) { stat.perror("create face rotateX attribute"); return stat;}
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	aFaceRotateY = nAttr.create( "faceRotateY", "frY", MFnNumericData::kDouble, 0.0, &stat );
	if (!stat) { stat.perror("create face rotateY attribute"); return stat;}
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	aFaceRotateZ = nAttr.create( "faceRotateZ", "frZ", MFnNumericData::kDouble, 0.0, &stat );
	if (!stat) { stat.perror("create rotateZ attribute"); return stat;}
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	aFaceRotate = nAttr.create( "faceRotate", "fr", aFaceRotateX, aFaceRotateY, aFaceRotateZ, &stat );
	if (!stat) { stat.perror("create face rotate attribute"); return stat;}
	nAttr.setDefault(0.0f, 0.0f, 0.0f);
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	stat = addAttribute( aFaceRotate );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aCameraRotateX = nAttr.create( "cameraRotateX", "crX", MFnNumericData::kDouble, 0.0, &stat );
	if (!stat) { stat.perror("create cameraRotateX attribute"); return stat;}
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	aCameraRotateY = nAttr.create( "cameraRotateY", "crY", MFnNumericData::kDouble, 0.0, &stat );
	if (!stat) { stat.perror("create rotateY attribute"); return stat;}
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	aCameraRotateZ = nAttr.create( "cameraRotateZ", "crZ", MFnNumericData::kDouble, 0.0, &stat );
	if (!stat) { stat.perror("create rotateZ attribute"); return stat;}
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	aCameraRotate = nAttr.create( "cameraRotate", "cr", aCameraRotateX, aCameraRotateY, aCameraRotateZ, &stat );
	if (!stat) { stat.perror("create cameraRotate attribute"); return stat;}
	nAttr.setDefault(0.0f, 0.0f, 0.0f);
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	stat = addAttribute( aCameraRotate );
	if (!stat) { stat.perror("addAttribute"); return stat;}

	aCameraTranslateX = nAttr.create( "cameraTranslateX", "ctX", MFnNumericData::kDouble, 0.0, &stat );
	if (!stat) { stat.perror("create cameraTranslateX attribute"); return stat;}
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	aCameraTranslateY = nAttr.create( "cameraTranslateY", "ctY", MFnNumericData::kDouble, 0.0, &stat );
	if (!stat) { stat.perror("create cameraTranslateY attribute"); return stat;}
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	aCameraTranslateZ = nAttr.create( "cameraTranslateZ", "ctZ", MFnNumericData::kDouble, 0.0, &stat );
	if (!stat) { stat.perror("create cameraTranslateZ attribute"); return stat;}
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	aCameraTranslate = nAttr.create( "cameraTranslate", "ct", aCameraTranslateX, aCameraTranslateY, aCameraTranslateZ, &stat );
	if (!stat) { stat.perror("create cameraTranslate attribute"); return stat;}
	nAttr.setDefault(0.0f, 0.0f, 0.0f);
	nAttr.setReadable( true );
	nAttr.setWritable( false );
	nAttr.setStorable(true);
	stat = addAttribute( aCameraTranslate );
	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( aTime, aOutputMappable );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aOutputSkeleton );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aOutputFacialModel );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aFaceRotateX );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aFaceRotateY );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aFaceRotateZ );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aFaceRotate );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aCameraRotateX );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aCameraRotateY );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aCameraRotateZ );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aCameraRotate );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aCameraTranslateX );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aCameraTranslateY );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aCameraTranslateZ );
	if (!stat) { stat.perror("attributeAffects"); return stat;}
	stat = attributeAffects( aTime, aCameraTranslate );
	if (!stat) { stat.perror("attributeAffects"); return stat;}

	return MS::kSuccess;
}