cwisbg

nudger_v1

Nov 15th, 2012
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.07 KB | None | 0 0
  1. # Nudger
  2. # cwisbg
  3. from pymel.core import *
  4. def nudger(direction):
  5.     s = selected()[0]
  6.     sl = selected()
  7.     amt = nudgeAmnt.getText()
  8.     amt = float(amt)
  9.     if len(sl) == 0:
  10.         print "nothin to nudge"
  11.     else:
  12.         if tbox.getValue():
  13.             if direction == "X+":
  14.                 move(s,amt,0,0,r=1)
  15.             elif direction == "X-":
  16.                 move(s,-amt,0,0,r=1)
  17.             elif direction == "Y+":
  18.                 move(s,0,amt,0,r=1)
  19.             elif direction == "Y-":
  20.                 move(s,0,-amt,0,r=1)            
  21.             elif direction == "Z+":
  22.                 move(s,0,0,amt,r=1)  
  23.             elif direction == "Z-":
  24.                 move(s,0,0,-amt,r=1)
  25.         if rbox.getValue():
  26.             if direction == "X+":
  27.                 rotate(s,amt,0,0,r=1, os=1)
  28.             elif direction == "X-":
  29.                 rotate(s,-amt,0,0,r=1, os=1)
  30.             elif direction == "Y+":
  31.                 rotate(s,0,amt,0,r=1, os=1)
  32.             elif direction == "Y-":
  33.                 rotate(s,0,-amt,0,r=1, os=1)            
  34.             elif direction == "Z+":
  35.                 rotate(s,0,0,amt,r=1, os=1)  
  36.             elif direction == "Z-":
  37.                 rotate(s,0,0,-amt,r=1, os=1)
  38.         if wrbox.getValue():
  39.             if direction == "X+":
  40.                 rotate(s,amt,0,0,r=1, ws=1)
  41.             elif direction == "X-":
  42.                 rotate(s,-amt,0,0,r=1, ws=1)
  43.             elif direction == "Y+":
  44.                 rotate(s,0,amt,0,r=1, ws=1)
  45.             elif direction == "Y-":
  46.                 rotate(s,0,-amt,0,r=1, ws=1)            
  47.             elif direction == "Z+":
  48.                 rotate(s,0,0,amt,r=1, ws=1)  
  49.             elif direction == "Z-":
  50.                 rotate(s,0,0,-amt,r=1, ws=1)
  51.         if dpbox.getValue():
  52.             if direction == "X+":
  53.                 move(s,amt,0,0,r=1, os=1)
  54.             elif direction == "X-":
  55.                 move(s,-amt,0,0,r=1, os=1)
  56.             elif direction == "Y+":
  57.                 move(s,0,amt,0,r=1, os=1)
  58.             elif direction == "Y-":
  59.                 move(s,0,-amt,0,r=1, os=1)            
  60.             elif direction == "Z+":
  61.                 move(s,0,0,amt,r=1, os=1)  
  62.             elif direction == "Z-":
  63.                 move(s,0,0,-amt,r=1, os=1)                
  64.         else:
  65.             pass
  66. win = window(title="My Window")
  67. layout = columnLayout(bgc = [.3,.3,.3],)
  68. text(l="Nudge Amnt")
  69. nudgeAmnt = textField(w=70,tx = ".1" )
  70. tbox = checkBox(l = "Translate")
  71. rbox = checkBox(l = "Rotate" , v=1)
  72. wrbox = checkBox(l = "World Rotate")
  73. dpbox = checkBox(l = "Dolly/Pan" )
  74. btnLayout = rowColumnLayout(nc=2,rs=(1,10),cs=(2,10))
  75. x0 = button(l="X-",command=Callback(nudger,"X-"), parent = btnLayout)
  76. x = button(l="X+",command=Callback(nudger,"X+"), parent = btnLayout)
  77. y0 = button(l="Y-",command=Callback(nudger,"Y-"), parent = btnLayout)
  78. y = button(l="Y+",command=Callback(nudger,"Y+"), parent = btnLayout)
  79. z0 = button(l="Z-",command=Callback(nudger,"Z-"), parent = btnLayout)
  80. z = button(l="Z+",command=Callback(nudger,"Z+"), parent = btnLayout)
  81. win.show()
Advertisement
Add Comment
Please, Sign In to add comment