Hello Flaye,

Maybe a little off topic, but, still about getting and setting data for rigs

Have you cheked out what the guy from red9 is doing?

http://vimeo.com/100882408
http://vimeo.com/100883383
http://vimeo.com/102463373

http://www.creativecrash.com/maya/script/red9-studio-pack

I was using some of this ideas in the past, but this guy's stuff is really
polished.
Check out how he saves the data for the classes in the scene as network
nodes,
and how the python classes wrap around them.
As a plus, since you can connect objects to the network node, you dont have
to rely so much in node names.

Hope this is usefull
Cheers!
Eduardo




On Tue, Oct 14, 2014 at 10:45 AM, flaye <[email protected]> wrote:

> Hi Justin,
>
> Thanks for that tip. So I'm guessing then I don't need to append the
> objects to the list?
>
> From this:
>                 #self.ikHandles.append(allHandles)
>
>                 # update ikHandle dictionary
>                 self.dHandles[limbName]=self.ikHandles
>
>
>                 self.IKrigJnts.append(IKjoints)
>
>                 # update IK dictionary
>                 self.dIkjnts[limbName]=self.IKrigJnts
>
>
> to this?
>                 self.dHandles[limbName]=allHandles
>
>
>
>                 self.dIkjnts[limbName]=IKjoints
>
>
> Thanks,
>
>
> On Tuesday, October 14, 2014 5:16:30 AM UTC-4, Justin Israel wrote:
>>
>> I didn't extensively examine your pastebin, but one thing that stands out
>> is that you seem to be appending sets of lists to your ikHandles list, and
>> then assigning that list as the value to every limbName in your dHandles
>> dict:
>>
>> self.ikHandles.append(allHandles)
>> self.dHandles[limbName]=self.ikHandles
>>
>> And you do the same for the other lists and dicts. So each limbName ends
>> up referencing the entirely same list, if I am reading it correctly.
>> Any reason to keep discreet lists and dicts instead of just dicts, where
>> you manage the list of each dict key?
>>
>> self.ikHandles = {}
>> ...
>> self.ikHandles[limbName] = handles
>>
>>
>>
>>
>>
>>
>>> <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/fce358ea-06a9-4467-b00a-7dc119a33cfe%40googlegroups.com
> <https://groups.google.com/d/msgid/python_inside_maya/fce358ea-06a9-4467-b00a-7dc119a33cfe%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>



-- 
Eduardo GraƱa
www.eduardograna.com.ar

-- 
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/CACt6Grno7EomjQ1qL%3DxO%3DWfAD%3D9vGy3XkT7xg3KxBhX1HcnF9Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to