So.. thanks everyone for the replies. I managed to acced the data I was looking for. It was just a bit hidden and not-so-easy to read. Since I haven't found a solution for this problem on the internet yet, i post mine here.
Given that (as written in the blendShape node documentation <http://download.autodesk.com/us/maya/2009help/Nodes/blendShape.html>) - inputGeomTarget ... stores the The target geometry input ... (type: geometry) - inputPointsTarget ... stores the Delta values for points in a target geometry ... (type: pointArray) - inputComponentsTarget ... stores the Component list for points in a target geometry ... (type: componentList) and that maya APIs dont have any convenient method to access this data, I decided to used MPlugs to reach these attributes. If the shape target object is still connected to the blend shape node, you can simply use the MFnBlendShapeDeformer.getTargets() method If the shape target object has been deleted or disconnected, then the inputGeomTarget attribute will be empty, and you will have to find a way to combine the two remaining attributes. The code below retrieve this data (in this case just for the first target in the bsNode) and prints it out. I guess that, properly combined together, this data gives you a lot of control over what's happening inside the node, especially when dealing with complex rigs! Hope this helps! ps. let me know if you have any comment or suggestion... Enrico import maya.cmds as cmds import maya.OpenMaya as OM # gets the blendShape node MObject bsNodeName = 'blendShape1' bsNodeObj = OM.MObject() sel = OM.MSelectionList() sel.add(bsNodeName, 0) sel.getDependNode(0, bsNodeObj) # gets the plug for the inputTargetItem[] compound attribute and ... dgFn = OM.MFnDependencyNode(bsNodeObj) plug = dgFn.findPlug('inputTarget').elementByPhysicalIndex(0).child(0).elementByPhysicalIndex(0).child(0).elementByPhysicalIndex(0) # if connected, retrieves the input target object and queries his points if plug.child(0).isConnected(): inputGeomTarget = plug.child(0).asMObject() targetPoints = OM.MPointArray() fnMesh = OM.MFnMesh(inputGeomTarget) fnMesh.getPoints(targetPoints) # if not connected, retrieves the deltas and the affected component list else: inputPointsTarget = plug.child(1).asMObject() inputComponentsTarget = plug.child(2).asMObject() # to read the offset data, I had to use a MFnPointArrayData fnPoints = OM.MFnPointArrayData(inputPointsTarget) targetPoints = OM.MPointArray() fnPoints.copyTo(targetPoints) # read the component list data was the trickiest part, since I had to use MFnSingleIndexedComponent to extract (finally), an MIntArray # with the indices of the affected vertices componentList = OM.MFnComponentListData(inputComponentsTarget)[0] fnIndex = OM.MFnSingleIndexedComponent(componentList) targetIndices = OM.MIntArray() fnIndex.getElements(targetIndices) if targetIndices.length() == targetPoints.length(): for i in range(targetPoints.length()): print "vertex %d has offset " %targetIndices[i], targetPoints[i].x,targetPoints[i].y, targetPoints[i].z -- 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/b92717fc-e20b-4131-bb69-317680d3c03d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
