Edit an animation expression with a text editor

From the Expression Editor, you can start an external text editor to create and edit an expression. Text editors have features useful for editing big expressions.

When you start the text editor for an expression, you can edit only that expression with that instance of the text editor. However, you can start the text editor once for each of several expressions if you want to examine or edit several expressions at the same time.

Once you start a text editor for an expression, the Expression Editor’s text field dims to indicate you can’t work there while the text editor runs. You can, though, work in the expression text field for another expression.

There is no file on disk you can edit independently of the Expression Editor. When you use the text editor through the Expression Editor, you’re working with a temporary file that’s linked to the expression stored in the scene. You can, however, copy text from an independent text file into the temporary file.

If you save an expression without specifying a filename, Maya reads the saved expression and stores it with the scene. You’ll see it dimmed in the expression text field while you’re working with the text editor.

When you close the text editor, the expression text field entry no longer is dim. The text expression field becomes active after you close the text editor.

If you quit the text editor without saving the expression, Maya does nothing. Because the expression hasn’t changed, Maya’s copy of the expression doesn’t need to change either.

Tip: You can use a text editor to save an expression to a filename in the directory of your choice. This gives you a way to archive an expression you want to use in a different scene.

Select a text editor (Mac OS X)

Edit expressions by opening an editor such as TextEdit. Cut and paste your text into the Expressions Editor.

Select a text editor (Windows)

You can edit expressions with the text editor you’ve associated with text documents. For example, if you’ve associated Notepad with .TXT text documents, Maya launches Notepad when you select Text Editor from the Editor menu in the Expressions Editor. To use a different editor, associate the editor of your choice with .TXT files. See Windows documentation for details.

Select a text editor (Linux)

By default, in Maya Linux you can start one of these editors from the Editor menu in the Expressions Editor:

To run a different editor, see the section below, "Use an editor not listed in the Editor menu (Linux)".

Start an editor listed in the menu

  1. From the Editor pull-down menu in the Expression Editor, select an editor.
  2. Double-click an object name, expression name, or attribute name from the Selection list.

    The editor is displayed.

    The editor’s title bar shows a filename that’s temporarily created while you work on the expression. When you write or save the file, its contents are copied to the Maya scene containing the expression.

    The expression text field is inactive while the text editor is open. You can optionally close the Expression Editor window.

    If you single-click the name of an object, attribute, or expression, the text editor doesn’t appear. You can single-click to browse the contents in the expression text field without opening a text editor.

    If you double-click an attribute that’s already been assigned a value in an expression, the expression that controls that attribute appears in the text editor. For non-particle expressions, you can assign to any attribute in the scene, not just to the double-clicked attribute. In fact, you don’t even need to work with the double-clicked attribute at all.

    If you double-click an attribute that has not yet been assigned a value, the text editor appears with no contents. If you double-click that attribute again, a new instance of the editor appears. After you assign a value to an attribute in an expression, you can start the editor only once for the attribute.

  3. Create or edit the expression with the editor.
  4. Save the file.
  5. Confirm that the Expression Editor detected no syntax errors.
  6. Quit the editor.
    Note: If you’ve created a Linux command alias for jot, vi, vim, or xemacs, the Expression Editor tries to launch this command. If the arguments provided in the command alias are unusable by the Expression Editor, the editor might operate unexpectedly or fail to launch.

    Avoid using an alias to customize your editor’s operation settings. Follow the steps below in "Change an editor’s operation settings (Linux)".

Use an editor not listed in the Editor menu (Linux)

If your workstation has a text editor that’s not listed in the Editor menu, you can use it after doing a few preliminary UNIX system administration tasks.

Start an unlisted editor

  1. In your Linux .cshrc file, set the WINEDITOR environment variable to specify the desired editor and options.

    See "Change an editor’s operation settings (Linux)" below for examples.

    You can select any valid options for the editor, but you must specify that the editor runs in the foreground (if this option is relevant to the editor).

    If the editor normally appears in the shell where you launched it, you must make the WINEDITOR setting display the editor in a shell.

  2. Log out and log into your user account.
  3. Restart Maya.
  4. Select Other from the Editor pull-down menu.
  5. Double-click an object name, expression name, or attribute name from the Selection list.

    The editor appears.

  6. Create or edit the expression with the editor.
  7. Save the file.
  8. Confirm that the Expression Editor detected no syntax errors.
  9. Quit the editor.

Change an editor’s operation settings (Linux)

Maya launches the editors listed in the Editor menu with default operation settings. You can change the operation settings with a few preliminary system administration tasks.

Change an editor’s operation settings

  1. Set the WINEDITOR environment variable to specify the desired editor options.

    You can select any valid options for the editor, but you must specify that the editor runs in the foreground (if this option is relevant to the editor). For example, jot requires the option -f, vim requires -g -f, and xemacs requires the option -nw.

    An example of setting WINEDITOR for vi follows:

    setenv WINEDITOR "xwsh -name mayaEditor -e vi"
    

    An example for vim follows:

    setenv WINEDITOR "xwsh -geometry 80x57+350+130 -bg 97 -e vim"
    
  2. Log out and log into your user account.
  3. Restart Maya.
  4. Select Other from the Editor pull-down menu.
  5. Double-click an object name, expression name, or attribute name from the Selection list.

    The editor appears.

  6. Create or edit the expression with the editor.
  7. Save the file.
  8. Confirm that the Expression Editor detected no syntax errors.
  9. Quit the editor.

Select an editor for default startup (Linux)

You can make an external text editor start by default each time you start a text editor.

Start an editor by default

  1. Select Windows > Settings/Preferences > Preferences.

    The Preferences window appears.

  2. In the Categories list, click Interface to display general interface preferences.
  3. Select the editor in the Expression Editor menu.

    To select an editor specified with the WINEDITOR environment variable, select Other.

  4. Click Save.
  5. In the Expression Editor, double-click an object name, expression name, or attribute name from the Selection list.

    The editor appears. The next time you start the Expression Editor, the editor’s name appears in the Editor pull-down menu by default.

    If you’ve chosen different text editors in the Preferences window and the Editor menu, the one chosen in Preferences appears.

    Note: If you’ve specified a text editor through Preferences or with the Expression Editor’s Editor menu, starting the Expression Editor from the Channel Box or Attribute Editor displays the text editor instead of the Expression Editor.

    The text editor appears when you click the New Expression button.