[Closed] Collapsing the stack
Is there another way to collapse a stack including WSM’s with maxscript? I can’t use snapshot.
Cg.
I don’t believe so.
Why can’t you use the snapshot command?
newObj = snapshot oldObj
newObj.name = oldObj.name
delete oldObj
collapsing the modifier stack?
select an object:
maxOps.CollapseNodeTo $ 1 true
Is that what you need?
Adam:Over the years I’ve had many editable polys that have become corrupt for whatever reason. HERE is an example of a mesh that snapshot doesn’t seem to work very well on. The script I’m working on rebuilds editable polys with the option to rebuild smooth groups, material ID’s, any UV’s that are in use and vertex colours along with reseting transforms and copying materials. If the object has modifiers on it, I want the script to make a copy, collapse it and convert it to an editable poly if it’s not already. Then do the poly rebuild based on this object.
Moondoggie:I tried CollapseNodeTo the other day and it didn’t seem to want to collapse WSM’s. If I have a mesh that has a bend spacewarp applied the command works when I use it in the listener, but when it’s part of my script it seems to ignore the WSM.
Oh hang on a sec. I just figured out that it’s NOT the collapse line that’s doing that, it’s when I copy the object before collapsing it. It doesn’t take the WSM’s across to the copy before it’s collapsed. I’m looking into using clonenodes to do the copy.
Thanks for your suggestions guys,
Cg.
Oh this is driving me insane… I’m now trying to use maxops.clonenodes to make a copy cause the normal copy function did not copy WSM’s. Then I’m collapsing it with maxOps.CollapseNodeTo. But I just can’t get these functions to play nice.
if I run the following code on an object that has OSM’s and WSM’s it will clone the object correctly with an offset of 100 in x. But it will not collapse anything.
BUT if I run the last line of code afterwards in another script or in the listener, it works how I thought it should to start with.
maxops.clonenodes $ offset:[100,0,0] newNodes:&test
b = test[1]
select b
maxOps.CollapseNodeTo $ 1 true
If I use the CollapseNode function in the script instead of CollapseNodeTo it collapses everything besides the WSM’s.
Can anyone point me in the right direction? I’m running in circles at the moment.
I know I don’t need to do the “select” line in the code, but that was just to help me when I was trying to run the collapse line in the listener after the fact. The last line of the code works the same whether I run it on b directly, or select b and run it on $
Hey, I can’t try this myself right now but you might be able to use:
convertTo $ Editable_Poly
cheers,
CML
Hi Rivendale, thanks for the suggestion but sadly doing this still doesn’t take WSM’s into consideration. It collapses everything except WSM’s which it just leaves on the top of the stack as it was.
If I get this right you justwant to collapse everything to a poly right?
I’ve created a box, applied a bend modifier and collapsed it through these methods which all worked:
converttopoly $
convertto $ editable_poly
maxops.collapsenodeto $ 1 true – this collapsed it to a mesh
So I am not sure what is happening within your script…
Hi Anton, I have 2 issues that I’m trying to solve and they both have to do with world space modifiers/spacewarp bindings.
The first issue is that just doing a “copy” of an object, doesn’t make a duplicate with the WSM’s. So I’ve been trying to use maxops.clonenodes. But when I use this, the maxops.collapsenodeto doesn’t work when executed in the same script, but will do if I run the line seperately or just in the listener. Yes it’s weird.
The first 2 methods you list also do not collapse Worldspace Modifiers and Spacewarp Bindings.
The last one works, but not in a script after I’ve done a maxops.clonenodes to make the copy in the first place. (which is needed to copy the object with WSM’s intact) And if I run the maxops.clone nodes and then do the maxops.collapsenodeto either in the listener or a totally seperate script, it works. But not when it’s run in the same script.
Try runing this bit of code on an object that has modifiders and a spacewarp binding and you’ll understand the problem I’m having. Then when it doesn’t collapse, copy and run the last line in a listener seperately and you’ll see that it works that way. It’s really got me stumped.
maxops.clonenodes $ offset:[100,0,0] newNodes:&test
b = test[1]
select b
maxOps.CollapseNodeTo $ 1 true