#include <math.h>
#include <maya/MIOStream.h>
#include <maya/MSimple.h>
#include <maya/MFnNurbsCurve.h>
#include <maya/MPointArray.h>
#include <maya/MDoubleArray.h>
#include <maya/MPoint.h>
#include <maya/MRampAttribute.h>
#include <maya/MFnVolumeLight.h>
#include <maya/MFloatArray.h>
#include <maya/MIntArray.h>
#include <maya/MColorArray.h>
#include <maya/MColor.h>
#define EQUAL(a,b) ( (((a-b) > -0.00001) && ((a-b) < 0.00001)) ? 1 : 0 )
{
double arc = 180.0f;
double coneEndRadius = 0.0f;
bool emitAmbient = true;
unsigned i;
for ( i = 0; i < args.
length(); i++ )
{
{
double tmp = args.
asDouble( ++i, &stat );
arc = tmp;
}
{
double tmp = args.
asDouble( ++i, &stat );
coneEndRadius = tmp;
}
{
bool tmp = args.
asBool( ++i, &stat );
emitAmbient = tmp;
}
}
cout<<"What's up?";
{
cout<<"Error creating light."<<endl;
return stat;
}
stat = light.
setArc ((
float)arc);
{
cout<<"Error setting \"arc\" attribute."<<endl;
return stat;
}
{
cout<<"Error setting \"volumeLightDirection\" attribute."<<endl;
return stat;
}
{
cout<<"Error setting \"coneEndRadius\" attribute."<<endl;
return stat;
}
{
cout<<"Error setting \"emitAmbient\" attribute."<<endl;
return stat;
}
{
cout<<"Error setting \"lightShape\" attribute."<<endl;
return stat;
}
double arcGet = light.
arc (&stat);
{
cout<<"Error getting \"arc\" attribute."<<endl;
return stat;
}
if (
MS::kSuccess != stat || volumeLightDirectionGet != volumeLightDirection)
{
cout<<"Error getting \"volumeLightDirection\" attribute."<<endl;
return stat;
}
if (
MS::kSuccess != stat || coneEndRadiusGet != coneEndRadius)
{
cout<<"Error getting \"coneEndRadius\" attribute."<<endl;
return stat;
}
{
cout<<"Error getting \"emitAmbient\" attribute."<<endl;
return stat;
}
{
cout<<"Error getting \"lightShape\" attribute."<<endl;
return stat;
}
{
cout<<"Error getting \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Error getting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Invalid number of entries in \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Error adding entries to \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Error getting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Invalid number of entries in \"penumbraRamp\" attribute."<<endl;
return stat;
}
float newVal = -1;
{
cout<<"Error interpolating value from \"penumbraRamp\" attribute."<<endl;
return stat;
}
if ( !EQUAL(newVal, .15f))
{
cout<<"Invalid interpolation in \"penumbraRamp\" expected .15 got "<<newVal
<<" ."<<endl;
}
{
cout<<"Error deleting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Invalid number of entries in \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Error deleting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Invalid number of entries in \"penumbraRamp\" attribute."<<endl;
return stat;
}
entriesToDelete.
append (d2[0]);
{
cout<<"Error deleting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Error getting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
entriesToDelete.
append (d2[0]);
{
cout<<"Error deleting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
printf("Error setting position at index: %d, of \"penumbraRamp\" attribute.\n", d2[0]);
return stat;
}
{
printf("Error setting value at index: %d, of \"penumbraRamp\" attribute.\n", d2[0]);
return stat;
}
{
printf("Error setting interpolation at index: %d, of \"penumbraRamp\" attribute.\n", d2[0]);
return stat;
}
{
cout<<"Error getting \"colorRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Error getting entries from \"colorRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Invalid number of entries in \"colorRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Error adding entries to \"colorRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Error getting entries from \"colorRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Invalid number of entries in \"colorRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Error interpolating color from \"penumbraRamp\" attribute."<<endl;
return stat;
}
if ( !EQUAL(newCol[2], .45))
{
cout<<"Invalid color interpolation in \"colorRamp\" expected .45 got "<<newCol[2]<<endl;
}
{
cout<<"Error setting color at index: "<<d5[0]
<<", of \"colorRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Error setting interpolation at index: "<<d5[1]
<<", of \"colorRamp\" attribute."<<endl;
return stat;
}
ramp2.
getEntries( indices, pos, colors, interps, &stat);
{
cout<<"Error getting entries from \"colorRamp\" attribute."<<endl;
return stat;
}
for (
unsigned int i=0; i<colors.
length(); i++)
{
colors[i] = colors[i]*2;
}
stat = ramp2.
setRamp( colors, pos, interps );
{
cout<<"Error setting values on \"colorRamp\" attribute."<<endl;
return stat;
}
stat = ramp2.
sort(
true );
{
cout<<"Error sorting entries from \"colorRamp\" attribute."<<endl;
return stat;
}
{
}
{
}
return stat;
}