#include <string.h>
#include <maya/MIOStream.h>
#include <math.h>
#include <maya/MPxNode.h>
#include <maya/MPxCommand.h>
#include <maya/MFnNumericAttribute.h>
#include <maya/MFnTypedAttribute.h>
#include <maya/MFnPlugin.h>
#include <maya/MFnNurbsCurve.h>
#include <maya/MFnNurbsSurface.h>
#include <maya/MFnNurbsCurveData.h>
#include <maya/MFnNurbsSurfaceData.h>
#include <maya/MPointArray.h>
#include <maya/MDoubleArray.h>
#include <maya/MString.h>
#include <maya/MTypeId.h>
#include <maya/MPlug.h>
#include <maya/MDataBlock.h>
#include <maya/MDataHandle.h>
#include <maya/MGlobal.h>
#include <maya/MDagPath.h>
{
public:
fullLoft() {};
~fullLoft() override;
static void* creator();
public:
};
#define PERRORfail(s) \
if (!stat) { \
stat.perror(s); \
return stat; \
}
#define PERRORnull(s) \
if (!stat) { \
stat.perror(s); \
return MObject::kNullObj; \
}
fullLoft::~fullLoft ()
{
}
void* fullLoft::creator()
{
return new fullLoft();
}
{
inputCurve=typedAttr.
create(
"inputCurve",
"in",
&stat );
PERRORfail("initialize create input attribute");
PERRORfail("initialize set input attribute array");
outputSurface=typedAttr.
create(
"outputSurface",
"out",
&stat );
PERRORfail("initialize create output attribute");
PERRORfail("initialize set output attribute storable");
stat = addAttribute( inputCurve );
PERRORfail("addAttribute(inputCurve)");
stat = addAttribute( outputSurface );
PERRORfail("addAttribute(outputSurface)");
stat = attributeAffects( inputCurve, outputSurface );
PERRORfail("attributeAffects(inputCurve, outputSurface)");
return MS::kSuccess;
}
{
int i, j;
int numCVs;
if ( numCurves < 1 )
if (!stat) {
stat.
perror(
"fullLoft::loft: inputValue");
}
numCVs = countCurveFn.numCVs (&stat);
PERRORnull("fullLoft::loft counting CVs");
for (i = 0; i < numCurves; i++)
{
}
for ( i = 1; i < numCVs - 3; i ++ )
for (int curveNum = 0; curveNum < numCurves; curveNum++)
{
PERRORnull("fullLoft::loft getting CVs");
if (curveCVs.
length() != (unsigned)numCVs)
stat = MS::kFailure;
PERRORnull("fullLoft::loft inconsistent number of CVs - rebuild curves");
int repeats = (curveNum == 0) ? 1 : 3;
for (j = 0; j < repeats; j++)
for ( i = 0; i < numCVs; i++ )
stat = inputArray.
next ();
}
false, newSurfData, &stat );
PERRORnull ("fullLoft::Loft create surface");
return surf;
}
{
if ( plug == outputSurface )
{
&stat );
PERRORfail("fullLoft::compute getting input array data");
PERRORfail("fullLoft::compute getting output data handle");
PERRORfail("fullLoft::compute creating new nurbs surface data block");
loft(inputArrayData, newSurfData, stat );
if (!stat)
return stat;
stat = surfHandle.
set( newSurfData );
PERRORfail("fullLoft::compute setting surface handle");
PERRORfail("fullLoft::compute cleaning outputSurface plug");
}
else
{
return MS::kUnknownParameter;
}
return MS::kSuccess;
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"3.0",
"Any");
status = plugin.registerNode( "fullLoft", fullLoft::id, fullLoft::creator,
fullLoft::initialize );
if (!status) {
status.
perror(
"registerNode");
return status;
}
return status;
}
{
status = plugin.deregisterNode( fullLoft::id );
if (!status) {
status.
perror(
"deregisterNode");
return status;
}
return status;
}