#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++ )
{
&& MS::kSuccess == stat)
{
double tmp = args.
asDouble( ++i, &stat );
if ( MS::kSuccess == stat )
arc = tmp;
}
&& MS::kSuccess == stat)
{
double tmp = args.
asDouble( ++i, &stat );
if ( MS::kSuccess == stat )
coneEndRadius = tmp;
}
&& MS::kSuccess == stat)
{
bool tmp = args.
asBool( ++i, &stat );
if ( MS::kSuccess == stat )
emitAmbient = tmp;
}
}
cout<<"What's up?";
if ( MS::kSuccess != stat )
{
cout<<"Error creating light."<<endl;
return stat;
}
stat = light.
setArc ((
float)arc);
if ( MS::kSuccess != stat )
{
cout<<"Error setting \"arc\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat )
{
cout<<"Error setting \"volumeLightDirection\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat )
{
cout<<"Error setting \"coneEndRadius\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat )
{
cout<<"Error setting \"emitAmbient\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat )
{
cout<<"Error setting \"lightShape\" attribute."<<endl;
return stat;
}
double arcGet = light.
arc (&stat);
if ( MS::kSuccess != stat || arcGet != arc)
{
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;
}
if ( MS::kSuccess != stat || emitAmbientGet != emitAmbient)
{
cout<<"Error getting \"emitAmbient\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat || lightShapeGet != lightShape)
{
cout<<"Error getting \"lightShape\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat )
{
cout<<"Error getting \"penumbraRamp\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat )
{
cout<<"Error getting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Invalid number of entries in \"penumbraRamp\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat)
{
cout<<"Error adding entries to \"penumbraRamp\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != 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;
if ( MS::kSuccess != stat )
{
cout<<"Error interpolating value from \"penumbraRamp\" attribute."<<endl;
return stat;
}
if ( !EQUAL(newVal, .15f))
{
cout<<"Invalid interpolation in \"penumbraRamp\" expected .15 got "<<newVal
<<" ."<<endl;
}
if ( MS::kSuccess != stat )
{
cout<<"Error deleting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Invalid number of entries in \"penumbraRamp\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess == 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]);
if ( MS::kSuccess != stat)
{
cout<<"Error deleting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat)
{
cout<<"Error getting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
entriesToDelete.
append (d2[0]);
if ( MS::kSuccess == stat)
{
cout<<"Error deleting entries from \"penumbraRamp\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat)
{
printf("Error setting position at index: %d, of \"penumbraRamp\" attribute.\n", d2[0]);
return stat;
}
if ( MS::kSuccess != stat)
{
printf("Error setting value at index: %d, of \"penumbraRamp\" attribute.\n", d2[0]);
return stat;
}
if ( MS::kSuccess != stat)
{
printf("Error setting interpolation at index: %d, of \"penumbraRamp\" attribute.\n", d2[0]);
return stat;
}
if ( MS::kSuccess != stat)
{
cout<<"Error getting \"colorRamp\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat)
{
cout<<"Error getting entries from \"colorRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Invalid number of entries in \"colorRamp\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat)
{
cout<<"Error adding entries to \"colorRamp\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat)
{
cout<<"Error getting entries from \"colorRamp\" attribute."<<endl;
return stat;
}
{
cout<<"Invalid number of entries in \"colorRamp\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != 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;
}
if ( MS::kSuccess != stat)
{
cout<<"Error setting color at index: "<<d5[0]
<<", of \"colorRamp\" attribute."<<endl;
return stat;
}
if ( MS::kSuccess != stat)
{
cout<<"Error setting interpolation at index: "<<d5[1]
<<", of \"colorRamp\" attribute."<<endl;
return stat;
}
ramp2.
getEntries( indices, pos, colors, interps, &stat);
if ( MS::kSuccess != 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 );
if ( MS::kSuccess != stat)
{
cout<<"Error setting values on \"colorRamp\" attribute."<<endl;
return stat;
}
stat = ramp2.
sort(
true );
if ( MS::kSuccess != stat)
{
cout<<"Error sorting entries from \"colorRamp\" attribute."<<endl;
return stat;
}
{
}
{
}
return stat;
}