Dynamic copy vertex weights tool - MEL or Python?

Dynamic copy vertex weights tool - MEL or Python?

Anonymous
Not applicable
2,316 Views
2 Replies
Message 1 of 3

Dynamic copy vertex weights tool - MEL or Python?

Anonymous
Not applicable

Hey Guys,

 

I'm trying to write a script that does the following:

 

1) User selects an edge(s).

2) Go to Verts

2) Transfer the weights from the selected verts to the nearest verts.

 

I've got a head mesh and torso mesh, and they need to share the same vertex weights along the neck line where they connect.  I can see how this tool would be good for other areas of split mesh as well.

 

 

Any advice would be great... Mel or Python.

 

Thanks,

 

Stef

0 Likes
2,317 Views
2 Replies
Replies (2)
Message 2 of 3

forrest.brent
Enthusiast
Enthusiast

I'm your huckleberry.

Select the source vertex.

add-Select the target vertex.

Run this:

 

import maya.cmds as cmd
import maya.mel as mel

def weldTheBitches(): verts = cmd.ls(sl=True, fl = True) cmd.select(verts[0]) mel.eval('artAttrSkinWeightCopy') cmd.select(verts) mel.eval('artAttrSkinWeightPaste') weldTheBitches()
Message 3 of 3

forrest.brent
Enthusiast
Enthusiast

Quick edit - I can't for the life of my find the option to edit my post.  Thanks Obama.

This script will copy the weight of your first selected vertex, and paste it to the rest of your selected vertices.

import maya.cmds as cmd
import maya.mel as mel

def weldTheBitches():
    verts = cmd.ls(fl = True, os = True)
    cmd.select(verts[0])
    mel.eval('artAttrSkinWeightCopy')
    cmd.select(verts)
    mel.eval('artAttrSkinWeightPaste')

weldTheBitches()
0 Likes