Book Image

Maya Programming with Python Cookbook

By : Adrian Herbez
Book Image

Maya Programming with Python Cookbook

By: Adrian Herbez

Overview of this book

Maya is a 3D graphics and animation software, used to develop interactive 3D applications and games with stupendous visual effects. The Maya Programming with Python Cookbook is all about creating fast, powerful automation systems with minimum coding using Maya Python. With the help of insightful and essential recipes, this book will help you improve your modelling skills. Expand your development options and overcome scripting problems encountered whilst developing code in Maya. Right from the beginning, get solutions to complex development concerns faced when implementing as parts of build.
Table of Contents (17 chapters)
Maya Programming with Python Cookbook
Credits
About the Author
About the Reviewer
www.PacktPub.com
Preface
Index

Using nested layouts


Very often, the interfaces that you'll want to create cannot be implemented with a single layout. In those cases, you'll need to nest layouts inside each other.

In this example, we'll create rowLayouts within a single columnLayout. Each rowLayout will allow us to have two controls (in this case, some text and intField) next to each other horizontally, and the parent columnLayout will stack the combined text/field pairs on top of each other vertically.

The end result will be something like this:

How to do it...

Make a new script and name it nestedLayouts.py. Add the following code:

import maya.cmds as cmds

class NestedLayouts:

    def __init__(self):
        self.win = cmds.window(title="Nested Layouts", widthHeight=(300,200))
        cmds.columnLayout()
        
        cmds.rowLayout(numberOfColumns=2)
        cmds.text(label="Input One:")
        self.inputOne = cmds.intField()
        cmds.setParent("..")
        
        cmds.rowLayout(numberOfColumns=2)
        cmds...