Creating and Editing Scripted Operators

 
 
 

The process of creating, editing, applying, and removing scripted operators is similar to that for expressions.

Creating Scripted Operators

You can create and edit scripted operators on geometry (like polygon meshes, surfaces, curves, lattices, particle clouds, and hair), properties (like Visibility or Local Transform), or parameters using the Set Scripted Operator command on the Animation menu of the Animation panel. For parameters, you can also use an explorer or property editor.

Once a scripted operator is created by any method, a Scripted Op node appears as a child of its output connections in the explorer.

For parameters, a new scripted operator has a single output connection and simply sets the parameter to its current value. Parameters that are driven by a scripted operator are represented by an S icon in the explorer and in property editors.

For geometry, both an input and an output connection are created. Operators on geometry must have both input and output connections or else the geometry will never be initialized when you reload the scene.

To create a scripted operator on marked parameters

  1. Mark the parameters you want to control with a scripted operator.

  2. Open the scripted operator editor by choosing Animation Set Scripted Operator from the Animation panel.

    The scripted operator editor opens with output connections already defined. To create any other connections you need, see Making Connections.

    NoteIf multiple elements are selected, the scripted operator is applied on the first element by default. However you can still add connections for the other elements manually.

To create a scripted operator from the explorer

  • In an explorer, right-click on the scene element that you want to control using a scripted operator and choose Set Scripted Operator.

    • To connect to a parameter, simply right-click on it.

    • To connect to a property, simply right-click on the property node.

      Note that you cannot connect to Kinematics because it is not a real property; however, you can connect to either Local Transform or Global Transform.

    • To connect to an object's geometry, right-click on the primitive node beneath the object itself. In explorers, this node is labeled Polygon Mesh, NURBS Surface Mesh, NURBS Curve List, Lattice, Particle Cloud, or Hair. The corresponding scripting names are polymsh, srfmesh, crvlist, lattice, cloud, or hair. You can also connect to a cluster by right-clicking on its node in the explorer.

    • To connect to the text string of a text object, right-click on the Text operator below the Text To Curve Converter in the operator stack of the text curve object (which is hidden by default if you created solid or planar polygon mesh text).

      A

      Primitive: Connect to geometry.

      B

      Text: Connect to text string.

To create a scripted operator on a parameter from a property editor

  • In a property editor, right-click on the animation icon of a parameter that you want to control using a scripted operator and choose Set Scripted Operator.

Applying Scripted Operators

After you have made any changes to a scripted operator (modified the connections, variables, or code), you must apply your changes before they take effect. This includes any changes to the extra code in the bottom pane.

ImportantIf you do not apply your changes, they will be lost when you close the scripted operator editor window.

To apply changes to a scripted operator

  • Click the Apply button at the top of the scripted operator editor window.

Editing Scripted Operators

After you have created a scripted operator, you can edit it again at any time. The procedure is the same no matter to what the scripted operator has been applied.

To edit a scripted operator

  • Do one of the following:

    • Right-click on the Scripted Op node in an explorer and choose Edit Scripted Operator.

      or

    • Select the Scripted Op node in an explorer, then choose Animation Set Scripted Operator from the Animation panel.

    The scripted operator editor opens, displaying the currently applied operator. Don't forget to click the Apply button when you have finished making your changes.

Removing Scripted Operators

You can remove a scripted operator simply by deleting it. In addition, for scripted operators on parameters, you can use the Remove Animation command from explorer views, property editors, and the Animation panel.

ImportantIf a scripted operator has multiple output connections, removing it from one connection removes it from all connections.

To delete a scripted operator

  1. Select the Scripted Op node that is a child of one of the output connections in an explorer.

  2. Press Delete.

To remove a scripted operator on a parameter in the explorer

  1. In an explorer, right-click on the parameter from which you want to remove the scripted operator.

  2. Choose Remove Animation from the menu.

To remove a scripted operator on a parameter in a property page

  1. In a property editor, right-click on the animation icon of the parameter from which you want to remove the scripted operator.

  2. Choose Remove Animation from the menu.

To remove a scripted operator on a parameter using the Animation panel

  1. Mark the parameter from which you want to remove the scripted operator.

  2. Choose Remove Animation from the Animation menu on the Animation panel.