Quick Start Guide
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. 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. Closing the buffer does not delete the file. When a temporary buffer is saved, it is written out to a new location and becomes a file buffer.
Multiple buffers can be open at the same time with each buffer being placed in its own tab in the Code Editor. To switch between buffers click on the buffer's tab in the tab bar or select the buffer from the Buffer View or Documents View.
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 (or Ctrl+T similar to Maya's script editor)
- 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.
Renaming a Buffer
By default, temporary buffers are named based on the interpreter type. When working with multiple buffers it can quickly become confusing having all buffers named the same. Several methods exist to change the name of a buffer:
- From the main menu select File->Rename...
- Right-click on the buffer's tab and select Rename... from the context menu
- Right-click on the buffer in the Buffers View and select Rename... from the context menu
The Code Editor allows for buffers to exist in a side-by-side view. Tabs can be moved between views and arranged inside each view. To create a split-screen view and/or move tabs between views use one of the following methods:
- Right-click on the buffer's tab and select Move to Other View from the context menu
- Left-click and drag the buffer's tab to the other view.
Charcoal Editor 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.