Sorry for the ambiguity, I mean the stack; let's say that I have a hundred objects in my scene, and some have an UVW modifier before TurboSmooth and some have it after, or some have a point cache Modifier before an edit poly that has some points animated and after a Turbosmooth; is there a way to change the order so the point cache is on top of the edit poly and the TurboSmooth on top of all?, and is there a way to state this order (or pattern) for every object regardless of how many modifiers they have in the stack, (maybe by class?). |
It is possible, but not as directly as you would like.
MAXScript can see the modifier stack as a list of modifiers, and you can get existing modifiers, delete modifiers by name or index, and add modifiers to the stack at any position (using a BEFORE: keyword where you can specify the location relative to an existing indexed modifier). In MAXScript, all modifiers on a stack are indexed from top to bottom, so the top modifier is always index 1 and the bottom has index equal to yourObject.modifiers.count.
So writing a script that figures out whether a TurboSmooth is on the right place and performing a scripted cut&paste to a new position IS possible. There can be complications when modifiers require sub-object selections to be passed to them, and pasting some gizmo-based deformers might work differently than in the UI, but in general the answer is yes.
The exact logic of the code would depend on the specific order you want, so writing a universal script that can do ALL possible reordering operations is tricky, but if you want the TurboSmooth to be on top or PointCache above Edit Poly, these can be expressed in dedicated functions.
If you need an example, let me know.