2009
Table Of Contents
- Contents
- Overview
- Maya Basics
- Polygonal Modeling
- Introduction
- Preparing for the lesson
- Lesson 1: Modeling a polygonal mesh
- Introduction
- Setting modeling preferences
- Using 2D reference images
- Creating a polygon primitive
- Modeling in shaded mode
- Model symmetry
- Selecting components by painting
- Selecting edge loops
- Editing components in the orthographic views
- Editing components in the perspective view
- Drawing a polygon
- Extruding polygon components
- Bridging between edges
- Adding polygons to a mesh
- Splitting polygon faces
- Terminating edge loops
- Deleting construction history
- Mirror copying a mesh
- Working with a smoothed mesh
- Creasing and hardening edges on a mesh
- Beyond the lesson
- NURBS Modeling
- Subdivision Surfaces
- Animation
- Introduction
- Preparing for the lessons
- Lesson 1: Keyframes and the Graph Editor
- Lesson 2: Set Driven Key
- Lesson 3: Path animation
- Lesson 4: Nonlinear animation with Trax
- Introduction
- Open the first scene for the lesson
- Creating clips with Trax
- Changing the position of clips with Trax
- Editing the animation of clips
- Reusing clips within Trax
- Soloing and muting tracks
- Scaling clips within Trax
- Open the second scene for the lesson
- Creating clips from motion capture data
- Extending the length of motion capture data
- Redirecting the motion within a clip
- Beyond the lesson
- Lesson 5: Inverse kinematics
- Introduction
- Open the scene for the lesson
- Understanding hierarchies
- Viewing hierarchies using the Hypergraph
- Creating a skeleton hierarchy
- Parenting a model into a skeleton hierarchy
- Applying IK to a skeleton hierarchy
- Creating a control object for an IK system
- Constraining an IK system
- Limiting the range of motion of an IK system
- Simplifying the display of a hierarchy
- Applying parent constraints on an IK system
- Planning an animation for an IK system
- Animating an IK system
- Beyond the lesson
- Character Setup
- Polygon Texturing
- Rendering
- Introduction
- Preparing for the lessons
- Lesson 1: Rendering a scene
- Introduction
- Open the scene for the lesson
- Creating shading materials for objects
- Refining shading materials for objects
- Maya renderers
- Rendering a single frame using IPR
- Rendering using the Maya software renderer
- Batch rendering a sequence of animation frames
- Viewing a sequence of rendered frames
- Beyond the lesson
- Lesson 2: Shading surfaces
- Lesson 3: Lights, shadows, and cameras
- Lesson 4: Global Illumination
- Lesson 5: Caustics
- Dynamics
- Painting
- Introduction
- Preparing for the lessons
- Lesson 1: Painting in 2D using Paint Effects
- Lesson 2: Painting in 3D using Paint Effects
- Introduction
- Preparing for the lessons
- Brushes and strokes
- Rendering Paint Effects strokes
- Paint Effects on 3D objects
- Creating a surface to paint on
- Painting on objects
- Using turbulence with brush stroke tubes
- Using additional preset brushes
- Mesh brushes
- Converting mesh strokes to polygons
- Modifying a converted polygonal mesh
- Beyond the lesson
- Lesson 3: Painting textures on surfaces
- Expressions
- Scripting in Maya
- Index
Together, the if statement and the evaluation mean that only if the result
of the window existence query is “1” (the window exists) is the window
deleted. Otherwise, the section of code within the curly braces is skipped.
Storing control names
If you refer to a control in your user interface, it must have a name. Instead
of manually specifying the name for each user interface element, you can
allow the command to generate unique default names and then you can store
the name as a variable.
All user interface commands return their full name and path upon creation.
You can store the return value as a variable to refer to the control at a later
point in the script.
To store a control name as a variable
1 Type the following in a MEL tab of the Script Editor:
window -resizeToFitChildren 1 pick_me_window; columnLayout;
$button_one=`button -label "Click Me!" -command "deleteUI
$button_two"`; $button_two=`button -label "NO!, Click Me!!"
-command "deleteUI $button_one"`; $button_close=`button -label
"Close" -command "deleteUI pick_me_window"`; showWindow;
We’re using backticks for evaluation again here, though in this case, we’re
creating three variables ($button_one, $button_two, and $button_close)
that hold the results of calling the button command each time.
2 Press one of the “Click Me!” buttons in the window to test the script.
Clicking one of the “Click Me!” buttons deletes the other button by
calling the deleteUI command with the variable that stores the name of
the button control as an argument (button_one or button_two).
(If you click the button a second time, you’ll get an error as the button
you’re trying to delete has already been deleted.)
3 Close the window by pressing the Close button in the window.
When you created your user interface window, you assigned it a unique
name manually. This is a good practice to ensure that you cannot open
multiple copies of a user interface. With more complicated user interfaces,
Window naming | 629