#include <math.h>
#include <maya/MIOStream.h>
#include <maya/MFnPlugin.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MFloatVector.h>
#include <maya/MPxGeometryOverride.h>
#include <maya/MDrawRegistry.h>
#include <maya/MHWGeometryUtilities.h>
#include <maya/MEventMessage.h>
#include <maya/MFnDependencyNode.h>
#include "apiDirectionalLightShape.h"
MTypeId apiDirectionalLightShape::id( 0x00081103 );
MTypeId apiSpotLightShape::id( 0x00081104 );
MTypeId apiPointLightShape::id( 0x00081105 );
MTypeId apiAreaLightShape::id( 0x00081106 );
MTypeId apiCustomDirectionalLightShape::id( 0x00081107 );
MTypeId apiImageLightShape::id( 0x00081108 );
MObject apiLightShape::aEmitDiffuse;
MObject apiLightShape::aEmitSpecular;
MObject apiLightShape::aLocatorScale;
MObject apiShadowingLightShape::aUseDepthMapShadows;
MObject apiShadowingLightShape::aUseRayTraceShadows;
MObject apiShadowingLightShape::aShadowColor;
MObject apiShadowingLightShape::aDepthMapResolution;
MObject apiSpotLightShape::aConeAngle;
MObject apiSpotLightShape::aPenumbraAngle;
MObject apiSpotLightShape::aDropOff;
#define MAKE_INPUT(attr) \
CHECK_MSTATUS(attr.setKeyable(true) ); \
CHECK_MSTATUS(attr.setStorable(true) ); \
CHECK_MSTATUS(attr.setReadable(true) ); \
CHECK_MSTATUS(attr.setWritable(true) ); \
CHECK_MSTATUS(attr.setAffectsAppearance(true) );
#define MAKE_OUTPUT(attr) \
CHECK_MSTATUS(attr.setKeyable(false) ); \
CHECK_MSTATUS(attr.setStorable(false) ); \
CHECK_MSTATUS(attr.setReadable(true) ); \
CHECK_MSTATUS(attr.setWritable(false) );
MStatus apiLightShape::initialize()
{
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
MAKE_OUTPUT(nAttr);
}
{
if ((plug != aOutColor) && (plug.
parent() != aOutColor))
{
}
outColor = resultColor;
}
MStatus apiShadowingLightShape::initialize()
{
apiLightShape::initialize();
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
aShadowColor = nAttr.
createColor(
"shadowColor",
"sc" );
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
CHECK_MSTATUS(attributeAffects(aUseDepthMapShadows, apiLightShape::aOutColor));
CHECK_MSTATUS(attributeAffects(aUseRayTraceShadows, apiLightShape::aOutColor));
CHECK_MSTATUS(attributeAffects(aShadowColor, apiLightShape::aOutColor));
CHECK_MSTATUS(attributeAffects(aDepthMapResolution, apiLightShape::aOutColor));
}
{
}
void* apiPointLightShape::creator()
{
return new apiPointLightShape();
}
MStatus apiPointLightShape::initialize()
{
apiLightShape::initialize();
}
MString & apiPointLightShape::drawdbIdentfier()
{
static MString drawdb(
"light:drawdb/light/pointLight");
return drawdb;
}
void* apiDirectionalLightShape::creator()
{
return new apiDirectionalLightShape();
}
MStatus apiDirectionalLightShape::initialize()
{
apiShadowingLightShape::initialize();
}
MString & apiDirectionalLightShape::drawdbIdentfier()
{
static MString drawdb(
"light:drawdb/light/directionalLight");
return drawdb;
}
void* apiSpotLightShape::creator()
{
return new apiSpotLightShape();
}
MStatus apiSpotLightShape::initialize()
{
apiShadowingLightShape::initialize();
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
MAKE_INPUT(nAttr);
CHECK_MSTATUS(attributeAffects(aConeAngle, apiLightShape::aOutColor));
CHECK_MSTATUS(attributeAffects(aPenumbraAngle, apiLightShape::aOutColor));
CHECK_MSTATUS(attributeAffects(aDropOff, apiLightShape::aOutColor));
}
MString & apiSpotLightShape::drawdbIdentfier()
{
static MString drawdb(
"light:drawdb/light/spotLight");
return drawdb;
}
void* apiAreaLightShape::creator()
{
return new apiAreaLightShape();
}
MStatus apiAreaLightShape::initialize()
{
apiShadowingLightShape::initialize();
}
MString & apiAreaLightShape::drawdbIdentfier()
{
static MString drawdb(
"light:drawdb/light/areaLight");
return drawdb;
}
apiCustomDirectionalLightShape::apiCustomDirectionalLightShape()
{
"modelEditorChanged", OnModelEditorChanged, this);
}
apiCustomDirectionalLightShape::~apiCustomDirectionalLightShape()
{
if (mModelEditorChangedCbId != 0)
{
mModelEditorChangedCbId = 0;
}
}
void* apiCustomDirectionalLightShape::creator()
{
return new apiCustomDirectionalLightShape();
}
MStatus apiCustomDirectionalLightShape::initialize()
{
apiDirectionalLightShape::initialize();
}
void apiCustomDirectionalLightShape::OnModelEditorChanged(void *clientData)
{
apiCustomDirectionalLightShape* shape = static_cast<apiCustomDirectionalLightShape*>(clientData);
if (shape)
{
}
}
MString & apiCustomDirectionalLightShape::drawdbIdentfier()
{
static MString drawdb(
"light:drawdb/light/directionalLight:drawdb/geometry/light/directionalLightCustom");
return drawdb;
}
bool apiCustomDirectionalLightShape::isBounded() const
{
return true;
}
MBoundingBox apiCustomDirectionalLightShape::boundingBox()
const
{
MPoint corner1( -2.0, -2.0, -2.0);
MPoint corner2( 2.0, 2.0, 2.0 );
}
{
public:
{
return new apiDirectionalLightShape_GeometryOverride(obj);
}
virtual ~apiDirectionalLightShape_GeometryOverride();
protected:
apiDirectionalLightShape_GeometryOverride(
const MObject& obj);
};
apiDirectionalLightShape_GeometryOverride::apiDirectionalLightShape_GeometryOverride(
const MObject& obj)
{
}
apiDirectionalLightShape_GeometryOverride::~apiDirectionalLightShape_GeometryOverride()
{
}
{
}
bool apiDirectionalLightShape_GeometryOverride::isIndexingDirty(
{
return false;
}
{
return false;
}
void apiDirectionalLightShape_GeometryOverride::updateDG()
{
}
void apiDirectionalLightShape_GeometryOverride::updateRenderItems(
{
}
void apiDirectionalLightShape_GeometryOverride::populateGeometry(
{
}
void apiDirectionalLightShape_GeometryOverride::cleanUp()
{
}
bool apiDirectionalLightShape_GeometryOverride::hasUIDrawables() const
{
return true;
}
void apiDirectionalLightShape_GeometryOverride::addUIDrawables(
{
objectTransformPath.pop();
if (objectTransformPath == cameraPath)
{
return;
}
double coneHeight = 1;
double coneRadius = 0.5;
{
}
else
{
}
if (filled)
{
}
else
{
}
coneDirection,
coneRadius,
coneHeight,
filled);
}
void* apiImageLightShape::creator()
{
return new apiImageLightShape();
}
MStatus apiImageLightShape::initialize()
{
apiLightShape::initialize();
}
MString & apiImageLightShape::drawdbIdentfier()
{
static MString drawdb(
"light:drawdb/light/image");
return drawdb;
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"1.0",
"Any");
MStatus stat = plugin.registerShape(
"apiPointLightShape", apiPointLightShape::id,
&apiPointLightShape::creator,
&apiPointLightShape::initialize,
NULL,
&apiPointLightShape::drawdbIdentfier());
if ( ! stat ) {
cerr << "Failed to register apiPointLightShape\n";
}
stat = plugin.registerShape( "apiDirectionalLightShape", apiDirectionalLightShape::id,
&apiDirectionalLightShape::creator,
&apiDirectionalLightShape::initialize,
NULL,
&apiDirectionalLightShape::drawdbIdentfier());
if ( ! stat ) {
cerr << "Failed to register apiDirectionalLightShape\n";
}
stat = plugin.registerShape( "apiSpotLightShape", apiSpotLightShape::id,
&apiSpotLightShape::creator,
&apiSpotLightShape::initialize,
NULL,
&apiSpotLightShape::drawdbIdentfier());
if ( ! stat ) {
cerr << "Failed to register apiSpotLightShape\n";
}
stat = plugin.registerShape( "apiAreaLightShape", apiAreaLightShape::id,
&apiAreaLightShape::creator,
&apiAreaLightShape::initialize,
NULL,
&apiAreaLightShape::drawdbIdentfier());
if ( ! stat ) {
cerr << "Failed to register apiAreaLightShape\n";
}
stat = plugin.registerShape( "apiImageLightShape", apiImageLightShape::id,
&apiImageLightShape::creator,
&apiImageLightShape::initialize,
NULL,
&apiImageLightShape::drawdbIdentfier());
if ( ! stat ) {
cerr << "Failed to register apiImageLightShape\n";
}
"directionalLightRegistrantId",
apiDirectionalLightShape_GeometryOverride::Creator);
if (!stat) {
cerr << "Failed to register apiDirectionalLightShape_GeometryOverride\n";
return stat;
}
stat = plugin.registerShape( "apiCustomDirectionalLightShape", apiCustomDirectionalLightShape::id,
&apiCustomDirectionalLightShape::creator,
&apiCustomDirectionalLightShape::initialize,
NULL,
&apiCustomDirectionalLightShape::drawdbIdentfier());
if ( ! stat ) {
cerr << "Failed to register apiCustomDirectionalLightShape\n";
}
return stat;
}
{
stat = plugin.deregisterNode( apiPointLightShape::id );
if ( ! stat ) {
cerr << "Failed to deregister apiPointLightShape\n";
}
stat = plugin.deregisterNode( apiDirectionalLightShape::id );
if ( ! stat ) {
cerr << "Failed to deregister apiDirectionalLightShape\n";
}
stat = plugin.deregisterNode( apiSpotLightShape::id );
if ( ! stat ) {
cerr << "Failed to deregister apiSpotLightShape\n";
}
stat = plugin.deregisterNode( apiAreaLightShape::id );
if ( ! stat ) {
cerr << "Failed to deregister apiAreaLightShape\n";
}
stat = plugin.deregisterNode( apiImageLightShape::id );
if ( ! stat ) {
cerr << "Failed to deregister apiImageLightShape\n";
}
"directionalLightRegistrantId");
if (! stat ) {
cerr << "Failed to deregister apiDirectionalLightShape_GeometryOverride\n";
}
stat = plugin.deregisterNode( apiCustomDirectionalLightShape::id );
if ( ! stat ) {
cerr << "Failed to deregister apiCustomDirectionalLightShape\n";
}
return stat;
}