Hello,
I am playing around with building a rig based off locator positions and have ran into a small problem with naming. I have a if statement that compares every locator in a list and every joint in another list and if there transforms are the same it gives the joint the locators name. I have a issue where my if statement just stops running in the middle. It doesnt error out and it hasnt completed the list comparison so I dont know whats going on.
def comp():
grpOne = cmds.textScrollList("grpOne", q=1, allItems=1)
grpTwo = cmds.textScrollList("grpTwo", q=1, allItems=1)
print(grpOne)
print(grpTwo)
for o in (grpOne):
for t in (grpTwo):
grpOneT = cmds.getAttr( o + ".translate")
grpTwoT = cmds.getAttr( t + ".translate")
if(grpOneT == grpTwoT):
cmds.joint( t, e=1, n=o)
grpOne.remove(o)
grpTwo.remove(t)
cmds.textScrollList("grpOne", e=1, ri=o)
cmds.textScrollList("grpTwo", e=1, ri=t)
print(o + " and " + t + " are in the same location")
print(grpOne)
print(grpTwo)
else:
print(o + " and " + t + " are not located together")
print(grpOne)
print(grpTwo)
That is the code. I am running it through a gui and if I run the command to execute that multiple times it will eventually complete the lists. Like I said it never errors or completes it just stops. Thank you for any and all help.
EDIT:
Nevermind, I figured it out. It stopped because it completed the for in loops…