Error when used with more then one object

Hi,
I tried to make a script to "Freeze" some objects:
I have spline object with subdivide, tyconform,.. in the stack, so to remove the need max calculate these objects, I do :
- create a snapshot of the object
- deactivate all modifiers
- add editpoly modifier
- remove all geometry in the modifier
- attach snapshot to the geometry.
It works fine for one object.( and I did a script to revert to "normal" geometry )
But when I use this script on multiple selection I got error.
"-- Runtime error: Requested sub-object level out of range: 1"
Anybody could help ? Thanks

(
	for o in selection where o.modifiers.count > 0 do 
		(			
		theTMesh = snapshotAsMesh o
		theNewMesh = Editable_mesh()
		theNewMesh.mesh = theTMesh 
		convertTo theNewMesh Editable_Poly
		delete theTMesh 
 
		o.modifiers.enabled = off
 
		cep = edit_poly()
		addModifier o cep
		max modify mode -- !!!
 
		subobjectLevel = 1
		max select all
		o.modifiers[#Edit_Poly].ButtonOp #DeleteVertex
 
		o.modifiers[#Edit_Poly].attach theNewMesh
		subobjectLevel = 0
		cep.name = "FREEZED"
		)
)

Comments

Comment viewing options

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

.

(
selObjsArr = selection as array
for o in selObjsArr where o.modifiers.count > 0 do

titane357's picture

Hi, Miauu ! Unfortunately, it

Hi, Miauu !
Unfortunately, it make no difference...

jahman's picture

.

you have to select each object inside the loop individually and activate modify panel to make it work

titane357's picture

Hi jahman ! I read your post

Hi jahman !
I read your post carefully and several times.
But I still don't know what I can do...
Cheers

obaida's picture

AND

what you mean BY : "I have spline object with subdivide, tyconform,.. in the stack, so to remove the need max calculate these objects, I do :"

why not just (make a copy , delete all the modifiers and call the object "FREEZED" ?

Comment viewing options

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