Notifications
Clear all
[Closed] Delete modifier by name?
Page 3 / 3
Prev
Nov 29, 2012 5:56 pm
there is semi-pro way:
for node in objects as array where (mods = join #() node.modifiers).count > 0 do for m in mods where iskindof m MeshSmooth do deletemodifier node m
and there is a pro way:
for t in (getclassinstances MeshSmooth astrackviewpick:on) do for node in (refs.dependentnodes t.client) do deletemodifier node t.anim
PS. more PRO sometimes doesn’t mean BETTER (or faster)
Nov 29, 2012 5:56 pm
Interesting, did not know you could use getClassInstances that way, but I never tried it. Very cool, I like the semi-pro way better then the pro just because its easier to read.
quick question: My method it works, but what are the redundancies in it?
Nov 29, 2012 5:56 pm
there is nothing bad… but of course disable/enable view redraw has to be moved out the node loop… as:
with redraw off for node in nodes ...
it’s better to replace do append with collect
mods = for m in node.modifier where ... collect m
for m in mods do deletemodifier node m
and… there is a trick. you can delete modifiers in backward order:
for k=node.modifiers.count to 1 by -1 where iskindof (m = node.modifiers[k]) ... do deletemodifier node m
last (backward loop) solution saves some memory. which is not bad sometimes.
Nov 29, 2012 5:56 pm
Pro tip!
(getclassinstances MeshSmooth astrackviewpick:on)
Thanks for that Denis!
Page 3 / 3
Prev