[Closed] Skinwrap issue
Hey, I’m in the process of scripting a quick tool that creates mirrored morph targets using a skinwrap method.
Just so you get a better idea what’s going on, I make two copies of the mesh that has morpher with ready targets. One copy gets mirrored, so dialing up one of its targets will happen on the opposite side. The other copy gets skin wrapped to the mirrored one, so it doesn’t mess up the vert order. Collaspe that and ka chow.
I have this script doing just that right now, and working perfectly fine. The problem is when I try to put this script in a function, the one copy doesn’t skin wrap, and just keeps its original form. I’m not getting any errors, and nothing seems to be out of scope, just seems like skin wrap is not updating when it should.
I’ve been at this for hours, and I can’t get my head wrapped around it. PUN intended, Any ideas?
Without looking at the code, from your description it sounds like the modifier stack does not update when necessary.
When running code from the listener, the Modifier Stack and the viewports are refreshed a lot more often. When you put the code into a function, most of these updates are not performed unless you explicitly requested them. So it is possible that the modifier stack does not refresh some modiers (possibly the SkinWrap right after it has been added).
The solution is as simple as adding a (classof yourObject) at the place in the code where you expect the modifier stack to refresh, for example right after the modifier was added. In order to return the class, MAXScript has to force Max to update the modifier stack if it is not marked as up-to-date, so this gives you a nice cheap method to enforce such a refresh.
If this still does not help, please let me know.
That was exactly it, the classOf solution worked like a charm. It may be a cheap trick, but it sure gets the job done. Are there any other methods to refresh the stack? Thanks for the help and explanation, Bobo.
Potentially, reselecting the object should do it, but my time measurements show that classof() is the fastest way known to mankind. Or at least to me