PDA

View Full Version : 'Collapse To' All Geometry


NoisyMonk
02-07-2011, 04:04 PM
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!

denisT
02-07-2011, 04:37 PM
collapseStack geometry


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

NoisyMonk
02-07-2011, 05:14 PM
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.

denisT
02-07-2011, 06:02 PM
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.



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

CGTalk Moderation
02-07-2011, 06:02 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.