Book Image

Practical Maya Programming with Python

By : Robert Galanakis
Book Image

Practical Maya Programming with Python

By: Robert Galanakis

Overview of this book

Table of Contents (17 chapters)
Practical Maya Programming with Python
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Working with Maya shelves


Like menus, Maya's shelves are an abstraction above plain Qt. Working with them at the Qt level allows you to do things like place arbitrary widgets into a shelf, as in the following image:

You can work with shelves using most of the same techniques we used for menus. However, there is one major problem. We can create custom menus directly using Qt because users do not customize their menu setup heavily. Users do customize their shelves, however, and expect these customizations to persist across sessions. Nearly every aspect of a shelf and its buttons can be customized. Shelves are persisted as MEL files, though, so any custom Python and Qt widgets or behavior we hook up dynamically is lost. This presents a dilemma.

One solution is to completely recreate shelves when Maya starts up. This may be acceptable in a controlled studio environment. However, if you want users to have control over your custom shelf buttons, you're limited to what Maya already provides and should...