Operator.DisconnectGroup

Operator.DisconnectGroup

導入

v4.0

詳細

PortGroupインスタンスに接続されたオブジェクトを接続解除します。

C#構文

Operator.DisconnectGroup( Int32 in_group, Int32 in_instance, Boolean in_force );

スクリプト構文

Operator.DisconnectGroup( Group, Instance, [Force] );

パラメータ

パラメータ タイプ 説明
Group Long 接続解除するポートグループ
Instance Long オブジェクトが接続されているポートグループのインデックス
Force Boolean ポートがオプションでない場合でも、オブジェクトの接続を解除します。

デフォルト値: False

JScript の例

/*

	This example demonstrates how to disconnect an object from a group in a runtime custom operator.

*/

NewScene( null, false );

var null1 = GetPrim( "null" );

var null2 = GetPrim( "null" );

var sop = XSIFactory.CreateScriptedOp( "myexpr", myexpr_Update.toString(), "JScript" );

sop.Debug = 1;

var group1 = sop.AddPortGroup( "MainGroup" );

sop.AddIOPort( null1.Kinematics.Local,"", group1.Index );

// Add a second group with an optional port

var group2 = sop.AddPortGroup( "SecondGroup", 0, 1 );

sop.AddInputPort( null2.Kinematics.Local, "", group2.Index, -1, siOptionalInputPort );

// Connect operator

sop.Connect( null1 + ";" + null2 );

// null2 will rotate with null1

Rotate( null2, 90 );

// Disconnect null2 from second port group

sop.DisconnectGroup( group2.Index, 0 );

// null1 is no longer constrained

Rotate( null2, 180 );

// This operator constrains the rotation of the connected (target) object to the

// rotation of the object connected through the second portgroup.

function myexpr_Update( ctx, out, inlocal1, inlocal2 )

{

	Application.LogMessage( "myexpr_Update: " + out.Name );

	Application.LogMessage( ""+(inlocal2) );

	var transfo = inlocal1.Value.Transform;

	// Is an object connected to this group?

	if ( ctx.Operator.GetNumInstancesInGroup( 1 ) )

	{

		var inlocal2 = ctx.Operator.PortAt( 0, 1, 0 );

		// Is the port connected?

		if ( inlocal2.IsConnected )

		{

			var rot = XSIMath.CreateRotation();

			inlocal2.Value.Transform.GetRotation(rot);

			transfo.SetRotation( rot );

		}

	}

	out.Value.Transform = transfo;

}

// Expected results:

//INFO : 4000 - myexpr<238> Evaluate frame(sec)=0.033367, Outlocal(null.kine.local)

//INFO : myexpr_Update: Outlocal

//INFO : undefined

関連項目

Operator.ConnectToGroup