#if _MSC_VER >= 1700
#pragma warning( disable: 4005 )
#endif
#include "dx11ConeAngleToHotspotConverter.h"
#include "dx11Shader.h"
#include "dx11ShaderStrings.h"
#include <maya/MFnNumericAttribute.h>
#include <maya/MFnUnitAttribute.h>
#include <maya/MString.h>
#include <maya/MPlug.h>
#include <maya/MPlugArray.h>
#include <maya/MAngle.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MFnDependencyNode.h>
#include <maya/MItDag.h>
#define McheckErr(stat,stringId) \
if ( MS::kSuccess != stat ) { \
MString msg = dx11ShaderStrings::getString(stringId); \
stat.perror(msg); \
return MS::kFailure; \
}
dx11ConeAngleToHotspotConverter::dx11ConeAngleToHotspotConverter() {}
dx11ConeAngleToHotspotConverter::~dx11ConeAngleToHotspotConverter() {}
void dx11ConeAngleToHotspotConverter::postConstructor( ) {
setExistWithoutOutConnections(false);
}
{
if ((plug == sHotspot) || (plug.
parent() == sHotspot)) {
McheckErr(returnStatus,dx11ShaderStrings::kErrorConeAngle);
McheckErr(returnStatus,dx11ShaderStrings::kErrorPenumbraAngle);
double outputAngle = coneAngle;
if (penumbraAngle < 0)
outputAngle += penumbraAngle;
outputRot.
set( outputAngle );
}
else if ((plug == sFalloff) || (plug.
parent() == sFalloff)) {
McheckErr(returnStatus,dx11ShaderStrings::kErrorConeAngle);
McheckErr(returnStatus,dx11ShaderStrings::kErrorPenumbraAngle);
double outputAngle = coneAngle;
if (penumbraAngle > 0)
outputAngle += penumbraAngle;
outputRot.
set( outputAngle );
} else
}
MTypeId dx11ConeAngleToHotspotConverter::typeId()
{
return sId;
}
void* dx11ConeAngleToHotspotConverter::creator()
{
return new dx11ConeAngleToHotspotConverter();
}
MStatus dx11ConeAngleToHotspotConverter::initialize()
{
stat = addAttribute( sConeAngle );
if (!stat) { stat.
perror(
"addAttribute");
return stat;}
stat = addAttribute( sPenumbraAngle );
if (!stat) { stat.
perror(
"addAttribute");
return stat;}
stat = addAttribute( sHotspot );
if (!stat) { stat.
perror(
"addAttribute");
return stat;}
stat = addAttribute( sFalloff );
if (!stat) { stat.
perror(
"addAttribute");
return stat;}
stat = attributeAffects( sConeAngle, sHotspot );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( sConeAngle, sFalloff );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( sPenumbraAngle, sHotspot );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
stat = attributeAffects( sPenumbraAngle, sFalloff );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
}