Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Nudger
- # cwisbg
- from pymel.core import *
- def nudger(direction):
- s = selected()[0]
- sl = selected()
- amt = nudgeAmnt.getText()
- amt = float(amt)
- if len(sl) == 0:
- print "nothin to nudge"
- else:
- if tbox.getValue():
- if direction == "X+":
- move(s,amt,0,0,r=1)
- elif direction == "X-":
- move(s,-amt,0,0,r=1)
- elif direction == "Y+":
- move(s,0,amt,0,r=1)
- elif direction == "Y-":
- move(s,0,-amt,0,r=1)
- elif direction == "Z+":
- move(s,0,0,amt,r=1)
- elif direction == "Z-":
- move(s,0,0,-amt,r=1)
- if rbox.getValue():
- if direction == "X+":
- rotate(s,amt,0,0,r=1, os=1)
- elif direction == "X-":
- rotate(s,-amt,0,0,r=1, os=1)
- elif direction == "Y+":
- rotate(s,0,amt,0,r=1, os=1)
- elif direction == "Y-":
- rotate(s,0,-amt,0,r=1, os=1)
- elif direction == "Z+":
- rotate(s,0,0,amt,r=1, os=1)
- elif direction == "Z-":
- rotate(s,0,0,-amt,r=1, os=1)
- if wrbox.getValue():
- if direction == "X+":
- rotate(s,amt,0,0,r=1, ws=1)
- elif direction == "X-":
- rotate(s,-amt,0,0,r=1, ws=1)
- elif direction == "Y+":
- rotate(s,0,amt,0,r=1, ws=1)
- elif direction == "Y-":
- rotate(s,0,-amt,0,r=1, ws=1)
- elif direction == "Z+":
- rotate(s,0,0,amt,r=1, ws=1)
- elif direction == "Z-":
- rotate(s,0,0,-amt,r=1, ws=1)
- if dpbox.getValue():
- if direction == "X+":
- move(s,amt,0,0,r=1, os=1)
- elif direction == "X-":
- move(s,-amt,0,0,r=1, os=1)
- elif direction == "Y+":
- move(s,0,amt,0,r=1, os=1)
- elif direction == "Y-":
- move(s,0,-amt,0,r=1, os=1)
- elif direction == "Z+":
- move(s,0,0,amt,r=1, os=1)
- elif direction == "Z-":
- move(s,0,0,-amt,r=1, os=1)
- else:
- pass
- win = window(title="My Window")
- layout = columnLayout(bgc = [.3,.3,.3],)
- text(l="Nudge Amnt")
- nudgeAmnt = textField(w=70,tx = ".1" )
- tbox = checkBox(l = "Translate")
- rbox = checkBox(l = "Rotate" , v=1)
- wrbox = checkBox(l = "World Rotate")
- dpbox = checkBox(l = "Dolly/Pan" )
- btnLayout = rowColumnLayout(nc=2,rs=(1,10),cs=(2,10))
- x0 = button(l="X-",command=Callback(nudger,"X-"), parent = btnLayout)
- x = button(l="X+",command=Callback(nudger,"X+"), parent = btnLayout)
- y0 = button(l="Y-",command=Callback(nudger,"Y-"), parent = btnLayout)
- y = button(l="Y+",command=Callback(nudger,"Y+"), parent = btnLayout)
- z0 = button(l="Z-",command=Callback(nudger,"Z-"), parent = btnLayout)
- z = button(l="Z+",command=Callback(nudger,"Z+"), parent = btnLayout)
- win.show()
Advertisement
Add Comment
Please, Sign In to add comment