Using Private User Data in Scripted Operators

 
 
 

Scripted operator presets provide a mechanism for storing your own private data in the UserData property of the UpdateContext class.

Inside a scripted operator, you can access this property using In_UpdateContext.UserData. This data is cached separately for each instance of a preset operator, so the Update method can modify UserData based on the input connections and variable values without affecting any other instance of the same operator. The UserData property is a variant and can be used to store any data type, including arrays and collections.

In conjunction with the UserData property, there are two methods:

For example, you can use the Init method to instantiate an ActiveX object like a spreadsheet and store it in In_UpdateContext.UserData. The Update method can then use and modify this data. You can then use the Term method to save the modified spreadsheet. This lets you create your own simulations and store the results.

Creating Init and Term Procedures

You can write the Init and Term functions directly in the bottom pane of the scripted operator editor. These functions should have a single argument which Softimage uses to pass a pointer to an UpdateContext object.

Refer to the UpdateContext [SDK Guide] for information about the properties and methods supported by UpdateContext.

Here is an example of stub Init and Term procedures in VBScript:

Sub Init (InUC)
  LogMessage "Initializing scripted operator..."
End Sub
Sub Term (InUC)
  LogMessage "Terminating scripted operator..."
End Sub