Populating a listbox by objects types help

 

How can I populate a listbox with all items of a scene based on object types checkboxes, just like the "Select Objects" that shows when we press the "H" key?

 

Thanks

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
nikolay tashev's picture

Variant 1

rollout test "Populator" (
multilistbox lsx "Objects"
checkbox ch_sp "Spheres"
checkbox ch_cn "Cones"

on ch_sp changed thestate do
(

if TheState == true do
(
tmp_arr = #()
for o in objects do if classof o == Sphere do append tmp_arr o.name
lsx.items = tmp_arr
)
if theState == false do
(
tmp_arr = #()
for i = 1 to lsx.items.count do
(
n = getnodebyname lsx.items[i]
if classof n == sphere do append tmp_arr i
)
for t = tmp_arr.count to 1 by -1 do deleteItem lsx.items tmp_arr[t]
lsx.items = lsx.items
)
)
on ch_cn changed thestate do
(

if TheState == true do
(
tmp_arr = #()
for o in objects do if classof o == Cone do append tmp_arr o.name
lsx.items = join lsx.items tmp_arr
)
if theState == false do
(
tmp_arr = #()
for i = 1 to lsx.items.count do
(
n = getnodebyname lsx.items[i]
if classof n == Cone do append tmp_arr i
)
for t = tmp_arr.count to 1 by -1 do deleteItem lsx.items tmp_arr[t]
lsx.items = lsx.items
)
)
)
createdialog test

Well this is one way.. may be a li'l slow though...

..aut inveniam viam aut faciam..

..aut inveniam viam aut faciam..

alexmbr's picture

Thanks, but what I meant is

Thanks, but what I meant is to populate it by these:

Constructors

objects -- all the objects

geometry -- the standard 3ds Max categories...

lights

cameras

helpers

shapes

systems

spacewarps

selection -- the current selection

How can test to see if an item is a geometry or lights or a camera?

Thanks 

Martijn van Herk's picture

Alex,

Alex,

Check out the following functions in the online reference:

classOf
superClassOf
isKindOf

Select an object (a box in this example) and evaluate the following commands:

classOf $ -- returns Box
superClassOf $ -- returns GeometryClass
isKindOf $ Box -- returns true

Cheers,
Martijn 

alexmbr's picture

Thanks.

Thanks.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.