Notifications
Clear all

[Closed] 'Collapse To' All Geometry

Hi all,

Looking for a quick script to Collapse all Geometry in the scene to their top Modifier – need to do this to speed the scene up a little.

I’ve looked around abit, but haven’t been able to find something that does what I need.

Here’s the chicken scratch code I’ve pieced together, but it doesn’t work;

for obj in geometry do
 	(
 		obj.maxOps.CollapseNodeTo 1 true
 	)
Error:  -- Unknown property: "maxOps" in ...

Thanks for your help!

3 Replies

collapseStack geometry

if you want to use maxOps it has to be:
maxOps.CollapseNodeTo <node>node <index>modIndex <boolean>noWarning

Sorry, should have mentioned that I have several instanced objects in the scene and I want them to remain as instances – so I can’t use Collapse Stack.

Figured it out though

for obj in geometry do
	(
		maxOps.CollapseNodeTo obj 1 off
	)

Thanks again for your help.
Monk.

1 Reply
(@denist)
Joined: 11 months ago

Posts: 0

 mapped fn collapseStackIfNeeds obj = if obj.modifiers.count > 0 do 
 (
 	local inst = #()
 	instanceMgr.getInstances obj &inst 
 	collapseStack obj
 	if inst.count > 1 do instanceReplace inst obj
 	inst
 )
 /*
 collapseStackIfNeeds geometry
 */
 

i don’t like to use maxOps.CollapseNodeTo. It has some problems with undo/redo