Function Testing Selection

For example I have a selection of objects and I want to use a function to test if every object in the selection is compatible. Only if EVERY object is compatible (tests true) does the script then continue to the next function. Where as if even one object tests false then it skips running the second function for all objects.

example: only if every object in the selections wirecolor is blue does it run the second function for all objects. otherwise it does not run the second function at all.

the second function could be anything such as moving all the objects to the origin move obj [0,0,0]

	for i = 1 to selection.count do
	(
		Obj = selection[i]
		ObjWire = obj.wirecolor
 
	)

Comments

Comment viewing options

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

try this function... fn

try this function...

fn isAllBlue objArray = (
	for obj in objArray do
		if obj.wirecolor != blue do return false
	true
)
goNext = isAllBlue selection
-- if goNext do ...

my recent MAXScripts RSS (archive here)

Comment viewing options

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