Friday 27 November 2015

Technical Art - VII

Since I finished working on the model rig I decided to focus more on the scripting side of the module before going back to skinning, as I mentioned few posts ago I am planning to develop an auto model picker tool.

The basic features that I want this tool to have are:
  • Automatic rendering of whatever the user is looking at the moment, so that the user can decide to create pickers for specific parts of the model
  • Possibility to have multiple picker views and being able to swap between them
  • The picker should automatically detect and create a button for each joint and control shape in the scene (discarding those which are not visible in the current view)
  • The user should be able to filter out joints based on name patterns or type

With this in mind, I want to design the tool's code so that it could be expanded in the future to add additional features such as loading/saving picker views and further customization like automatic UI controls to tweak set driven keys and special attributes.

Once I planned the features I started working on the actual UI implementation and this was the final result:


Getting a screenshot from the user view proved to be rather easy: I just needed to use the playblast command and save to a file the results and then subsequently use that image inside the form, transforming each joint from world space to screen space was not as simple but after researching ways to find the view and projection matrices for the current camera I managed to find the screen space position of any object in the scene quite easily.
Once those two matrices are available the screen space position can be easily computed by transforming the world position of an object through the view and projection matrix.

Since one of the long term goals was to have a save and load feature I needed a way to store those two pieces of data within my script, so I made a PickerData class that contains all the information required to transform any object in screen space for that specific user configuration.

The PickerData also contains all the information about spawned buttons and their corresponding object: this is used within the filter function to allow the user to filter out specific joints or control shapes in the scene should that be necessary.


Here's an example of the final script working with my rig:

No comments:

Post a Comment