Friday, October 28, 2011

The Script Editor

In an earlier post, we became acquainted with 2 Maya tools/features regarding MEL:

In this post, we’ll discover the tool that is most responsible for the actual creation of MEL scripts:
  • The Script Editor.

We’ll take things easy, for now, starting with
  • explaining the function of the Script Editor
  • how to access the Script Editor
  • identifying the panes within the Script Editor

The Script Editor: What does it do? 
The Command Line is a fast and easy way to execute commands, but where do we find the guts of a command ?  How do we even make a command out of thin air?

The answers lie in the Script Editor.

With the Script Editor, you can:
  • actually see the code and scripts that constitute a command
  • execute commands as an alternative to using the Command Line
  • reference previous actions and tasks as a foundation to create other commands
  • make custom commands out of thin air (with a little bit of brainpower, of course!)

Before we go on and write scripts, let’s find the Script Editor first!

Accessing the Script Editor 
At the far right of the Command Line, you'll notice a little icon (see Figure 1).

Clicking on this icon opens up the Script Editor (see Figure 3)

Figure 1: Script Editor Icon
 
If for some reason you don’t see the Script Editor on your screen, you can easily open it up in Maya's main menu (see Figure 2): 
  • Window > General Editors > Script Editor 
Figure 2: Open Script Editor in Maya''s Main Menu

The Script Editor: Overview
Now that your Script Editor is opened, let’s take a brief overview of what exactly we’re looking at.

The Script Editor has three major components (see Figure 3): 
  • Toobar
  • History Pane
  • Scripting Pane
Figure 3: The Script Editor

The Script Editor: The Toolbar
The Toolbar offers a quick and visual way to access common tasks and tools instead of having to access these tasks through the File, Edit, History, Command, or Help tabs. 

In a later post, we’ll cover at greater depth what these icons represent and do.  For now, it’s good to know that these are very helpful icons exist and are similar to the icons in Maya’s Shelf, which also simply are an alternative to accessing common tasks.

The Script Editor: The History Panel
According to the Maya Help site, there isn’t an official name for the top pane, although its function is to “show the history of commands and their results.(Autodesk Maya Online Help).  For the sake of identifying the top pane throughout this blog, and to avoid confusion, let’s simply call it the History Pane.

The History Panel serves two simple purposes:
  • show the history of commands
  • show the results of commands
You may notice some cryptic text written within the History Pane (see Figure 4).  This text consist is actually MEL commands that represent your actions – command history and command results - in your Maya scene. Practically every action you do to an object within your current Maya scene is recorded and documented within the History Pane. 

Figure 4: History Pane

The Script Editor: The Scripting Pane
According to the Maya Help site, there isn’t an official name for the bottom pane, although its function is to “type MEL or Python commands and scripts in either the MEL or Python tab.(Autodesk Maya Online Help).  For the sake of identifying the top pane throughout this blog, and to avoid confusion, let’s simply call it the Scripting Pane.

The Scripting Pane is blank, by default. We'll be writing text in this blank space to create MEL scripts in the future.

Next Post:
In a later post, we'll delve deeper into the functions and applications of the ScriptEditor.

Before we do any scripting - and to get rid of any bad habits, beforehand - I'll cover two common errors when scripting:
  •     Command Errors
  •     Syntax Errors 
 Bibliography:
 "Autodesk Maya Online Help." 2008. http://usa.autodesk.com/. 2010 24 October <http://download.autodesk.com/us/maya/2009help/index.html>.

1 comment:

  1. Very nice tips on scripting in Maya. I will probably start using this in my own work.

    ReplyDelete