CustomOperator.Validate operator

導入

v4.0

詳細

オペレータに有効なポート定義が含まれており、コードが構文的に正しければ、True を戻します。

スクリプト 構文

oBoolean = CustomOperator.Validate();

戻り値

Boolean

JScript の例

/*
         This example illustrates how to use the AddPortGroup method to define 
         an PortGroup. Use this method if you want to determine the number
         of objects that can be connected to the group or restrict the 
         types of objects connecting to the group by using a filter.
*/
NewScene( null, false );
var obj = CreatePrim( "Cube", "MeshSurface");
var sop = XSIFactory.CreateScriptedOp( "MyOperator", MyOperator_Update.toString(), "JScript" )
var group = sop.AddPortGroup( "MainGroup", 1, 1, siPolyMeshFilter, "please pick a polygon mesh" );
sop.AddPortGroup( "MainGroup" );
sop.AddIOPort( obj.ActivePrimitive );   // this is an error - a second group will be created
                                                // but the first group doesn't have any ports.
Application.LogMessage( "valid operator definition = " + sop.Validate() );
// The operator's update function
function MyOperator_Update( ctx, out, in1 ) 
{
        Application.LogMessage( "MyOperator_Update: " + out.Value );
        var aPos = in1.Value.Geometry.Points.PositionArray.toArray();
        out.Value.Geometry.Points.PositionArray = aPos;
}