For Loop Collect Array

Hey guys I am having issues with trying to collect this array for a listbox.

for o in 1 to 3 where (selection[1].INodeBakeProperties.getbakeelement != undefined) collect (selection[1].INodeBakeProperties.getbakeelement o).elementname)

it errors if there is no bake element on the next loops... So I added a try()catch() and it gets rid of the errors but I get a bunch of undefineds in my array.

#("NormalsMap",undefined, undefined)

Also the try()catch doesn't seem to be working in my listbox.

for o in 1 to 3 where (selection[1].INodeBakeProperties.getbakeelement != undefined) collect try((selection[1].INodeBakeProperties.getbakeelement o).elementname) catch()

Idealy I just want to end up with a list for my listbox that looks like
#("NormalsMap")
or
#("NormalsMap", "Normalsmap")

Any help would be greatly appreciated.

Comments

Comment viewing options

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

.numBakeElements()

nvm! Sorry guys... I hate when I figure something out right after posting...

.numBakeElements()

barigazy's picture

Bravo !!! ;)

Bravo !!! ;)

barigazy

Comment viewing options

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