Maya Maya MEL and Python Scripting 1 — Questions and Answers
Question 1: What is 'MEL' in Autodesk Maya?
- Maya Embedded Language — Maya's built-in scripting language (Correct answer)
- Material Expression Library for shader creation
- Multi-Edge Loop tool for polygon modeling
- Mesh Export Layer for render passes
Correct answer: Maya Embedded Language — Maya's built-in scripting language
MEL (Maya Embedded Language) is the scripting language built into Maya that underpins its user interface and allows artists to automate tasks.
Question 2: How do you access the Script Editor in Maya?
- Windows > General Editors > Script Editor (Correct answer)
- Edit > Preferences > Script Editor
- Create > Scripting > New Script Editor
- File > Open > Script Editor
Correct answer: Windows > General Editors > Script Editor
The Script Editor is accessed via Windows > General Editors > Script Editor and provides a place to write, execute, and review MEL and Python scripts.
Question 3: In MEL, what does the command `ls -sl` do?
- Returns a list of currently selected objects in the scene (Correct answer)
- Lists all surface normals in the scene
- Selects all lights in the scene
- Loads a saved selection set from file
Correct answer: Returns a list of currently selected objects in the scene
`ls -sl` (list -selection) returns a string array of the names of all currently selected nodes in Maya.
Question 4: What does `cmds.polySphere()` do in Maya Python scripting?
- Creates a polygon sphere in the scene and returns its node names (Correct answer)
- Applies a spherical UV projection to the selected mesh
- Converts a NURBS sphere into a polygon mesh
- Checks whether the selected object is a polygon sphere
Correct answer: Creates a polygon sphere in the scene and returns its node names
`cmds.polySphere()` calls Maya's Python API to create a new polygon sphere, returning the transform and shape node names.
Question 5: In Maya Python scripting, what module is primarily used to call Maya commands?
- maya.cmds (Correct answer)
- maya.api
- maya.mel
- maya.om
Correct answer: maya.cmds
`maya.cmds` is the primary Python module for calling Maya commands, mirroring the MEL command set in a Python interface.
Question 6: What is the purpose of the `xform` command in MEL/Python?
- Queries or sets transformation attributes like translate, rotate, and scale (Correct answer)
- Applies an external transform matrix from a file
- Extracts and exports transform data to a JSON file
- Creates a new transform node in the scene hierarchy
Correct answer: Queries or sets transformation attributes like translate, rotate, and scale
`xform` is a powerful MEL/Python command for querying and setting world-space or object-space transformations like position, rotation, and scale.
What is 'MEL' in Autodesk Maya?