Issue creating nodes in API [C++]

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm learning and I compiled the ApiMesh example all went ok etc.
On that example a mel script is providen to test it
createNode apiMesh;
createNode apiMeshCreator;
connectAttr apiMeshCreator1.outputSurface apiMesh1.inputSurface ;
But I cannot replicate that on C++, I tried with the most logical idea:
//create mesh
MDagModifier dgMod;
MObject oApiMesh = dgMod.createNode(apiMesh::id, MObject::kNullObj, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = dgMod.doIt();
//create mesh creator
MDGModifier dgbMod;
MObject oApiMeshCreator = dgbMod.createNode(apiMeshCreator::id, &status);
CHECK_MSTATUS_AND_RETURN_IT(status);
status = dgbMod.doIt();
//connect them
apiMeshCreator* myMeshCreator = (apiMeshCreator*)&oApiMeshCreator;
apiMesh* myMesh = (apiMesh*)&oApiMesh;
dgMod.connect(oApiMeshCreator, myMeshCreator->outputSurface, oApiMesh, myMesh->inputSurface);
status = dgMod.doIt();
But nothing happens, notice that I used MDGModifier to create the apiMeshCreator (it inherits from MPxNode) since using MDagModifier the plugin crashes.
Any idea? Thank you in advance