forked from MarkSchipper/Python-Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAutoRigger.py
More file actions
135 lines (102 loc) · 5.35 KB
/
AutoRigger.py
File metadata and controls
135 lines (102 loc) · 5.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
import maya.cmds as base
import Locators
import Joints
import SecondaryLocators as SL
import Controller
import Constraints
import CreateIK
import FaceJoints as FJ
import os
## TODO: FOOTROLL
# we reload all classes when this file is executed, else we would need to restart Maya after every change
Locators = reload(Locators)
Joints = reload(Joints)
SL = reload(SL)
Controller = reload(Controller)
Constraints = reload(Constraints)
CreateIK = reload(CreateIK)
FJ = reload(FJ)
class AutoRigger():
def __init__(self):
base.currentUnit(linear = 'meter')
base.grid(size = 12, spacing = 5, divisions = 5)
print os.path.dirname(os.path.realpath(__file__))
self.BuildUI()
def BuildUI(self):
#global spineValue
###########################################
# Create the basic window ##
###########################################
# Create a window with the name Auto Rigger
base.window("Auto Rigger")
form = base.formLayout()
tabs = base.tabLayout(imh = 5, imw = 5)
base.formLayout(form, edit = True, attachForm=((tabs, 'top',0), (tabs,'left', 0), (tabs, 'right', 0), (tabs, 'bottom',0)))
# set the layout of the window
ch1 = base.rowColumnLayout(nc = 1, cal = (1, 'right'), adjustableColumn = True)
base.image(w = 400, h = 100, image = os.path.dirname(os.path.realpath(__file__))+"\logo.jpg")
settingsText = base.text('Settings', l = 'Rig Settings')
base.separator(st = 'none')
#base.text(l = 'Prefix', w = 100)
self.prefix = base.textFieldGrp(w = 100, text = 'test', editable = True)
self.spineCount = base.intSliderGrp(l = "Spine Count", min = 1, max = 10, value = 4, step = 1, field = True)
#spineCount = base.intField(minValue = 1, maxValue = 10, value = 4)
self.fingerCount = base.intSliderGrp(l = "Finger Count", min = 1, max = 10, value = 5, step = 1, field = True)
#fingerCount = base.intField(minValue = 0, maxValue = 10, value = 5)
base.separator(h = 10, st = 'none')
self.doubleElbow = base.checkBox(l = 'Double Elbow', align = 'left' )
base.setParent('..')
ch2 = base.rowColumnLayout(nc = 1, cal = (1, 'right'), adjustableColumn = True)
base.separator(h = 10, st = 'none')
base.button(l = "Create Base Locators", w = 200, c = self.DoLocators)
base.separator(st = 'none')
base.button(l = "Create Secondary Locators", w = 200, c = "SL.SecondaryLocators()")
base.separator(st = 'none')
base.button(l = "Mirror L->R", w = 200, c = "Locators.mirrorLocators()")
base.separator(st = 'none', h = 20)
base.button(l = "Create Facial Locators", w = 200, c = self.FaceLocators)
base.separator(st = 'none')
base.button(l = "Delete All Locators", w = 200, c = "Locators.deleteLocators()")
base.setParent('..')
ch3 = base.rowColumnLayout(nc = 1, cal = (1, 'right'), adjustableColumn = True)
base.separator(st = 'none')
base.button(l = "Joints Window", w = 200, c = "Joints.CreateJointsWindow()")
base.separator(st = 'none')
base.setParent('..')
ch4 = base.rowColumnLayout(nc = 1, cal = (1, 'right'), adjustableColumn = True)
base.button(l = "Add Facial Joints", w = 200, c = self.FaceJoints)
base.separator(st = 'none')
base.setParent('..')
ch5 = base.rowColumnLayout(nc = 1, cal = (1, 'right'), adjustableColumn = True)
base.button(l = "Finalize Rig", w = 200, c = self.FinalizeRig)
base.separator(st = 'none')
base.button(l = "Bind Skin", w = 200, c = "Constraints.BindSkin()")
base.separator(st = 'none')
base.button(l = "Clear Locators", w = 200, c = self.ClearScene)
base.setParent('..')
base.tabLayout(tabs, edit = True, tabLabel = ((ch1, 'Settings'), (ch2, 'Locators'), (ch3, 'Body Rig'), (ch4, 'Face Rig'), (ch5, 'Finalize') ))
# show the actual window
base.showWindow()
def NextTab(self, void):
base.tabLayout(edit = True, st = "2")
def DoLocators(self, void):
_spineCount = base.intSliderGrp(self.spineCount, q = True, v = True)
_fingerCount = base.intSliderGrp(self.fingerCount, q = True, v = True)
_doubleElbow = base.checkBox(self.doubleElbow, q = True, v = True)
Locators.CreateLocators(_spineCount, _fingerCount, _doubleElbow)
def FaceLocators(self, void):
FJ.FaceJoints().CreateFaceWindow(self)
def FaceJoints(self, void):
FJ.FaceJoints().CreateJoints(self)
def FinalizeRig(self, void):
_spineCount = base.intSliderGrp(self.spineCount, q = True, v = True)
_fingerCount = base.intSliderGrp(self.fingerCount, q = True, v = True)
Controller.CreateController(_spineCount, _fingerCount)
CreateIK.IKHandles()
Constraints.CreateConstraints(_fingerCount, _spineCount)
if(base.objExists("FACERIG_*")):
FJ.FaceJoints().AddConstraints(self)
def ClearScene(self, void):
base.delete("Loc_Master")
base.delete("SECONDARY")
base.delete("FACE_LOC")