hello,
i've stored a selection of verts from one mesh. And i've stored all the verts
from another mesh.
im trying to copy the selection of verts from the first mesh into the list of
the second mesh. So all the corresponding vert points get implanted into the
second mesh's vert list.
Then i just want to use setPoints to set all the vert points back onto the
second mesh. Effectively copying the relative position of the selected verts
onto the other mesh.
i think i'm very nearly there with this code so far:
########################################################
import maya.api.OpenMaya as om
def getPoints(geo):
sel = om.MSelectionList()
sel.add(geo)
selObj = sel.getDagPath(0)
mesh = om.MFnMesh(selObj)
return mesh, mesh.getPoints()
def implantPtPositions(targetMesh,target_mesh_verts,indices):
#cycle through selected verts and copy them into the second mesh verts list
# HERE HERE HERE
#then use this new list to set the points of the second mesh
targetMesh.setPoints(newVerts,om.MSpace.kObject)
#store the vert positions for the second mesh
(targetMesh, target_mesh_verts) = getPoints("target")
#store selected vert points
sel_list = om.MGlobal.getActiveSelectionList()
(mDagPath, component) = sel_list.getComponent(0)
comp_fn = om.MFnSingleIndexedComponent(component)
indices = comp_fn.getElements()
#set the mesh difference to the target mesh
implantPtPositions(targetMesh,target_mesh_verts,indices)
########################################################
I just need to know how to cycle through the selected verts and copy them over
to the second mesh ("target") list. so i can then use that new verts list in
the setPoints function.
can anyone help me out here,thanks
Sam
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/6bab6738-aff9-4979-b02d-6aa75d1ff14d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.