Hi, guys
Okay, here is my code:
def groupAndSelect():
selection = base.ls(sl=True)
selectionindex = selection[0]
offsetGroup = base.group(em=True, n=str(selectionindex)+"_Offset_Group")
base.parent(offsetGroup, selection)
base.setAttr("*_Offset_Group.translateX", 0)
The red code is the issue, here is the lowdown: I'm trying to make a function that will select a joint and then assign a an offset group to it and the add a nurbs ctrl.
The key problem I'm having now is that I've managed to assign the group to the joint but I can't zero out its translate/rotate values.
The question I'm asking is how do I select the offset group and then zero out the translate/rotate attributes? I've been trying to use the setAttr command with no luck, is there another way or is there something I'm doing wrong?
Thanks
Solved! Go to Solution.
Hi, guys
Okay, here is my code:
def groupAndSelect():
selection = base.ls(sl=True)
selectionindex = selection[0]
offsetGroup = base.group(em=True, n=str(selectionindex)+"_Offset_Group")
base.parent(offsetGroup, selection)
base.setAttr("*_Offset_Group.translateX", 0)
The red code is the issue, here is the lowdown: I'm trying to make a function that will select a joint and then assign a an offset group to it and the add a nurbs ctrl.
The key problem I'm having now is that I've managed to assign the group to the joint but I can't zero out its translate/rotate values.
The question I'm asking is how do I select the offset group and then zero out the translate/rotate attributes? I've been trying to use the setAttr command with no luck, is there another way or is there something I'm doing wrong?
Thanks
Solved! Go to Solution.
Solved by mcw0. Go to Solution.
Your code worked fine for me. Another command to zero out values is the "makeIdentity" command. Give that a try. But your code is working for me.
Your code worked fine for me. Another command to zero out values is the "makeIdentity" command. Give that a try. But your code is working for me.
Ah, I should've mentioned this in the original: if I create more than one offset_group the code fails, I presume because it's trying to deal with multiple "offset_groups" in the scene. The idea behind this code is that it can be used multiple times.
Ah, I should've mentioned this in the original: if I create more than one offset_group the code fails, I presume because it's trying to deal with multiple "offset_groups" in the scene. The idea behind this code is that it can be used multiple times.
Ah...of course. "setAttr" only does one node at a time. So you would have to loop through your offsetGrps. Whereas "makeIdentity" works on any number of selections.
Ah...of course. "setAttr" only does one node at a time. So you would have to loop through your offsetGrps. Whereas "makeIdentity" works on any number of selections.
That seems to have done it! Thanks 🙂
That seems to have done it! Thanks 🙂
Can't find what you're looking for? Ask the community or share your knowledge.