PyQt Stylesheets, Maya, and Python Oh MY!

Written by mattanimation. Posted in Maya, pyQT, Python, Tutorials, UI

Ok, so you have some tools built and you have a basic understanding of Python and Maya but you want to start customizing things a bit more, maybe the ‘plastique’ style UI just isn’t as cool as it used to be and you want your tools to have a uniform or unique style to them. This is where stylesheets come into play.

No doubt if you have searched Google you have found the post in TAO that Yasin Uludag started where he released his “darkorange” stylesheet. This is a great resource to get started, but I think there are some details still missing on how to get it setup and working so I decided to make a simple tutorial on how to get a basic application started. This tutorial features the following:

  • How to create a simple PyQt application
  • How to create and compile a .qrc file for icons
  • Edit Yasin’s stylesheet to create your own style
  • Have the application set some options to send to mayapy and create a maya file
  • maybe create your own app to compile .qrc files to .py files easier
Part 1

Part 2

QRC Code:

<RCC>
  <qresource>
    <file>images/checkbox.png</file>
    <file alias="down_arrow.png">images/down_arrow.png</file>
    <file>images/handle.png</file>
  </qresource>
</RCC>

Shell Script:

pyrcc4 icons.qrc -o icons.py

Python:
References:

http://nathanhorne.com/?p=451
http://lateral.netmanagers.com.ar/stories/BBS49.html

Deformer Sets in Maya

Written by mattanimation. Posted in Maya, Rigging, Tutorials

I had a project recently that led to me discovering a useful but often overlooked (by me) menu known as deformer sets.

As an example let’s say you have a ball that is deformed by a lattice. Then you need to have another ball deformed by that same lattice, well that’s what the deformer set menu is for.

ds_01 ds_02

It can be found under Window>Relationship Editors>Deformer sets.

ds_03 ds_05

To get the now unaffected sphere to be affected by the lattice, simply select the ffd set for that lattice in the left column and then the object you want to be influenced by it in the right.

ds_06

Now the object is affected by the lattice. (The image looks weird because the sphere isn’t  sitting in the center of the lattice).

ds_07

Okay, now what if you only wanted a specific part of that object affected by the lattice? You can use the Edit Membership tool under the animation set in Edit Deformers> Edit Membership.

ds_08

Make sure you have the lattice (or whatever other deformer you are using) selected. Hold down shift then use the cursor to select the verts you want to add or use ctrl to deselect them. Now you can see that the specific area that was selected is being deformed. That’s all there is to it!

ds_09 ds_10