Function no work

Hi, I build a function that reset all object in scene. This script write with "for o in objects do..." but reset some objects, not all objects. Why? 

 

clearlistener()

function resetMesh =

(

for o in objects do 

(

if (superclassof o) == geometryClass do

(

convertToPoly o

nm = (o.name as string)

n = convertToPoly (box name:nm wirecolor:black)

polyop.setFaceSelection n #all

n.EditablePoly.delete #Face

n.attach o n

setTransformLockFlags n #all

)

)

)

resetMesh ()

Comments

Comment viewing options

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

Thanks U

Perfect! thank you :D

jmpinero's picture

if I create six teapot, only

if I create six teapot, only reset four.
Why?

No reset all object of geometry class.

I try this function in 3ds max 2013 and 2015, and both cases the same result

miauu's picture

.

The problem is, because you are using

for o in objects do

Use this:

(
	clearlistener()
	function resetMesh =
	(
		local poSetFaceSelection = polyop.setFaceSelection
		local objsArr = objects as array
		for o in objsArr where (superclassof o) == geometryClass do with undo off
		(
			convertToPoly o
			nm = (o.name as string)
			n = convertToPoly (box name:nm wirecolor:black)
			poSetFaceSelection n #all
			n.EditablePoly.delete #Face
			n.attach o n
			setTransformLockFlags n #all
		)
	)
	resetMesh ()
)
miauu's picture

.

The objects that are not resets are?
Your functions works only with geometry objects, so the splines, helpers, lights will no the processed by the function.

Comment viewing options

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