collapse stack without collapsing the Meshsmooth, Turbosmooth, UVW or Unwrap UWV modifiers while preserving instances.
Forum topic · Scripts Wanted
Smarter Collapsing
By daniel · 2013-01-30
Forum topic · Scripts Wanted
By daniel · 2013-01-30
collapse stack without collapsing the Meshsmooth, Turbosmooth, UVW or Unwrap UWV modifiers while preserving instances.
Comments (4)
Comment policy
hey, Anubis! I like your idea with collapsing only upper modifiers, but your script has a lot of errors!
.
Fix the errors and post the result. :)
hi Daniel
Are all this modifiers on top of the stack? And there also not other kind of modifiers in-between, rihgt? If not, the final result would be unexpected, actually undesirable.
I'll presume that the modifiers you want to preserve are on top of the stack, and will post something (UNtested), and can't say is it better than Branko's idea :))
try this
fn smartCollaps = if selection.count != 0 do
(
max create mode
local modClasses = #("TurboSmooth","MeshSmoothMod","MapMod","Unwrap UVW")
local modArr = #(), ins = #()
while selection.count > 0 do
(
obj = if (InstanceMgr.GetInstances selection[1] &ins) > 0 then ins[1] else selection[1]
if (modCnt = obj.modifiers.count) > 0 do
(
for m = modCnt to 1 by -1 where findItem modClasses (getClassName obj.modifiers[m]) != 0 do
(
append modArr obj.modifiers[m] ; deleteModifier obj m
)
if (modCnt = obj.modifiers.count) > 0 do maxOps.CollapseNodeTo obj 1 off
if (maCnt = modArr.count) != 0 do for c = 1 to maCnt do addModifier obj modArr[c]
if ins.count != 0 then deselect ins else deselect obj
)
if ins.count != 0 then deselect ins else deselect obj
free modArr ; free ins
)
)