3dmax skin copy paste

max
#1

it’s simple task, but none of the actual skinning information is carried over.

Array loop(

1: Get object
2: copy skin
3: collapse stacks
4.paste skin
)

On Looping pressed do (

	varArrayMainsel = selection as array
	
for obj in varArrayMainsel do (
	lModifier = copy obj.modifiers[#Skin] --copy
	objname=obj.name
	format "% select  and copy \n" objname 
	
	maxOps.CollapseNode obj off --Collapse stacks
		format "% modifiers callapsed  \n" objname 
	
	
	addModifier obj lModifier --paste
			format "% skin pasted  \n" objname 
	)
	
)

How can I change it?
Right click of more than 500 objects is painful :cold_sweat:

#2

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.

#4

Maybe you can use “skin wrap” and and a second mesh.

#5

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.

#6

using 2016
Is there any other way?

#7

You could try a variety of the following:

-- 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:

ColNodeTo = MaxOps.CollapseNodeTo
ColNode = MaxOps.CollapseNode