where....collect?

Is there a method for doing something along the lines of
for obj in selection where obj.name collect (collect only unique) obj

Comments

Comment viewing options

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

Maybe this can help fn

Maybe this can help

fn collect_UniqueNames =
(
local tempArr = #(), ghv = gethashvalue
for obj in objects where (finditem tempArr (g = gethashvalue obj.name 0)) == 0 collect (append tempArr g ; obj.name)
)
uniqueNamesArr = collect_UniqueNames()

bga

Anubis's picture

collecting by unique name?

if so, an possible way:

objNames = for obj in selection collect obj.name
objNames = makeUniqueArray objNames
uniObjs = for n in objNames collect (getNodeByName n)

my recent MAXScripts RSS (archive here)

Garp's picture

Yes, you just wrote it ;)

red_boxes = for obj in $box* where obj.wirecolor == red collect obj

Comment viewing options

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