Hey guys, first post here so lets see how this goes.
I have an MPxNode and an MPxLocatorNode. The MPxNode basically creates an MPointArray and sends it to the MPxLocatorNode which draws the point array. The MPxLocator grabs the data from MPlug since I am not using a compute function on the locator node.
I plagued my code with status checks and all seems well. When in debug mode I have no problems 'createNode' for both of them and then connect the output to input with the connection editor. As I expected the points are drawn and oh happy joy.
When I build for release and do the same steps...maya crashes with fatal error. Again, all my status checks came out fine so it has been really hard to pinpoint where the problem is, hope some of you guys can give me a heads up.
//-------------Code for MPxNode (Outputs MPointArray)-----------------------------------
My init() for the MPxNode is as follows:
....
MFnTypedAttribute tAttr;
a_Points = tAttr.create("outPoints","opnt",MFnPointArrayData::kPointArray,&status);
status = addAttribute(a_Points);
My compute() for the same MPxNode is as follows:
....
MDataHandle h_aPoints = data.outputValue(a_Points,&status);
MFnPointArrayData fn_aPoints;
MPointArray p_aPoints;
//---store some points in MPointArray
MObject o_aPoints = fn_aPoints.create(p_aPoints,&status);
h_aPoints.set(o_aPoints);
//---establish affects relationship from an int input
status = data.setClean ( plug );
//-------------Code for MPxLocatorNode (Gets MPointArray and draws points)------------
My init() for the MPxLocatorNode
....
MFnTypedAttribute tAttr;
a_Points = tAttr.create("inPoints","ipnt",MFnPointArrayData::kPointArray,&status);
status = addAttribute(a_Points);
//This output attribute is not used
MFnTypedAttribute oAttr;
a_PointsOut = tAttr.create("pointsOut","ptsO",MFnPointArrayData::kPointArray,&status);
My draw() for MPxLocator
....
MPointArray pts;
MObject thisNode = thisMObject();
MPlug plug_aPoints(thisNode,a_Points);
MObject o_aPoints;
plug_aPoints.getValue(o_aPoints);
MFnPointArrayData fn_aPoints(o_aPoints);
fn_aPoints.copyTo(pts);
....
//Begin GL
Like I said before, when I am in debug mode in VS I have gone through many breakpoints and nothing...plugin works and displays points and recomputes when I change the MPointArray being sent to the MPxLocatorNode. Just to remind, the crash occurs when I make the connection on the release version of the plugin. I'm pretty sure debugger is letting something pass...I have checked outputs and cant seem to spot anything.