multiConnectAttr allows for multiple attribute connections at one time with the option for a custom undo/doIt commands in ethier Python or MEL based off a list/array. Useful for updating a GUI that does not normally allows for undos.
Python Example (Create 4 nurbsSpheres):
import maya.cmds as cmds
doItCmd = 'print("Custom doit command executed")'
undoCmd = 'print("Custom undo command executed")'
conList = ['nurbsSphere1.tx','nurbsSphere2.tx','nurbsSphere3.tx','nurbsSphere4.tx']
cmds.multiConnectAttr( conList, force=True, lock=True, dip=doItCmd, udp=undoCmd)
#The doItCmd will execute along with multiConnectAttr and the undoCmd will execute when you undo multiConnectAttr
Synopsis: multiConnectAttr [flags] [String...]
Flags:
-dim | -doItMEL | String | Pass a custom MEL command(s) that is executed when multiConnectAttr is called |
-dip | -doItPython | String | Pass a custom Python command(s) that is executed when multiConnectAttr is called |
-f | -force | Forces the connection. If the destination is already connected, the old connection is broken and the new one made. | |
-h | -help | Displays help. Note: The command will NOT execute any connections. | |
-l | -lock | on|off | If the argument is true, the destination attribute is locked after making the connection. If the argument is false, the connection is unlocked before making the connection. |
-na | -nextAvailable | If the destination multi-attribute has set the indexMatters to be false with this flag specified, a connection is made to the next available index. No index need be specified. | |
-udm | -undoMEL | String | Pass a custom MEL command(s) that is executed when multiConnectAttr is undone |
-udp | -undoPython | String | Pass a custom Python command(s) that is executed when multiConnectAttr is undone |
Notes:
If the custom doIt command causes an error, the multiConnectAttr will NOT be executed.
To comply with Maya's rules when dealing with custom commands that changes the state of the scene, the custom
undo command will NOT cause the multiConnectAttr's undo to fail. However, multiConnectAttr will dislay an error that the custom undo failed when Maya goes into idle.
Will successfully make connections between surfaces and shading groups without having to disconnect the shape from the orginal shading group.
Return Value:
Return True if the multiConnectAttr was successful.
There are two folders inside the zip file. Drop the files in your plug-ins directory and load the multiConnectAttrPlugin.py:
Python 2.4.3 ( Maya 8.5)
Python 2.5.1 ( Maya 2008)
There is a new version of Maya's updateBinMembershipAfterConnection.mel that when dropped in your scripts path will update the hypershade when using multiConnectAttr.
If you have any questions and/or comments please don't hesitate to email me and rating.
For bug reports please email me for a chance to address the issue before leaving a low rating.
-meljunky
Please use the Feature Requests to give me ideas.
Please use the Support Forum if you have any questions or problems.
Please rate and review in the Review section.