ToggleParameterValue

導入

v1.5

詳細

選択オブジェクトのブール パラメータ値を切り替えます。

スクリプト構文

ToggleParameterValue( [InputObjects], Parameters );

パラメータ

パラメータ タイプ 説明
InputObjects 文字列 パラメータを切り替えるオブジェクトのリスト

デフォルト値: 現在選択されている値

Parameter 文字列 切り替えるブール パラメータの名前(カンマ区切りのリスト)。

注: ここで指定するパラメータが実際にブール値であるかどうかはユーザが確認します。

JScript の例

/*

	This example demonstrates how to use the ToggleParameterValue() command and

	how to convert string names of parameters to Parameter objects (since the

	GetValue command returns the value of a parameter, not a pointer to it)

*/

NewScene( null, false )

var item1 = CreatePrim( "Cube", "MeshSurface" );

var item2 = CreatePrim( "Cylinder", "MeshSurface" );

var target = "visibility.ghosting";

//INFO : Before toggling: 

//INFO : cube.visibility.ghosting = false

//INFO : cylinder.visibility.ghosting = false

LogMessage( "Before toggling: ");

ReadValues( item1 + "." + target );

ReadValues( item2 + "." + target );

ToggleParameterValue( item1 + "," + item2, target )

//INFO : After toggling: 

//INFO : cube.visibility.ghosting = true

//INFO : cylinder.visibility.ghosting = true

LogMessage( "After toggling: ");

ReadValues( item1 + "." + target );

ReadValues( item2 + "." + target );

function ReadValues( in_param ) 

{

	// First convert the string to a Parameter object

	var new_param = Dictionary.GetObject( in_param );

	// Then wrap the test in a try statement so it doesn't break 

	// the script if anything goes wrong

	try {

		if ( ClassName(new_param) == "Parameter" ) {

			LogMessage( new_param.FullName + " = " + new_param.Value );

		}

	} catch(e) {

		LogMessage( "Item to test is not a valid parameter." );

	}

}

//