Picking Scene Nodes by Name

You can use the selectByName() function to open the standard 3ds Max Select By Name dialog allowing users to pick objects which are then returned as an array of MAXScript node values.

The form is:

selectByName [title:<string>] [buttonText:<string>] [ filter:<fn>] [showHidden:<boolean>] [single:<boolean>]

The optional keyword arguments are interpreted as follows:

title:"string" specifies the dialog window title.

buttonText:"string" lets you specify the label text in the 'accept' button in the dialog. The default value is "Select".

filter:<fn> lets you specify a filter function that determines which objects should be displayed in the list. This is similar to the filter functions elsewhere in MAXScript. The function you supply should take one argument, which the current object being tested for inclusion and the function should return true for include, false for exclude. If you don't specify a filter, all objects are displayed.

For example,

the following function limits the choices to shape objects:

fn shape_filt obj = isKindOf obj Shape

showHidden:<boolean> controls whether hidden and frozen objects are eligible for display. The default value is false. This option was broken in versions prior to 3ds Max 8. Now it works as expected.

single:<boolean> controls whether single or multiple objects may be selected in the selector. The default is false, meaning multiple objects may be selected, and they are returned in an array. If single:true is specified, a single object may be selected and is returned directly, not in an array.

If the user cancels out of the dialog, the function returns the value undefined.


See also

Picking Scene Nodes By Hit

Picking Scene Nodes By Region

Picking Points in the Viewports