What version of max are you using?
The only thing I can think of is that you shouldn’t need to copy the skin modifier.
Just storing a reference to the instance should work.
Skin wrap can be very inconsistent in transfering identical skin weights.
It might be an update issue, try calling redrawViews() before applying the skin modifier back onto the object.
-- make the modify panel active, as the skin modifier is fussy like that:
SetCommandPanelTaskMode #Modify
-- cache Selection as we will be selecting objects in the for loop,
-- otherwise you don't need to cache it as it is already itterable:
sel = Selection as array.
for obj in sel do
(
-- only need a reference to the skin modifier:
local skinMod = obj.Modifiers[Skin]
if skinMod != Undefined do
(
-- option 1: convert to an editable poly or mesh with editable_mesh:
ConvertTo obj editable_poly
-- option 2: collapse all modifiers below the skin modifier.
-- Not sure if that is what you want. Just need to get the index of
-- the skin modifier, but it is safe to assume it is at the top, so 1:
MaxOps.CollapseNodeTo obj 1 True
-- option 3: your current code:
MaxOps.CollapseNode obj False
-- enable for options 1 and 3:
-- Select obj
-- AddModifier obj skinMod
-- try forcing a viewport redraw:
-- RedrawViews()
)
)
If you are going with option 1 or 3, you might want to wrap the for loop in a with Redraw False context manager to speed things up:
with Redraw False
(
-- code here
)
You can also cache any struct based method calls outside of the for loop to further improved performance:
Got the same Issue. Munkybutts options worked partly for me. All of them are slighty messing up the weights(i think) of my model. However if i do it manually(copy skin, collapse, paste skin), then it works like intended.
As your model is very low poly, you can copy and paste the weights directly, this requires no change to topology or vert order though.
Here are two functions written in mxs for testing performance in my skinning plugin that will allow you to do that: https://github.com/munkybutt/SkinPlusPlus/blob/main/test/test.ms#L3