There are a number of light types available in Maya, all of them
are derived from MFn::kLight. They are :
MFn::kAmbientLight
MFn::kDirectionalLight
MFn::kSpotLight
MFn::kPointLight
MFn::kAreaLight
#include<maya/MFnLight.h>
#include<maya/MItDag.h>
// create an iterator to go through all
lights MItDag it(MFn::kLight);
while(!it.isDone())
{
// attach
the function set to the object
MFnLight fn(it.item());
// print light name
cout<<"Light
"<< fn.name().asChar()
<<endl;
outputLight(it.item());
// get next light
it.next();
}
Getting the light data
A general function set MFnLight exists to access
most of the common attributes shared between the various light
types.
In addition the class MFnPointLight, MFnAmbientLight,
MFnSpotLight, MFnDirectionalLight and MFnAreaLight can be used
to access more specialised attributes on other light types.