A pickbutton item is used to place a scene object-picker button on the rollout. It operates like a normal pick button in the 3ds Max user interface, turning light-green when pressed and causing an object-pick mode to be entered. The user can then choose a scene object by clicking on it. The pick mode exits and the button returns to its unpressed state. The user can right-click to cancel the pick mode. The syntax is:
pickbutton <name> [ <caption> ] [message:<string>] [filter:<function>] [toolTip:<string>] [autoDisplay:<boolean>]
The default alignment of pickbutton items is #center.
rollout pick_box_test "Pick Box Test"
--filter all objects of class Box:
fn box_filt obj = classof obj == Box
--Pickbutton to select a Box from the scene
pickbutton chooseit "Select Box" width:140 filter:box_filt
--If the user picked an object, then
on chooseit picked obj do
--see if the user did not cancel the picking...
if obj != undefined do
--if he did not, make the box's wireframe red:
obj.wirecolor = red
--and display the name of the object on the button:
chooseit.text = obj.name
Note that the filter function will not let you select any other objects except Boxes.
The optional text to be displayed in the 3ds Max status line while in the pick mode. Default is no message.
The optional filter function that will be called to test the eligibility of the scene object under the cursor for picking. It must be a function of one argument, which will be the object under test, and return true if the object is eligible or false if not.
the following filter function allows only objects whose names begin with "foo" to be pickable:
fn foo_filt obj = findString obj.name "foo" == 1
Default is no filtering.
Provides text for a tooltip for the button. No tooltip if unsupplied.
When set to true, the name of the picked object will be automatically displayed as the text on the button. If false or not specified, the button caption will not be changed.
The last object picked using the pickbutton, undefined if no object has been picked. The property can be both get and set, accepting a node or undefined.
NEW in 3ds Max 9: Get/set the tooltip string of the checkbutton.
--If you pick a scene object, the tooltip of the pickbutton will show
--the name of the object you picked.
rollout test "Test"
pickbutton pck_test ">>Pick An Object" tooltip:"Pick A Scene Object..."
on pck_test picked obj do
if isValidNode obj do pck_test.tooltip = "You picked " + obj.name
on <pickbutton> picked <arg> do <expr>
Called when the user selects an object in the scene while in the pickbutton pick mode. The <arg> argument will contain the selected object. The handler is not called if the user cancels out of the pick mode.
on <pickbutton> rightclick do <expr>
Called when the right mouse button is released over the button. Available in 3ds Max 8 and higher.
Rollout User-Interface Items Common Properties
Rollout User-Interface Items Common Layout Parameters
Rollout User-Interface Control Types