#include <maya/MFnPlugin.h>
#include <maya/MTypeId.h>
#include <maya/MMatrixArray.h>
#include <maya/MStringArray.h>
#include <maya/MFloatArray.h>
#include <maya/MPoint.h>
#include <maya/MPointArray.h>
#include <maya/MPxBlendShape.h>
#include <maya/MItGeometry.h>
#include <maya/MFnPointArrayData.h>
#include <maya/MFnComponentListData.h>
#include <map>
{
public:
static void* creator();
unsigned int multiIndex) override;
};
const MTypeId basicBlendShapeDeformer::id( 0x00080042 );
void* basicBlendShapeDeformer::creator()
{
return new basicBlendShapeDeformer();
}
MStatus basicBlendShapeDeformer::initialize()
{
}
basicBlendShapeDeformer::deform(
MDataBlock& block,
unsigned int multiIndex)
{
MPlug inPlug(thisMObject(),input);
inPlug.selectAncestorLogicalIndex(multiIndex,input);
for (unsigned int w=0; w < numTargets; ++w) {
}
if ( !returnStatus ) {
return returnStatus;
}
for (unsigned int w=0; w < numTargets; ++w) {
MPlug plug( thisMObject(), inputPointsTarget );
plug.selectAncestorLogicalIndex( multiIndex, inputTarget );
plug.selectAncestorLogicalIndex( w, inputTargetGroup );
plug.selectAncestorLogicalIndex( 6000, inputTargetItem );
MObject pointArray = plug.asMObject();
plug = plug.parent();
plug = plug.child( inputComponentsTarget );
if ( compList.length() == 0 ) {
continue;
}
float vertWeight = targetEnvelope[w];
unsigned int ptIndex = 0;
std::map<unsigned int, unsigned int> componentToPointMap;
for ( ; !iter.isDone(); iter.next(), ++ptIndex )
componentToPointMap[iter.index()] = ptIndex;
unsigned int compIndex = iterator.
index();
auto r = componentToPointMap.find(compIndex);
if (r == componentToPointMap.end())
continue;
ptIndex = r->second;
float wgt = vertWeight;
}
pt += deltaPts[ptIndex] * wgt;
}
}
return returnStatus;
}
{
MFnPlugin plugin( obj, PLUGIN_COMPANY,
"3.0",
"Any");
result = plugin.registerNode(
"basicBlendShapeDeformer" ,
basicBlendShapeDeformer::id ,
&basicBlendShapeDeformer::creator ,
&basicBlendShapeDeformer::initialize ,
);
return result;
}
{
result = plugin.deregisterNode( basicBlendShapeDeformer::id );
return result;
}