v1.0
Prompts the user to pick an object.
Tip: You can use "PickElement [object_name]" to set output
parameters.
Note: This command uses output
arguments. C# and some scripting languages (such as JScript,
PerlScript and Python) don't support arguments passed by reference
so you need to use the best workaround for your situation:
For scripting languages this command returns an ISIVTCollection which you can
use to get the output arguments.
For C# you can use the XSIApplication.ExecuteCommand
method to call this command. ExecuteCommand packs the output
arguments into a C# System.Object containing an Array of the output arguments (see
Calling
Commands from C#).
PickObject( LeftMessage, MiddleMessage, [PickedElement], [ButtonPressed], [ModifierPressed] ); |
| Parameter | Type | Description | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| LeftMessage | String | Status bar message for the left mouse button. | ||||||||||
| MiddleMessage | String | Status bar message for the middle mouse button. | ||||||||||
| PickedElement | CollectionItem | Returns the picked object. | ||||||||||
| ButtonPressed | Long | Returns the mouse button clicked by the user.
|
||||||||||
| ModifierPressed | Long | Returns the modifier key pressed by the user.
|
' 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
|