I have been working on a Character/ Control Picker lately. I faced several problems while building the framework. Actual interface part was rather simpler comparing to the framework which drives it. I thought it would be of some help or guidance to someone if I share my experience making the picker.
The first question that came to my mind when I started developing the picker was, which base framework should I use? The Maya ones or completely develop it from scratch in Qt. Initially I started developing using Maya’s framework. My plan originally was to,
- Use the Model Panel (Maya viewport) to act as viewport for the picker.
- Make custom locator plug-ins to serve as shapes for picker
- Integrate the Viewport into PySide based interface to handle other complex features.
Since viewport is ready to use in maya, I started with making custom locators. Oh boy, it wasn’t an easy task to incorporate all the required features into the MPxLocator node. Especially if you have to deal with the legacy maya viewport and the Viewport 2.0. Even more painful to support are DirectX draw calls. Hmm well, maya does provide convenient calls to all draw methods (OpenGL and DirectX). However, it’s not so easy for a beginner to fully grasp it. But, in this special case, that is for a picker we can forget about either of the viewports since there is no point in showing picker controls in different drawing engines. So, I chose OpenGL to draw my locator shapes.
Features I had for custom locator,
- Preset shape library (shapes which are often required)
- Mesh and nurbscurve input support
- Viewport zoom level transition – shapes can be set to shown/hidden on certain range of viewport zoom.
- Mouse click handlers to redirect and process as “Button” – Since locator is a node in maya, I had to re-implement mouse clicks to make it behave like a button and redirect the click to connected maya node (rig control)
It is to be noted that MPxLocatorNode can be slow if you are building in Python and if you are using complex shapes or have tons of instances in the scene. I had to opt for C++ to have better framerates
Why did I change my mind and depended on PySide?
In the beginning actually everything seemed to be working fine, but later on i realized that using custom maya plug-in is a real pain when you have to outsource the project to other studios. I could clean the file, but when maya crashes and animator uses the same file and continues working on it, complications may appear if the file is not properly cleaned up before publishing. So I found Qt to be more appropriate for my need.
Pros and Cons of PySide approach
Pros :
- Most importantly, you can do just anything with Qt
- Can really take control over the Viewport, how it appears and behaves
- Easier to draw shapes if compared to the 3D OpenGL draw methods used in maya locator nodes
- No maya dependencies (of course you have to use maya callbacks, but no custom nodes will be involved). Easier to outsource a project, and no need to worry about cleaning up junks in the file
- You can even have multiple even totally independent model view framework. Which means you can stack up multiple pickers in the window
Cons :
- Most animators expect the Viewport interaction to be similar to Maya’s viewport, and you will have to re implement all the Viewport interactions yourself (pan, zoom, hotkey combinations, etc).
- Communicating with maya will have intense use of Maya API callbacks, and we have to take care of the callbacks when the picker is deleted – This can be dreadful during development stage, but it will be fine once all the features are implemented properly.
- Creating shape is easy, but treating it as a node is difficult.
- Basically, you have to come up with your own Outliner, Attribute editor, Shape Library, Shape editor, Shape creator etc.
Just keep all these in mind if you flag off a picker development. Well you could simply use widgets to display picker shapes, haha… but I wouldn’t do that… No… because it’s not interesting.
Here is a demonstration of the Picker which I made recently
It is still under development and many features are not included in the above video. Suggestions are always welcome. 🙂
I hope this information is of some help to you guys out there. Thank you for your time and see you soon with further updates.
Leave a Reply