Charcoal Editor 2 Basics
Launching Charcoal Editor 2
After loading the Charcoal Editor 2 plug-in through Maya's plug-in manager (see Installing Charcoal Editor 2). The CE2 Window can be displayed in three different ways:
- - Selecting Windows->General Editors->Charcoal Editor 2 in Maya's main menu
- - Clicking the Script Editor button (part of the Command Line UI Element)
- - Using the MEL command: charcoalEditor2
Buffers are used to display the text of a file in the Code Editor. Each buffer has an interpreter associated with it (MEL or Python) that is called when the code is executed. The interpreter is set when a new buffer is created or an existing file is opened (based on its file extension).
Two types of buffers exist, temporary and file. A temporary buffer is one that is managed by Charcoal Editor 2. It is persistent between Maya sessions, however, when the buffer is closed, the temporary file is deleted. A file buffer reads and writes to an existing file that is managed by the user.
Creating a New Buffer
A new buffer can be created in several different ways:
- From the main menu select File->New...
- Use the keyboard shortcut Ctrl+N
- Double-clicking on an empty area of the tab bar.
A dialog will be displayed asking which language to set the buffer to (MEL, Python or None). If None is selected, the buffer will be treated as a text file.
Opening an Existing File
To open an existing file, use one of the following methods:
- From the main menu select File->Open...
- Use the keyboard shortcut Ctrl+O
Saving a Buffer
Buffers can be saved using two different save options, Save and Save As. Save overwrites the existing file while Save As saves the file to a new location. Temporary buffers will automatically use Save As.
- From the main menu select File->Save
- Use the keyboard shortcut Ctrl+S
Save on Execute
By default, Charcoal Editor will automatically save the file or buffer prior to excuting the code. This option can be disabled in the preferences.
The Code Editor allows for multiple grouping to exist in a horizontally or vertically split view. Tabs can be moved between views and arranged inside each view by dragging a tab to a different group, or to the edge of the current group (to create a new group).
Charcoal Editor 2 allow for scripts to be executed as a whole, by the selected text, or from current line. Scripts can be executed through the main menu, toolbar or hotkeys. Script execution occurs on the active Code Editor buffer and the interpreter is controlled by the buffer type (MEL or Python).
Note: Code is never deleted from the Code Editor when a script is executed (unlike Maya's native script editor).
When text is selected in the Code Editor, the Execute command will only run the selected code. If no selection exists, the entire script will be executed.
The Execute All command will execute the entire script contained in the active buffer, regardless of selection.
The Execute Lince command will only run the code contained on the current line. This eliminates the need to highlight a line prior to execution. Additionally, any leading whitespaces will be stripped prior to execution allowing for indent dependent languages (Python) to run without errors.