Jan
9
2018
Maya Message Attribute Example
it’s been a long time since i last post in this blog….
Today i did a bit of brushing up on “message” attributes for maya, which are very similar to #maxobject attribute type in max…
Anyway basic searches didn’t really link to full working examples so here’s you go folks 🙂
hopefully someone will find it useful…
import pymel.core as pm def test(): node = pm.PyNode('locator1') spheres = pm.ls('pSphere*',type='transform') #lets start easy with on object if not pm.attributeQuery('object1',node=node,exists=True): pm.addAttr(node,ln='object1',at='message') pm.connectAttr(spheres[0].message,node.object1,f=True) print 'Single Connection', pm.listConnections(node.object1) #conncet a some more objects if not pm.attributeQuery('multiObject',node=node,exists=True): pm.addAttr(node,ln='multiObject',at='message',m=True,im=False) for s in spheres:pm.connectAttr(s.message,node.multiObject,na=True) print 'Multi Connection',pm.listConnections(node.multiObject) print '\n\n------>' test()