I’m trying to use the reorderDeformers command to put a blendShape node in the correct spot in the Inputs stack. However, that command requires that I know which deformers I want to reorder. I can’t find any non-ridiculous way of simply listing all deformers on a mesh.
The closest thing I’ve come up with is doing a listHistory on the object and then cross-checking the results with a list of deformer types. Even this though requires that I have a giant list of all deformer types to compare it to. It just seems dirty.
What about checking the inherited types of the history nodes? All deformers inherit from “geometryFilter”, so doing:
string $types[] = `nodeType -inherited $node`;
will get you the types that a node is derived from. And then if “geometryFilter” is present in $types, you know the current node is a deformer.
There is also a command called listNodeTypes. Unfortunately, it expects a string with the classification of a node that you are searching for, but it would appear that only shading nodes have a classification.
Grab history on mesh, loop through each history node, check if geometryFilter is present. Bingo. Still a bit convoluted but it gave me exactly what I needed in only a couple of lines of code.
It’s unfortunate that listHistory doesn’t behave like the other list commands (i.e. ls, listConnections, etc…) and allow you to pass in a type flag to filter by. Sounds like something worth suggesting to Autodesk.