I want to write a tool that would analyze selected mesh to see whether they have deformer inputs, and then print the result.
To be honest, I'm not quite sure as to how to approach this. I had an idea of checking objects inputs. Then I'm not sure how, but I need to print the source of deformer, and the destination. in the script editor.
Could somebody help and direct me how to approach this?
Thank you
Update I was able to get it working but have new issue. Here is what I have:
sel = pm.ls(sl=True, fl=True, type='transform')
for s in sel:
pm.select(s)
print s
cn = pm.listConnections(s.inMesh, d=False, s=True)
pm.select(cn)
res = pm.listConnections(cn[0].controlMesh, d=False, s=True)
print('{} : {}'.format(res, s))
Question:
Sometimes it is happens that driver is the same for many driven obj. How can i format the result so that the printed version would look like this:
Result:
'driver':'drivenA','drivenB','drivenC'