PickObject

導入

v1.0

詳細

オブジェクトの選択をユーザに要求します。

Tip:"PickElement [object_name]"を使用して出力パラメータを設定できます。

注: このコマンドは、出力引数を使用します。C# および一部のスクリプト言語(JScript、PerlScript、Python など)は、リファレンスによって渡される引数をサポートしていません。このため、状況に応じた適切な回避策を実行する必要があります。

スクリプト言語の場合、このコマンドは出力引数を取得するために使用できる ISIVTCollection を戻します。

C# の場合は、XSIApplication.ExecuteCommand メソッドを使用してこのコマンドを呼び出すことができます。ExecuteCommand は、出力引数を C# の System.Object (出力引数の Array を含む)にパック化します(詳細については、「C# からのコマンドの呼び出し」を参照)。

スクリプト構文

PickObject( LeftMessage, MiddleMessage, [PickedElement], [ButtonPressed], [ModifierPressed] );

パラメータ

パラメータ タイプ 説明
LeftMessage 文字列 マウスの左ボタンのステータス バー メッセージ
MiddleMessage 文字列 マウスの中央ボタンのステータス バー メッセージ
PickedElement CollectionItem 選択されたオブジェクトを戻します。
ButtonPressed Long ユーザがクリックしたマウス ボタンを戻します。

指定可能な値:

説明:

0 マウスの右ボタン(または[Esc]キー)。ユーザが選択セッションを中止したことを意味します。
1 マウスの左ボタン
2 マウスの中央ボタン
ModifierPressed Long ユーザが押した修飾キーを戻します。

指定可能な値:

説明:

0 なし
1 [Shift]修飾キー
2 [Ctrl]修飾キー
3 [Shift]+[Ctrl] 修飾キー

VBScript の例

' The following example will use "PickObject" to pick two objects 

' consecutively and will make the first object parent of the second one.

dim parent, child, button, modifier

NewScene

CreatePrim "Cone", "MeshSurface"

CreatePrim "Cylinder", "MeshSurface"

Translate , -0.118156772275078, -5.87851913444323, 0.587851913444323, _

		siRelative, siView, siObj, siXYZ

DeselectAll

PickObject "Select parent", "Select parent", parent, button

if button <> 0 then

	PickObject "Select child", "Select child", child, button, modifier

	if button <> 0 then

		if modifier = 0 then

			ParentObj parent, child

			logMessage "object " & parent & " is now parent of object " & child

		else

			ParentObj child, parent

			logMessage "object " & child & " is now parent of object " & parent

		end if

	end if

end if