Archive for September, 2017

Create Null Above Object, Rename Null to Reflect Child Name – Python, Maya

Posted by:

Rename a list of objects using the selection list’s object names in the rename, add a suffix or prefix.

import maya.cmds as cmds

selectionList = cmds.ls( selection=True ) #create a list of object from your current selection

for selectionListObjects in selectionList:

null=cmds.group(empty=True)
nullName = cmds.rename(null, selectionListObjects + ‘Null’)
print newName
cmds.parent(selectionListObjects,nullName)

 

Continue Reading →
0

connectAttr of one selection to another python maya

Posted by:

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

# HIKConnections
import maya.cmds as cmds

selectionList = cmds.ls( selection=True ) #create a list of object from your current selection

”’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”’
cmds.connectAttr(selectionList[0] + ‘.customVisibility’, selectionList[1] + ‘.visibility’)

 

Continue Reading →
0