This post is about writing interactive manipulators such as the transform tool or the newly introduced tweak tool, something XSI doesn’t support in its catalog of plugin types by default, but still possible to develop by going through a crazy round trip.
When it comes to real-time plug-ins, XSI allows writing custom operators able to react to inputs and produce outputs, but what if the input we need is the mouse?
We haven’t got any mouse operator or event in the SDK yet, in fact all this kind of tools in XSI are emended into the core, but fortunately for us, we still have some tricks by our side to fill this gap and write our own interactive tools.
In the example bellow I’ve done a test, a custom manipulator to “sketch” the pose of a character by tracing quick strokes.
The tool is in fact a fully functional and integrated manipulator, it is done by using some windows functions to “steal” the mouse from XSI. Under XSI’s SDK workgroup directory there’s a great example about this topic: UserNormalEditing by Alain Laferriere, thanks for sharing Alain!
Then, to interact with the objects in scene I’ve used a custom display pass plug-in. For any object of interest there is an OpenGL primitive with a reference to the object in scene, OpenGL picking algorithm does the rest of the job by returning what’s under the mouse pointer.
Every time an event is fired from the mouse a refresh-viewport command is executed, at this point from the custom display pass a check occurs to get the currently picked object.
I’m thinking as next step to add the possibility of scripting all this mess ;)
I love this new plugin type!