I have written a custom shape which derives from MPxComponentShape. Its contains components which are not triangles or vertices. Those components need to be manipulated. To do so I was planning to use a MPxManipContainer which would contain ScaleManip/RotateManip etc…
First, I need to be able select a component of my shape. I’ve written a MPxSurfaceShapeUI class to draw and select my components. I’ve added a DagMenuProc to allow me to go in component selection more or object selection mode and I’ve written the code to select my components. For this I just create a MFnSingleIndexedComponent, and add my selected component indices to the list. But how do I retrieve that list during the draw() command (and really any other place in the code) to be able to display those components properly?
Second, once I have my component selected, I need to be able to trigger the manipulator for it.
As mentioned above, I’ve create a MPxManipContainer, to which I add all the standard manipulators. To hook the manipulator to my component, it seems I need to implement the connectToDependNode function, and set the proper MPlug to be modified by the manipulators (Position, Rotation and Scale). But the question I have here is how to I trigger the manipulator (so it gets created, and connected to my node)? When I click on the rotate manipulator in Maya, will it know automatically to attach itself to my node, and its selected component?
Also in the actual MPxComponentShape, my components are just an array of “stuff”. They are not MObject (and I would rather them not be, because MObject is just heavy weight). The container for my component is the shape itself, and the plan was to have an array of MPlugs as attributes for each component. I got confused with the implementation of tranformUsing() and the MPxGeometryIterator (I haven’t implemented one of those because I dont have a MPxGeometryData, which seems to be the data we need to have the iterator iterate over).