PDA

View Full Version : [MaxScript] Single Skin Copy and Paste


Luten
04-04-2012, 12:30 PM
Hi

I found some script (Maxscript) for 3ds Max. "Single Skin Copy and Paste"

The script copy and paste vertex weight between models. It works good but with only one select vertex. I would like to it to work with more vertex than only one. I mean if I'll secect 5, 12, 20 or more vertex.

I'm not scripter so maybe can someone change it for me http://boards.polycount.net/images/smilies/pcount/icons/poly120.gif and sorry for my English

Here it's a code.

global BoneArray global BoneNArray global WeightArray global PasteArray -- Pass the vert id to extract all the weights to arrays fn CopyWeight theVert = ( -- Empty the arrays BoneArray = #() BoneNArray =#() WeightArray = #() theSkin = $.modifiers[#skin] BNumber = skinOps.getVertexWeightCount theSkin theVert BN = BNumber as string for i = 1 to BNumber do ( boneID = skinOps.getVertexWeightBoneId theSkin theVert i boneName = skinOps.GetBoneName theSkin boneID 0 boneWeight = skinOps.getVertexWeight theSkin theVert i append BoneArray boneID append BoneNArray boneName append WeightArray boneWeight ) ) fn PasteWeight pVert = ( disableSceneredraw() theSkin = $.modifiers[#skin] print "these are the stored arrays for copying" print pastearray print weightarray skinOps.ReplaceVertexWeights theskin pVert pasteArray WeightArray enableSceneredraw() redrawViews() ) rollout blank "Single Skin Copy and Paste" ( label lbl1 "Select vert, press copy, then select vert and press paste." pos:[9,8] width:197 height:48 button ButtonC "Copy" pos:[18,40] width:75 height:24 button ButtonP "Paste" pos:[110,40] width:75 height:24 on ButtonP pressed do ( theSkin = selection[1].modifiers[#Skin] n = skinOps.getNumberVertices theSkin selVert=0 for i = 1 to n do ( if (skinops.isVertexSelected theSkin i == 1) then ( selVert=i ) ) -- Call the copy function PasteWeight selVert ) on ButtonC pressed do ( -- Get vert id theSkin = selection[1].modifiers[#Skin] n = skinOps.getNumberVertices theSkin selVert=0 for i = 1 to n do ( if (skinops.isVertexSelected theSkin i == 1) then ( selVert=i ) ) -- Call the copy function CopyWeight selVert -- We now have 3 arrays - bone id, bone name, and bone weight. -- some of the bones might need to be mirrored so for each bone, find the possible mirror n = BoneArray.count pastearray = bonearray ) ) -- Create floater theNewFloater = newRolloutFloater "Rollout title" 220 100 -- Add the rollout section addRollout blank theNewFloater

CGTalk Moderation
04-04-2012, 12:30 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.