#include <string.h>
#include <maya/MIOStream.h>
#include <math.h>
#include <maya/MPxNode.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MFnPlugin.h>
#include <maya/MString.h>
#include <maya/MTypeId.h>
#include <maya/MPlug.h>
#include <maya/MVector.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
{
public:
sine();
~sine() override;
static void* creator();
public:
};
sine::sine() {}
sine::~sine() {}
{
if( plug == output )
{
if( returnStatus != MS::kSuccess )
cerr << "ERROR getting data" << endl;
else
{
float result = sinf( inputData.
asFloat() ) * 10.0f;
outputHandle.
set( result );
}
} else {
return MS::kUnknownParameter;
}
return MS::kSuccess;
}
void* sine::creator()
{
return new sine();
}
{
stat = addAttribute( input );
if (!stat) { stat.
perror(
"addAttribute");
return stat;}
stat = addAttribute( output );
if (!stat) { stat.
perror(
"addAttribute");
return stat;}
stat = attributeAffects( input, output );
if (!stat) { stat.
perror(
"attributeAffects");
return stat;}
return MS::kSuccess;
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"3.0",
"Any");
status = plugin.registerNode( "sine", sine::id, sine::creator,
sine::initialize );
if (!status) {
status.
perror(
"registerNode");
return status;
}
return status;
}
{
status = plugin.deregisterNode( sine::id );
if (!status) {
status.
perror(
"deregisterNode");
return status;
}
return status;
}