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

Integrating the tool GUI with Maya


It's finally time to hook together Maya and the hierarchy converter tool GUI. This will consist of a few steps. First, we need to get the GUI to simply appear and behave properly with the Maya window. Then, we must get Maya to emit the selectionChanged signal on the controller when Maya's selection changes. Finally, we hook up Maya to respond to the convertClicked signal on our GUI and perform the actual hierarchy conversion.

Opening the tool GUI from Maya

In this section, we will set up our GUI to open from a Maya shelf button. Let's start by creating a new Python file which will hold the Maya-specific code which will glue Maya to the controller. Go ahead and create a hierarchyconvertermaya.py file in your development root with the following text:

import hierarchyconvertergui as hierconvgui

_window = None
def show():
    global _window
    if _window is None:
        cont = hierconvgui.HierarchyConverterController()
        _window = hierconvgui.create_window...