Posted by:

Autodesk documentation on this is not great.  They don’t do a good job of telling you how this works, it just shows you some examples that you are apparently supposed to run and then reverse engineer the function by it’s results.

Anyway, there is a source attribute, that is the first argument, then there is the target attribute, that is the second attribute.

This takes the 1st selected attribute of an object and connects it to the second object’s attribute:

  1. import maya.cmds as cmds
  3. selectionList = selection=True ) #create a list of object from your current selection
  5. '''connects the first attribute in the function to the second. Note the format of the array then the plus sign then the single quotes and the attribute, interestingly this contains a string as the variable'''
  6. cmds.addAttr(selectionList[0], longName = 'customVisibility', attributeType = 'bool', keyable = True)
  8. cmds.connectAttr(selectionList[0] + '.customVisibility', selectionList[1] + '.visibility')


Related Entries

  Related Posts
  • No related posts found.