Hi all,
I am trying to get my head around this little exercise but I’m encountering different difficulties.
I am trying to write a small definer in python and my approach is the following:
Given a selection of random objects in the scene, let’s pretend sel = cmds.ls(sl = True). I am looping through it and storing an attribute created in the object previously. This is because I want to start with a template the I import in the scene and its objects contains an id e.g: id = 4
I also created a dictionary containing a definition I want to use later and that I want to update at any time in the script like:
dictionary = {0 : “l_arm”,
1 : “r_arm”,
etc
}
What I’d like to do is to match whoever object which contains an id with one of the same numbers inside the dictionary. For example my left arm control has an id =0 so then I want to assign the matching string of the dictionary to the real object which is containing that matching id. So then I can just simply select l_arm as a string??? cmds.select(‘l_arm’)
Is this approach right? Can anybody help me understanding it with some kind code example too?Some code on how to approach the coding for a definer? I’d like whitin this big procedure to output global variables for all the controls of the rig as last.
Thanks a lot in advance