AddScriptedOp (ProjectItem)
Introduced
4.0
Description
Creates a new scripted operator and connects its output to this object. If the scripting code is not specified then a default implementation is used. The scripting language is optional, if not specified then current scripting language user preference will used.
Scripting Syntax
ProjectItem.AddScriptedOp( [Code], Inputs, [Name], [Language], [ConstructionMode] )
C# Syntax
CustomOperator ProjectItem.AddScriptedOp( String bszCode, Object vInputs, String bszName, String bszLanguage, siConstructionMode in_constructionmode );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 |
|
|
ConstructionMode |
The location in the construction stack where the operator should be created. This only applies to output connections made to Geometry objects; this mode will be ignored for all other types of connections. Default Value: siConstructionModeDefault |
Return Value
Examples
JScript Example
/*
This example creates a simple expression-like runtime scripted operator
which constrains the rotation of one object to another
*/
NewScene( null, false );
var obj1 = GetPrim( "null" );
var obj2 = GetPrim( "null" );
var col = XSIFactory.CreateActiveXObject( "XSI.Collection" );
col.Add( obj1.Kinematics.Global );
col.Add( obj2.Kinematics.Global );
obj1.Kinematics.Global.AddScriptedOp( myexpr_Update.toString(), col, "myexpr", "JScript" );
function myexpr_Update( ctx, out, inglobal1, inglobal2 )
{
var transfo = inglobal1.Value.Transform;
var rot = XSIMath.CreateRotation();
inglobal2.Value.Transform.GetRotation(rot);
transfo.SetRotation( rot );
out.Value.Transform = transfo;
}See Also
|
|
Autodesk Softimage v7.5