Blendshape query deformed target points

Hey,
What is the quickest way to get a list of points from a blendshape that were deformed given a target?
For example, if I have a target called r_brow_up, I’d like to get a list of points that moved compared to the original mesh.

My first thought was to trigger the target, query the points of both the target and the original and determine from that what points moved. However this seems slow. Is there something in the blendshape node I can query?

Cheers,
-Sean

Ok, I got. It’s diving down the whole inputTargets[0].inputTargetGroups.blah.blah.blah. path.

I thought I’d come back and show what I finally implemented.
Hope it’s useful to some. :slight_smile:

import maya.cmds as mc

def getBlendshapeTargetComponents(blendshape, targetIndex):
    """
    Get a component list of a blendshape target vertices
    :param blendshape: blendShape node
    :param targetIndex: index of target
    :return: [list] component list
    """

    # Get a list of components 
    verts = mc.getAttr("{}.inputTarget[0].inputTargetGroup[{}]."
                       "inputTargetItem[6000].inputComponentsTarget".format(blendshape, targetIndex))
    
    # Get transform object
    mesh = mc.listConnections(blendshape, c=True)[1]
    
    # Loop through verts and build a selection list
    # transform.vtx[N]
    comps = []
    if verts:
        for v in verts:
            vert = mc.ls("{}.{}".format(mesh, v))[0]
            comps.append(vert)
        return comps
    else:
        return None

verts = getBlendshapeTargetComponents('blendShape1', 0)
mc.select(verts, r=True)

I’m sure that will come in handy.

Minors quips

the -geometry flag of the blendshape command is a cleaner way to find the geo that a blendshape is driving than using listConnections.

mc.blendShape(blendshape, q=True, geometry=True)

Also because on success it returns a list, I’d expect the function to return an empty list, not None, if there are no deltas.

You can also use this method in conjunction with the inputPointsTarget attribute (holds a sparse list of the actual deltas) to have a tolerance so it won’t return verts with micro movements.

Ah, good stuff. Thanks for the tips!