Faster Direct Manip
So a few months ago I made a post about a "meshLocator" which was a custom locator that matched the shape of a user-defined set of faces on a mesh, basically it was a controls that deformed which the shape of the mesh but without the clutter of using an actual mesh node (which you've probably seen many demos for),
That was my first experience with the MPxLocator class and even though and it was too slow. Computing the data needed to draw the locator was pretty fast but getting that data from the MPxLocator to the MPxDrawOverride (the class that actually does the drawing) was the bottleneck. After doing my best to optimize it, I made a long rambly video going over what I had done to try and make it go faster and tried to contact people who made proof-of concept videos of the same sort of thing.
Flash forward, and I'm gearing up to start at a new company, and one of the lead riggers had "deformable controls"/"directManip" on his wishlist. So I decided to revisit my plugin to see if any of the C++ and API knowledge I'd gained since I last worked on it, could get it up-to-speed.
I was able to do quite a lot of optimization of the compute method using pointers. But the breakthrough for the drawing step came from Matt LeFevre, one of the people who I had reached out to. He clued me into the fact that you could access internal data during the prepareForDraw step, which meant that I could safely use the setDependentsDirty method to determine which data needed to be updated for the draw.
With those two boosts, it's in a more usable state, but we still come up against the issue of having to do a separate draw for each meshLocator in sequence, with no possibility to parallelize. I would love for someone to tell me I've done something wrong but it's still far too slow to implement this way, which is unfortunate.
I've attached the .cpp in case anyone want's to give it a shot.