[Closed] Batch delete the first modifier
Hello,just a sample question here,
I have bunch of primitives in scene which I need to delete the first modifier away from them.Here’s the script I did, but it’s not working,
for each in objects do deleteModifier each 1
I can not use collapseStack to clear the modifier as I want to keep the primitive alive instead of becoming mesh or poly,something like dealing with collision mesh.
for each in objects do collapseStack each
It works but it’s not my option. Any solutions? Thanks!
If “each” has no modifier it will error out the script, instead wrap the process in a try catch or check if the modifier exists first.
for each in objects do try(deleteModifier each 1)catch()
I think because he “[wants] to keep the primitive alive instead of becoming mesh or poly”?
As for deleting the ‘first modifier’ – make sure whether you mean the first modifier (bottom of the stack, directly above your base object), or the top-most modifier.
$.modifiers[1] – is the last, top-most, modifier
$.modifiers[$.modifiers.count] – is the first, bottom-most, modifier
You’ll still want to check if $.modifiers.count > 0, of course; no need for a try/catch (unless you think things might throw an error if you delete a modifier).
CollapseStack isn’t my option because it will destroy the primitive. We don’t perfer collision mesh to be mesh or poly in-game.
Thanks ZeBoxx2,PEN,Blue,it works now.