AddScriptedOp (Parameter)
Introduced
4.0
Description
Creates a new runtime scripted operator and connects its output to this object. If the scripting code is not specified then a default implementation will be used. For parameter connections a simple assignment of the current value will be created; for example, 'out.Value = 0.00'.
Specifying the scripting language is optional. If not specified then the current scripting language user preference will be used.
Tip: This is the Object Model version of the AddScriptedOp command, which also creates a runtime scripted operator. To create a Self-Installed Custom Operator, use the AddCustomOp command or Parameter.AddCustomOp method.
Scripting Syntax
Parameter.AddScriptedOp( [Code], Inputs, [Name], [Language] )
C# Syntax
CustomOperator Parameter.AddScriptedOp( String bszCode, Object vInputs, String bszName, String bszLanguage );Parameters
|
Parameter |
Type |
Description |
|
Code |
The script code containing the implementation of the scripted operator. |
|
|
Inputs |
List of objects or parameters to be connected to input ports. |
|
|
Name |
The name of the new operator Default Value: ScriptedOp |
|
|
Language |
The script language of the new scripted operator Default Value: Preference value from application.preferences.scripting.language |
Examples
JScript Example
/*
This example demonstrates how to create a simple expression-like scripted operator
to constrain the posx of an object to its posy value
*/
NewScene( null, false );
var obj = Application.ActiveSceneRoot.AddNull();
obj.posx.AddScriptedOp( myexpr_Update.toString(), obj.posy, "myexpr", "JScript" );
function myexpr_Update( ctx, out, inposy )
{
out.Value = inposy;
}See Also
|
|
Autodesk Softimage v7.5