<https://lh6.googleusercontent.com/-tWbLvYPTQ-Q/VDxf_Ci94aI/AAAAAAAAAgk/K0f5NEo_rM4/s1600/autoriggerUI.PNG>
I'd like to get your feedback to see if I'm approaching this correctly.
I'm writing an autorigger that takes care of the GUI (calling an external
UI class) along with setting up the controls and attributes of the
different rig elements. I've also written a limb class that accepts the
selected objects from the autorigger and generates an IK/FK limb for either
legs or arms.
Since both of those have basically the same setup (shoulder, elbow, wrist
and hip,knee,ankle), the limb class does very similar things.
My question is: I'd like to be able to call the various rig-joints
generated by the the limb class. My thought is to create a dictionary with
a key identifying the limb, and the values are lists of the left and/or
right IK and/or FK rig-joints that get generated.
For example (pseudocode):
>From autorigger ---> pass to limb class: *
lmb.prepLimb(self,"leg",legJnts,checkIK,checkFK,checkMirror)*
class Limbs(object):
def __init__(self):
self.ikHandles=[]
self.IKrigJnts=[]
self.FKrigJnts=[]
self.pvPos=[]
# dictionaries
self.dHandles={}
self.dIkjnts={}
self.dFkjnts={}
self.dPvPos={}
def prepLimb(self,limbName,rigJoints,IK,FK,mirror):
if mirror:
#split the rigJoints list into separate sublists
for i,mirroredJnts in enumerate(rigJoints):
self.buildLimb(limbName,mirroredJnts, IK, FK)
else:
self.buildLimb(limbName,rigJoints, IK, FK)
def buildLimb(self,limbName,rigJoints,IK,FK):
# create the limbs
The full class is here: *http://pastebin.com/skBZf4TS*
<http://pastebin.com/skBZf4TS>
I'd like to know how to get the following result in,for example, the
dIkjnts dictionary:
self.dIkjnts={"leg":[[IK_L_upLeg_JNT,IK_L_knee_JNT,IK_L_ankle_JNT],[
IK_R_upLeg_JNT,IK_R_knee_JNT,IK_R_ankle_JNT]],"arm":[[IK_L_shoulder_JNT,
IK_L_elbow_JNT,IK_L_wrist_JNT],[IK_R_shoulder_JNT,IK_R_elbow_JNT,
IK_R_wrist_JNT]]}
This way, if I have to access the relevant rig joints, I can call:
# arm setup
limb="arm"
armIkjnts=self.dIkjnts[limb]
I'm assuming that there has got to be a direct relationship between the
lists and the dictionaries to be populated. It works fine if it's only,
say, the legs. But as soon as the other set of limbs get generated by the
limb class, the new key (i.e. "arm":) gets both the legs and the arm values.
The only way so far I found to somewhat fix this was to clear the lists,
but I don't think that's the proper way.
I hope I'm explaining myself clearly. Your help and feedback is appreciated.
--
You received this message because you are subscribed to the Google Groups
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/python_inside_maya/ad86e5eb-5875-4d9c-b03b-2ece26f59fa7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.