
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi, thanks for taking your time reading this 🙂
So I am fairly new to programming in general and I received an assignment to create a simple FK autorig with Python. The problem that I ran into was when attempting to replicate the joints hierarchy but for the controllers. So I received this error: 'tuple' object does not support item assignment.
Here is the code:
import maya.cmds as cmds
number = '#'
Data = ()
Select = cmds.ls(sl=True, l=True)
Hier = cmds.listRelatives(Select[0], ad=True, f=True)
Hier.reverse()
Hier.insert(0, Select[0])
for i in Hier:
if cmds.listRelatives(i, c=True): #If child = true, you get a controller
Base = i.split('|')[-1]
Zero = cmds.createNode('transform', n= number + 's_zero' + Base)
Offset = cmds.createNode('transform', n= number + 's_zero' + Base)
Ctrl = cmds.circle(n= number + 's_CTRL#' + Base)
cmds.parent(Ctrl[0], Offset)
cmds.parent(Offset, Zero)
cmds.delete(cmds.parentConstraint(i, Zero))
Data[i] = Ctrl[0] #<------------------------------------------It complains here
Par = cmds.listRelatives(i, p=True, f=True)
if Par:
Par = Par[0]
if Par in Data.keys():
cmds.parent(Zero, Data[Par])
I hope that I posted this correctly x.x
Solved! Go to Solution.