-
Notifications
You must be signed in to change notification settings - Fork 1
/
BR_01_InterfaceTool.py
1860 lines (1514 loc) · 57.5 KB
/
BR_01_InterfaceTool.py
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
'''
ByrdRigs Interface tool
import BR_Interface_Toolset.BR_01_InterfaceTool as BR_InterfaceTool
reload (BR_InterfaceTool)
BR_InterfaceTool.gui()
'''
import pymel.core as pm
import maya.cmds as cmds
import maya.mel as mel
# Still needs the control tab with the icons
# Working on the quad and biped setups
tab_bgc=(0.472, 0.136, 239)
subTab_bgc = (0.492, 0.323, 241)
window_bgc = (.2,.2,.2)
color_1 = (.141,.725,.627)
color_2 = (.078, .678, .557)
color_3 = (.059, .612, .749)
color_4 = (.059, .475, .616)
color_5 = (.059, .392, .663)
color_6 = (.224, .259, .894)
color_7 = (.475, .278, .925)
color_8 = (.447, .145, .965)
color_9 = (.475, .078, .678)
color_10 = (.576, .039, .839)
color_11 = (.498, .843, .859)
color_12 = (.604, .902, .914)
color_13 = (0, .529, .541)
color_14 = (.02, .612, .639)
color_15 = (.302, .812, .82)
color_16 = (.576, .867, .863)
color_17 = (.788, .914, .871)
color_18 = (.855, .945, .914)
color_19 = (.047, .098, .459)
color_20 = (.18, .2, .561)
color_21 = (.349, .373, .659)
color_22 = (.498, .549, .753)
color_23 = (.651, .686, .839)
color_24 = (.757, .776, .863)
color_25 = (.059, .169, .357)
color_26 = (.204, .337, .525)
color_27 = (.427, .529, .659)
color_28 = (.608, .667, .749)
color_29 = (.757, .773, .82)
color_30 = (.843, .847, .859)
def gui():
if pm.window('ByrdRigs_interface_toolset', q=1, exists=1):
pm.deleteUI('ByrdRigs_interface_toolset')
#ByrdRigs_interface_toolset
win_width = 240
window_object = pm.window('ByrdRigs_interface_toolset', title="ByrdRigs' Toolset", w=win_width, bgc=window_bgc)
main_layout = pm.columnLayout()
'''
Clean Up Geo and Controls
'''
pm.frameLayout(w=win_width, l='Clean Up', bgc=color_1, cl=1, cll=1, ann='Clean Up', cc=windowResize)
pm.rowColumnLayout(w=win_width)
pm.iconTextButton('delete_histroy', w=166, st='iconAndTextHorizontal', image1='DeleteHistory.png',l='Delete History', c=deleteHistory)
pm.iconTextButton(w=166, st='iconAndTextHorizontal', image1='CenterPivot.png',l='Center Pivot', c=centerPivot)
pm.iconTextButton(w=166, st='iconAndTextHorizontal', image1='FreezeTransform.png',l='Freeze Transforms', c=freezeTransform)
pm.setParent(main_layout)
pm.separator(w=win_width, bgc=color_1, st='in')
'''
Visibility
'''
pm.frameLayout(w=win_width, l='Visibility', bgc=color_2, cl=1, cll=1, ann='Change Visibility', cc=windowResize)
pm.rowColumnLayout(nc=3, cw=[[1, win_width*.5], [2, win_width*.25],[3, win_width*.25]])
pm.text(l='Show')
pm.button(l='All', c=showAll)
pm.button(l='None', c=showNone)
pm.text(l='Poly Vis')
pm.button(l='On', c=polyOn)
pm.button(l='Off', c=polyOff)
pm.text(l='Poly Only Vis')
pm.button(l='On', c=polyOnlyOn)
pm.button(l='Off', c=polyOnlyOff)
pm.text(l='Joints')
pm.button(l='On', c=jointsOn)
pm.button(l='Off', c=jointsOff)
pm.text(l='X-Ray Joints')
pm.button(l='On', c=xRayOn)
pm.button(l='Off', c=xRayOff)
pm.text(l='Wire Shaded')
pm.button(l='On', c=wireOn)
pm.button(l='Off', c=wireOff)
pm.text(l='NURBS Curves')
pm.button(l='On', c=curvesOn)
pm.button(l='Off', c=curvesOff)
pm.text(l='NURBS Surfaces')
pm.button(l='On', c=surfacesOn)
pm.button(l='Off', c=surfacesOff)
pm.text(l='DAG')
pm.button(l='On', c=dagOn)
pm.button(l='Off', c=dagOff)
pm.setParent(main_layout)
pm.separator(w=win_width, bgc=color_2, st='in')
'''
Tools
'''
pm.frameLayout(w=win_width, l='Tools', bgc=color_3, cl=1, cll=1, ann='Different Tools', cc=windowResize)
pm.columnLayout()
pm.iconTextButton(w=win_width, st='iconAndTextHorizontal', image1='kinJoint.png', l='Create Joint Tool', c=jointTool)
pm.iconTextButton(w=win_width, st='iconAndTextHorizontal', image1='menuIconDisplay.png', l='Joint Size', c=jointSize)
pm.iconTextButton(w=win_width, st='iconAndTextHorizontal', image1='kinInsert.png', l='Insert Joint', c=insertJoint)
pm.iconTextButton(w=win_width, st='iconAndTextHorizontal', image1='menuIconDisplay.png', l='IK Handle Size', c=IkSize)
pm.iconTextButton(w=win_width, st='iconAndTextHorizontal', image1='BR_icons/BR_diagram.png', l='Select Hierarchy', c=hierarchy)
pm.iconTextButton(w=win_width, st='iconAndTextHorizontal', image1='BR_icons/BR_renamerIcon.svg', l='Renamer', c=renamerWindow)
pm.iconTextButton(w=win_width, st='iconAndTextHorizontal', image1='circle.png', l='Curve Tool Window', c=curveWindow)
pm.separator(w=win_width, bgc=color_3, st='in')
pm.rowColumnLayout(nc=3, cw=[[1, win_width*.5], [2, win_width*.25],[3, win_width*.25]])
pm.text(l='Mirror Joints')
pm.button(l='B' , c=mirrorToolB)
pm.button(l='Ori', c=mirrorToolO)
pm.text(l='IK Handle Tool')
pm.button(l='RP', c=RP_IkHandle)
pm.button(l='SC', c=SC_IkHandle)
pm.text(l='Padding')
pm.button(l='Jnt' , c=jointPadding)
pm.button(l='Ctrl', c=ctrlPadding)
pm.button(l='Mirror Ctrl' , c=mirrorIcon)
pm.setParent(main_layout)
pm.separator(w=win_width, bgc=color_3, st='in')
'''
Constraints
'''
pm.frameLayout(w=win_width, l='Constraints', bgc=color_4, cl=1, cll=1, ann='Constraints', cc=windowResize)
pm.rowColumnLayout(nc=4, cw=[[1, win_width*.25], [2, win_width*.25],[3, win_width*.25], [4, win_width*.25]])
pm.text(l='Parent MO')
pm.button(l='On', c=parentConstraint_on)
pm.button(l='Off', c=parentConstraint_off)
pm.button(l='Temp', c=parentConstraint_temp)
pm.text(l='Point MO')
pm.button(l='On', c=pointConstraint_on)
pm.button(l='Off', c=pointConstraint_off)
pm.button(l='Temp', c=pointConstraint_temp)
pm.text(l='Orient MO')
pm.button(l='On', c=orientConstraint_on)
pm.button(l='Off', c=orientConstraint_off)
pm.button(l='Temp', c=orientConstraint_temp)
pm.button(w=win_width, l='Pole Vector', c=poleVector)
pm.setParent(main_layout)
pm.separator(w=win_width, bgc=color_4, st='in')
'''
Bipeds
'''
pm.frameLayout(w=win_width, l='Bipeds', bgc=color_5, cl=1, cll=1, ann='Biped Tools', cc=windowResize)
biped_layout = pm.columnLayout(w=win_width)
pm.text(l="This is a biped auto rigger, it doesn't do weight painting. It is only a body rigger, there is no facial rigging done", ww=1, w=win_width)
pm.button(l='Auto-Rig Window', bgc=color_6, w=win_width, c=autoRig)
pm.setParent(main_layout)
pm.separator(w=win_width, bgc=color_5, st='in')
'''
Quadrupeds
'''
quad_layout = pm.frameLayout(w=win_width, l='Quadrupeds', bgc=color_6, cl=1, cll=1, ann='Quadruped Tools', cc=windowResize )
pm.setParent(quad_layout)
pm.text(l='Coming Soon - In Testing', w=win_width)
# pm.frameLayout(w=win_width, l='Hind Legs', bgc=(color_7), cl=1, cll=1, cc=windowResize)
# pm.text(l='orientation_h(Leg, LegIK, then LegFK)', w=win_width, al='center')
# pm.button(l='Hind IK/FK/Helper Joints',w=win_width, ann='Creates leg ik/fk/helper joint chains', c=quad_hLeg_joints)
# pm.text(l='Select the bind, ik, helper, and fk joints', w=win_width)
# pm.button(l='hLeg IK/FK System', w=win_width, ann='Sets up the hind leg IK/FK systems', c=quad_hIKFK_system)
# pm.rowColumnLayout(nc=3, cw=[[1, win_width*.5], [2, win_width*.25],[3, win_width*.25]])
# pm.text(l='Leg SDKs')
# pm.button(l='lt', c=lt_hLeg_SDKs)
# pm.button(l='rt', c=rt_hLeg_SDKs)
pm.setParent(main_layout)
pm.separator(w=win_width, bgc=color_6, st='in')
'''
Zero Out Attributes
'''
pm.frameLayout(w=win_width, l='Zero Out', bgc=color_7, cl=1, cll=1, ann='Zero Out the Attributes to defaults', cc=windowResize)
pm.columnLayout()
pm.button(l='Human Foot Attributes', w=win_width, c=setZeroHumanFoot, ann='Sets Custom Foot Attributes back to defaults')
pm.separator(w=win_width, bgc=(tab_bgc), st='in')
pm.button(l='Human Hand Attributes', w=win_width, c=setZeroHumanHand, ann='Sets Custom Hand Attributes back to defaults')
pm.separator(w=win_width, bgc=(tab_bgc), st='in')
pm.rowColumnLayout(nc=3, cw=[[1, 80], [2, 80],[3, 80]])
pm.button(l='Translate', c=setZeroTr)
pm.button(l='Rotate', c=setZeroRo)
pm.button(l='Scale', c=setZeroSc)
pm.setParent(main_layout)
pm.separator(w=win_width, bgc=color_7, st='in')
pm.window('ByrdRigs_interface_toolset', e=1, wh=(240, 110), rtf=1)
pm.showWindow(window_object)
print('Window Created:', window_object)
def deleteHistory(*args):
pm.delete(ch=1)
# print 'History Deleted'
def centerPivot(*args):
pm.xform(cpc=1)
# print 'Selected pivot centered.'
def freezeTransform(*agrs):
pm.makeIdentity(apply=1, t=1, r=1, s=1, n=0, pn=1)
# print 'Transform Frozen'
def lock_and_hide(icon, attrs):
for current_attr in attrs:
attr = icon.attr(current_attr)
attr.set(lock=1, keyable=0)
def lockAttrs(icon, attrs):
for current_attr in attrs:
attr = icon.attr(current_attr)
attr.set(lock=1)
def unlock_and_unhide(icon, attrs):
for current_attr in attrs:
attr = icon.attr(current_attr)
attr.set(lock=0, keyable=1)
def unlockAttrs(icon, attrs):
for current_attr in attrs:
attr = icon.attr(current_attr)
attr.set(lock=0)
panel_1 = 'modelPanel1'
panel_2 = 'modelPanel2'
panel_3 = 'modelPanel3'
panel_4 = 'modelPanel4'
show_1 = 'MainPane|viewPanes|modelPanel1|modelPanel1|menu14'
show_2 = 'MainPane|viewPanes|modelPanel2|modelPanel2|menu18'
show_3 = 'MainPane|viewPanes|modelPanel3|modelPanel3|menu22'
show_4 = 'MainPane|viewPanes|modelPanel4|modelPanel4|menu26'
def showAll(*args):
print 'Show All'
pm.modelEditor(panel_1, allObjects=1, e=1)
pm.mel.updateShowMenu(show_1, panel_1, "modelPanel1", "Playblast Display")
pm.modelEditor(panel_2, allObjects=1, e=1)
pm.mel.updateShowMenu(show_2, panel_2, "modelPanel2", "Playblast Display")
pm.modelEditor(panel_3, allObjects=1, e=1)
pm.mel.updateShowMenu(show_3, panel_3, "modelPanel3", "Playblast Display")
pm.modelEditor(panel_4, allObjects=1, e=1)
pm.mel.updateShowMenu(show_4, panel_4, "modelPanel4", "Playblast Display")
def showNone(*args):
print 'Show None'
pm.modelEditor(panel_1, allObjects=0, e=1)
pm.mel.updateShowMenu(show_1, panel_1, "modelPanel1", "Playblast Display")
pm.modelEditor(panel_2, allObjects=0, e=1)
pm.mel.updateShowMenu(show_2, panel_2, "modelPanel2", "Playblast Display")
pm.modelEditor(panel_3, allObjects=0, e=1)
pm.mel.updateShowMenu(show_3, panel_3, "modelPanel3", "Playblast Display")
pm.modelEditor(panel_4, allObjects=0, e=1)
pm.mel.updateShowMenu(show_4, panel_4, "modelPanel4", "Playblast Display")
def polyOn(*args):
print 'Polygons visible'
pm.modelEditor(panel_1, e=1, polymeshes=1)
pm.modelEditor(panel_1, e=1, hos=1)
pm.modelEditor(panel_2, e=1, polymeshes=1)
pm.modelEditor(panel_2, e=1, hos=1)
pm.modelEditor(panel_3, e=1, polymeshes=1)
pm.modelEditor(panel_3, e=1, hos=1)
pm.modelEditor(panel_4, e=1, polymeshes=1)
pm.modelEditor(panel_4, e=1, hos=1)
def polyOff(*args):
print 'Polygons hidden'
pm.modelEditor(panel_1, e=1, polymeshes=0)
pm.modelEditor(panel_1, e=1, hos=0)
pm.modelEditor(panel_2, e=1, polymeshes=0)
pm.modelEditor(panel_2, e=1, hos=0)
pm.modelEditor(panel_3, e=1, polymeshes=0)
pm.modelEditor(panel_3, e=1, hos=0)
pm.modelEditor(panel_4, e=1, polymeshes=0)
pm.modelEditor(panel_4, e=1, hos=0)
def polyOnlyOn(*args):
pm.modelEditor(panel_1, allObjects=0, e=1)
pm.mel.updateShowMenu(show_1, panel_1, "modelPanel1", "Playblast Display")
pm.modelEditor(panel_2, allObjects=0, e=1)
pm.mel.updateShowMenu(show_2, panel_2, "modelPanel2", "Playblast Display")
pm.modelEditor(panel_3, allObjects=0, e=1)
pm.mel.updateShowMenu(show_3, panel_3, "modelPanel3", "Playblast Display")
pm.modelEditor(panel_4, allObjects=0, e=1)
pm.mel.updateShowMenu(show_4, panel_4, "modelPanel4", "Playblast Display")
pm.modelEditor(panel_1, e=1, polymeshes=1)
pm.modelEditor(panel_1, e=1, hos=1)
pm.modelEditor(panel_2, e=1, polymeshes=1)
pm.modelEditor(panel_2, e=1, hos=1)
pm.modelEditor(panel_3, e=1, polymeshes=1)
pm.modelEditor(panel_3, e=1, hos=1)
pm.modelEditor(panel_4, e=1, polymeshes=1)
pm.modelEditor(panel_4, e=1, hos=1)
def polyOnlyOff(*args):
pm.modelEditor(panel_1, allObjects=1, e=1)
pm.mel.updateShowMenu(show_1, panel_1, "modelPanel1", "Playblast Display")
pm.modelEditor(panel_2, allObjects=1, e=1)
pm.mel.updateShowMenu(show_2, panel_2, "modelPanel2", "Playblast Display")
pm.modelEditor(panel_3, allObjects=1, e=1)
pm.mel.updateShowMenu(show_3, panel_3, "modelPanel3", "Playblast Display")
pm.modelEditor(panel_4, allObjects=1, e=1)
pm.mel.updateShowMenu(show_4, panel_4, "modelPanel4", "Playblast Display")
def jointsOn(*args):
print 'Joints visible'
pm.modelEditor(panel_1, e=1, joints = 1)
pm.modelEditor(panel_1, e=1, hos = 1)
pm.modelEditor(panel_2, e=1, joints = 1)
pm.modelEditor(panel_2, e=1, hos = 1)
pm.modelEditor(panel_3, e=1, joints = 1)
pm.modelEditor(panel_3, e=1, hos = 1)
pm.modelEditor(panel_4, e=1, joints = 1)
pm.modelEditor(panel_4, e=1, hos = 1)
def jointsOff(*args):
print 'Joints hidden'
pm.modelEditor(panel_1, e=1, joints = 0)
pm.modelEditor(panel_1, e=1, hos = 0)
pm.modelEditor(panel_2, e=1, joints = 0)
pm.modelEditor(panel_2, e=1, hos = 0)
pm.modelEditor(panel_3, e=1, joints = 0)
pm.modelEditor(panel_3, e=1, hos = 0)
pm.modelEditor(panel_4, e=1, joints = 0)
pm.modelEditor(panel_4, e=1, hos = 0)
def xRayOn(*args):
print 'X-Ray Joints visible'
pm.modelEditor(panel_1, e=1, jointXray = 1)
pm.modelEditor(panel_1, e=1, hos = 1)
pm.modelEditor(panel_2, e=1, jointXray = 1)
pm.modelEditor(panel_2, e=1, hos = 1)
pm.modelEditor(panel_3, e=1, jointXray = 1)
pm.modelEditor(panel_3, e=1, hos = 1)
pm.modelEditor(panel_4, e=1, jointXray = 1)
pm.modelEditor(panel_4, e=1, hos = 1)
def xRayOff(*args):
print 'X-Ray Joints hidden'
pm.modelEditor(panel_1, e=1, jointXray = 0)
pm.modelEditor(panel_1, e=1, hos = 0)
pm.modelEditor(panel_2, e=1, jointXray = 0)
pm.modelEditor(panel_2, e=1, hos = 0)
pm.modelEditor(panel_3, e=1, jointXray = 0)
pm.modelEditor(panel_3, e=1, hos = 0)
pm.modelEditor(panel_4, e=1, jointXray = 0)
pm.modelEditor(panel_4, e=1, hos = 0)
def wireOn(*args):
print 'Wireframe on Shaded On'
pm.mel.setWireframeOnShadedOption(1, panel_1)
pm.mel.setWireframeOnShadedOption(1, panel_2)
pm.mel.setWireframeOnShadedOption(1, panel_3)
pm.mel.setWireframeOnShadedOption(1, panel_4)
def wireOff(*args):
print 'Wireframe On Shaded Off'
pm.mel.setWireframeOnShadedOption(0, panel_1)
pm.mel.setWireframeOnShadedOption(0, panel_2)
pm.mel.setWireframeOnShadedOption(0, panel_3)
pm.mel.setWireframeOnShadedOption(0, panel_4)
def curvesOn(*args):
print 'NURBS Curves visible'
pm.modelEditor(panel_1, e=1, nurbsCurves=1)
pm.modelEditor(panel_2, e=1, nurbsCurves=1)
pm.modelEditor(panel_3, e=1, nurbsCurves=1)
pm.modelEditor(panel_4, e=1, nurbsCurves=1)
pm.modelEditor( panel_1, e=1, controllers=1 )
pm.modelEditor( panel_2, e=1, controllers=1 )
pm.modelEditor( panel_3, e=1, controllers=1 )
pm.modelEditor( panel_4, e=1, controllers=1 )
def curvesOff(*args):
print 'NURBS Curves hidden'
pm.modelEditor(panel_1, e=1, nurbsCurves=0)
pm.modelEditor(panel_2, e=1, nurbsCurves=0)
pm.modelEditor(panel_3, e=1, nurbsCurves=0)
pm.modelEditor(panel_4, e=1, nurbsCurves=0)
pm.modelEditor( panel_1, e=1, controllers=0 )
pm.modelEditor( panel_2, e=1, controllers=0 )
pm.modelEditor( panel_3, e=1, controllers=0 )
pm.modelEditor( panel_4, e=1, controllers=0 )
def surfacesOn(*args):
print 'NURBS Surfaces visible'
pm.modelEditor(panel_1, e=1, nurbsSurfaces=1)
pm.modelEditor(panel_2, e=1, nurbsSurfaces=1)
pm.modelEditor(panel_3, e=1, nurbsSurfaces=1)
pm.modelEditor(panel_4, e=1, nurbsSurfaces=1)
def surfacesOff(*args):
print 'NURBS Surfaces hidden'
pm.modelEditor(panel_1, e=1, nurbsSurfaces=0)
pm.modelEditor(panel_2, e=1, nurbsSurfaces=0)
pm.modelEditor(panel_3, e=1, nurbsSurfaces=0)
pm.modelEditor(panel_4, e=1, nurbsSurfaces=0)
def dagOn(*args):
# print('Showing DAG objects')
pm.outlinerEditor('outlinerPanel3', showDagOnly=1, e=1)
def dagOff(*args):
# print('Hiding DAG objects')
pm.outlinerEditor('outlinerPanel3', showDagOnly=0, e=1)
def jointTool(*args):
print 'Joint Tool Active.'
pm.mel.JointTool()
def mirrorToolO(*args):
print 'Mirroring Joints'
selection = pm.ls(sl=1)
for each in selection:
pm.mirrorJoint(each, searchReplace=("lt", "rt"), mirrorYZ=1)
def mirrorToolB(*args):
print 'Mirroring Joints'
selection = pm.ls(sl=1)
for each in selection:
pm.mirrorJoint(each, mirrorBehavior=1,searchReplace=("lt", "rt"), mirrorYZ=1)
def mirrorIcon(*args):
# Get all the icons
pm.select( 'lt*_icon', 'lt*_switch' )
lt_icons = pm.ls( sl=1 )
# print(lt_icons)
tempGrp = pm.group( em=1, n='temp_grp' )
pm.parent( lt_icons, tempGrp )
mirrorGrp = pm.duplicate( tempGrp, n='mirror_grp' )[0]
mirrorGrp.sx.set( -1 )
pm.select(mirrorGrp)
freezeTransform()
pm.parent( lt_icons, w=1 )
pm.delete(tempGrp)
rt_icons = pm.ls( mirrorGrp, dag=1 )
print(rt_icons)
pm.select( lt_icons[0] )
icon = pm.ls( sl=1 )[0]
search= 'lt'
replace= 'rt'
pm.select( rt_icons )
pm.mel.searchReplaceNames(search, replace, "hierarchy")
pm.select( rt_icons )
pm.parent( w=1 )
pm.delete( mirrorGrp )
def jointSize(*args):
print 'Changing Joint Size.'
pm.mel.jdsWin()
def insertJoint(*args):
print 'Joint Tool Active.'
pm.mel.InsertJointTool()
def hierarchy(*args):
print 'Hierarchy Selected'
pm.mel.SelectHierarchy()
def renamerWindow(*args):
pm.mel.source("Quick_rename_tool.mel")
pm.mel.Quick_rename_tool()
def curveWindow(*args):
import BR_Interface_Toolset.BR_curveTool as BR_curveTool
reload(BR_curveTool)
BR_curveTool.curve_gui()
def RP_IkHandle(*args):
print 'RP IK Handle Tool.'
pm.ikHandle()
def SC_IkHandle(*args):
print 'SC IK Handle Tool.'
pm.ikHandle(sol='ikSCsolver')
def IkSize(*args):
print 'Changing IK Handle Size'
pm.mel.ikHdsWin()
def jointPadding(*args):
'''
This creates a world orientated pad on the root joint.
import byrdCheyenne_riggingTools
reload(byrdCheyenne_riggingTools)
byrdCheyenne_riggingTools.padding_tool()
'''
selected = pm.ls(selection=1)
# print 'Current Selected:' , selected
root_joint = selected[0]
# Create empty group
# empty=1 will create an empty group
#
pad = pm.group(empty=1)
# Move group to joint.
# and delete constraint
temp_constraint = pm.pointConstraint(root_joint, pad)
pm.delete(temp_constraint)
# Freeze Transformation on the group.
pm.makeIdentity(pad, apply=1, t=1, r=1, s=1, n=0)
# Parent joint to group
pm.parent(root_joint, pad)
# renaming
# ct_tail_01_bind
# ct_tail_00_pad
pad_name = root_joint.replace('01_bind', '00_pad')
pad.rename(pad_name)
print 'Padding group created.'
def ctrlPadding(*args):
selected = pm.ls(selection=1)
#print 'Current Selected:' , selected
root_joint = selected[0]
local = pm.group(empty=1)
temp_constraint =pm.parentConstraint(root_joint, local)
pm.delete(temp_constraint)
pm.parent(root_joint, local)
local_name = root_joint.replace('_icon', '_local')
# print(local_name)
local.rename(local_name)
def parentConstraint_on(*args):
print 'Parent Constraint with Maintain Offset On'
selection = pm.ls(sl=1)
pm.parentConstraint(selection, mo=1)
def parentConstraint_off(*args):
print 'Parent Constraint with Maintain Offset Off'
selection = pm.ls(sl=1)
pm.parentConstraint(selection, mo=0)
def parentConstraint_temp(*args):
selection = pm.ls(sl=1)
driver = selection[0]
driven= selection[1]
temp_constraint = pm.parentConstraint(driver, driven, mo=0)
pm.delete(temp_constraint)
def pointConstraint_temp(*args):
selection = pm.ls(sl=1)
driver = selection[0]
driven= selection[1]
temp_constraint = pm.pointConstraint(driver, driven, mo=0)
pm.delete(temp_constraint)
def orientConstraint_temp(*args):
selection = pm.ls(sl=1)
driver = selection[0]
driven= selection[1]
temp_constraint = pm.orientConstraint(driver, driven, mo=0)
pm.delete(temp_constraint)
def pointConstraint_on(*args):
print 'Point Constraint with Maintain Offset On'
selection = pm.ls(sl=1)
pm.pointConstraint(selection, mo=1)
def pointConstraint_off(*args):
print 'Point Constraint with Maintain Offset Off'
selection = pm.ls(sl=1)
pm.pointConstraint(selection, mo=0)
def orientConstraint_on(*args):
print 'Orient Constraint with Maintain Offset On'
selection = pm.ls(sl=1)
pm.orientConstraint(selection, mo=1)
def orientConstraint_off(*args):
print 'Orient Constraint with Maintain Offset Off'
selection = pm.ls(sl=1)
pm.orientConstraint(selection, mo=0)
def poleVector(*args):
print 'Pole Vector Constraint'
selection = pm.ls(sl=1)
driver = selection[0]
driven = selection[1]
pm.poleVectorConstraint(driver, driven)
def autoRig(*args):
import BR_Interface_Toolset.BR_biped_AutoRig_setup as BR_biped_setup
reload (BR_biped_setup)
BR_biped_setup.gui()
def quadHind_fkLeg_icons():
'''
Input
What are we working on?
The root joint of the hind fk leg
'''
joint_systems = pm.ls(selection=1)
leg_root = joint_systems[0]
ik_root = joint_systems[1]
helper_root = joint_systems[2]
fk_root = joint_systems[3]
leg_joints = pm.ls(leg_root, dag=1)
ik_joints = pm.ls(ik_root, dag=1)
helper_joints = pm.ls(helper_root, dag=1)
fk_joints = pm.ls(fk_root, dag=1)
print 'Leg System:', leg_joints
print 'IK System:', ik_joints
print 'Helper System:', helper_joints
print 'FK Systems:', fk_joints
leg_root_joint = pm.ls(leg_joints[0])
leg_joint_2 = pm.ls(leg_joints[1])
leg_joint_3 = pm.ls(leg_joints[2])
leg_joint_4 = pm.ls(leg_joints[3])
leg_joint_5 = pm.ls(leg_joints[4])
leg_joint_6 = pm.ls(leg_joints[5])
# print 'Leg root joint:', leg_root_joint
# print '2nd leg joint:', leg_joint_2
# print '3rd leg joint:', leg_joint_3
# print '4th leg joint:', leg_joint_4
# print '5th leg joint:', leg_joint_5
# print '6th leg joint:', leg_joint_6
ik_root_joint = pm.ls(ik_joints[0])
ik_joint_2 = pm.ls(ik_joints[1])
ik_joint_3 = pm.ls(ik_joints[2])
ik_joint_4 = pm.ls(ik_joints[3])
ik_joint_5 = pm.ls(ik_joints[4])
ik_joint_6 = pm.ls(ik_joints[5])
# print 'Leg root joint:', ik_root_joint
# print '2nd ik joint:', ik_joint_2
# print '3rd ik joint:', ik_joint_3
# print '4th ik joint:', ik_joint_4
# print '5th ik joint:', ik_joint_5
# print '6th ik joint:', ik_joint_6
helper_root_joint = pm.ls(helper_joints[0])
helper_joint_2 = pm.ls(helper_joints[1])
helper_joint_3 = pm.ls(helper_joints[2])
helper_joint_4 = pm.ls(helper_joints[3])
# print 'Leg root joint:', helper_root_joint
# print '2nd helper joint:', helper_joint_2
# print '3rd helper joint:', helper_joint_3
# print '4th helper joint:', helper_joint_4
fk_root_joint = pm.ls(fk_joints[0])
fk_joint_2 = pm.ls(fk_joints[1])
fk_joint_3 = pm.ls(fk_joints[2])
fk_joint_4 = pm.ls(fk_joints[3])
fk_joint_5 = pm.ls(fk_joints[4])
fk_joint_6 = pm.ls(fk_joints[5])
# print 'Leg root joint:', fk_root_joint
# print '2nd fk joint:', fk_joint_2
# print '3rd fk joint:', fk_joint_3
# print '4th fk joint:', fk_joint_4
# print '5th fk joint:', fk_joint_5
# print '6th fk joint:', fk_joint_6
'''
Local Controls
'''
'''
Control 1 - root_joint
'''
# Create a control
# Custom Orb Icon
orbCurve_1 = pm.circle(c=(0, 0, 0), ch=1, d=3, ut=0, sw=360, s=8, r=1, tol=0.01, nr=(0, 1, 0))[0]
orbCurve_2 = pm.duplicate(rr=1)[0]
orbCurve_2.rx.set(45)
orbCurve_3 = pm.duplicate(rr=1)[0]
orbCurve_3.rx.set(90)
orbCurve_4 = pm.duplicate(rr=1)[0]
orbCurve_4.ry.set(45)
orbCurve_5 = pm.duplicate(rr=1)[0]
orbCurve_5.ry.set(-45)
pm.makeIdentity(orbCurve_1, orbCurve_2, orbCurve_3, orbCurve_4, orbCurve_5, n=0,s=1,r=1,t=1, apply=1,pn=1)
orbIcon = pm.group(empty=1)
temp_grp = pm.group(orbCurve_1, orbCurve_2, orbCurve_3, orbCurve_4, orbCurve_5)
orbShapes = pm.ls(sl=1, dag=1)
shape_1 = orbShapes[2]
shape_2 = orbShapes[4]
shape_3 = orbShapes[6]
shape_4 = orbShapes[8]
shape_5 = orbShapes[10]
#print 'Shape 1:', shape_1
pm.parent(shape_1, shape_2, shape_3, shape_4, shape_5, orbIcon, s=1, r=1)
pm.delete(temp_grp)
icon_name = leg_root.replace('bind', 'fk_icon')
orbIcon.rename(icon_name)
# Create a group
# Grouping control during the process.
local_pad_1 = pm.group()
# Output control and pad
print 'Orb Created', orbIcon
print 'Local Pad 1 Created', local_pad_1
# Move group over to the target joint
# Delete constraint when finished snapping
temp_constraint = pm.parentConstraint(fk_root_joint, local_pad_1)
pm.delete(temp_constraint)
# Orient constrain the joint to the control
# Driver -> Driven
# Control -> Joint
pm.orientConstraint(orbIcon, leg_root_joint)
print 'Orb 1 Renamed', orbIcon
# Renaming Pad
pad_1 = local_pad_1
pad_1_name = fk_root.replace('01_fk', '01_fk_local')
pad_1.rename(pad_1_name)
print 'Local Pad 1 Renamed', local_pad_1
pm.parent(orbIcon, local_pad_1)
'''
Control 2
'''
# Create a control
# normal = [1, 0, 0], radius=2
control_icon_2 = pm.circle(normal=[1, 0, 0], radius=2)[0]
# Create a group
# Grouping control during the process.
local_pad_2 = pm.group()
# Output control and pad
print 'Control 2 Created', control_icon_2
print 'Local Pad 2 Created', local_pad_2
# Move group over to the target joint
# Delete constraint when finished snapping
temp_constraint = pm.parentConstraint(fk_joint_2, local_pad_2)
pm.delete(temp_constraint)
# Orient constgrain the joint to the control
# Driver -> Driven
# Control -> Joint
pm.orientConstraint(control_icon_2, fk_joint_2)
# Renaming Icon
# control_icon_2
icon_2 = control_icon_2
icon_2_name = fk_root.replace('01_fk', '02_fk_icon')
icon_2.rename(icon_2_name)
print 'Icon 2 Renamed', control_icon_2
# Renaming Pad
pad_2 = local_pad_2
pad_2_name = fk_root.replace('01_fk', '02_fk_local')
pad_2.rename(pad_2_name)
print 'Local Pad 2 Renamed', local_pad_2
'''
Parent controls together
'''
# Pad 2 -> control 1
pm.parent(local_pad_2, orbIcon)
'''
Control 3
'''
# Create a control
# normal = [1, 0, 0], radius=2
control_icon_3 = pm.circle(normal=[1, 0, 0], radius=2)[0]
# Create a group
# Grouping control during the process.
local_pad_3 = pm.group()
# Output control and pad
print 'Control 3 Created', control_icon_3
print 'Local Pad 3 Created', local_pad_3
# Move group over to the target joint
# Delete constraint when finished snapping
temp_constraint = pm.parentConstraint(fk_joint_3, local_pad_3)
pm.delete(temp_constraint)
# Orient constgrain the joint to the control
# Driver -> Driven
# Control -> Joint
pm.orientConstraint(control_icon_3, fk_joint_3)
# Renaming Icon
# control_icon_3
icon_3 = control_icon_3
icon_3_name = fk_root.replace('01_fk', '03_fk_icon')
icon_3.rename(icon_3_name)
print 'Icon 3 Renamed', control_icon_3
# Renaming Pad
pad_3 = local_pad_3
pad_3_name = fk_root.replace('01_fk', '03_fk_local')
pad_3.rename(pad_3_name)
print 'Local Pad 3 Renamed', local_pad_3
'''
Parent controls together
'''
# Pad 3 -> control 1
pm.parent(local_pad_3, control_icon_2)
def quad_hLeg_joints(*args):
joint_system = pm.ls(selection=1, dag=1)
root_joint = joint_system[0]
joint_2 = joint_system[1]
joint_3 = joint_system[2]
joint_4 = joint_system[3]
joint_5 = joint_system[4]
joint_6 = joint_system[5]
pm.duplicate(rr=1)
ik_hJointRenamer()
pm.duplicate(rr=1)
fk_hJointRenamer()
pm.duplicate(rr=1)
helper_hJointRenamer()
def helper_hJointRenamer():
'''
Get Selected
'''
joint_chain = pm.ls(selection=1, dag=1)
'''
Figure out naming convention
'''
ori = raw_input()
system_name = raw_input()
count = 0
suffix = 'helper'
'''
Loop through the joint chain.
'''
for current_joint in joint_chain:
count = count + 1
new_name = '{0},{1},0{2};{3}'.format(ori, system_name, count, suffix)
# Rename joints
current_joint.rename(new_name)
new_name = '{0},{1},0{2};{3}'.format(ori,system_name,count, 'helper')
joint_system = pm.ls(selection=1, dag=1)
root_joint = joint_system[0]
joint_2 = joint_system[1]
joint_3 = joint_system[2]
joint_4 = joint_system[3]
joint_5 = joint_system[4]
joint_6 = joint_system[5]
pm.delete(joint_5)
def quad_hIKFK_system(*args):
joint_systems = pm.ls(selection=1)
leg_root = joint_systems[0]
ik_root = joint_systems[1]
helper_root = joint_systems[2]
fk_root = joint_systems[3]
leg_joints = pm.ls(leg_root, dag=1)
ik_joints = pm.ls(ik_root, dag=1)
helper_joints = pm.ls(helper_root, dag=1)
fk_joints = pm.ls(fk_root, dag=1)
print 'Leg System:', leg_joints
print 'IK System:', ik_joints
print 'Helper System:', helper_joints
print 'FK Systems:', fk_joints
leg_root_joint = pm.ls(leg_joints[0])
leg_joint_2 = pm.ls(leg_joints[1])
leg_joint_3 = pm.ls(leg_joints[2])
leg_joint_4 = pm.ls(leg_joints[3])
leg_joint_5 = pm.ls(leg_joints[4])
leg_joint_6 = pm.ls(leg_joints[5])
# print 'Leg root joint:', leg_root_joint
# print '2nd leg joint:', leg_joint_2
# print '3rd leg joint:', leg_joint_3
# print '4th leg joint:', leg_joint_4
# print '5th leg joint:', leg_joint_5
# print '6th leg joint:', leg_joint_6
ik_root_joint = pm.ls(ik_joints[0])
ik_joint_2 = pm.ls(ik_joints[1])
ik_joint_3 = pm.ls(ik_joints[2])
ik_joint_4 = pm.ls(ik_joints[3])
ik_joint_5 = pm.ls(ik_joints[4])
ik_joint_6 = pm.ls(ik_joints[5])
# print 'Leg root joint:', ik_root_joint
# print '2nd ik joint:', ik_joint_2
# print '3rd ik joint:', ik_joint_3
# print '4th ik joint:', ik_joint_4
# print '5th ik joint:', ik_joint_5
# print '6th ik joint:', ik_joint_6
helper_root_joint = pm.ls(helper_joints[0])
helper_joint_2 = pm.ls(helper_joints[1])
helper_joint_3 = pm.ls(helper_joints[2])
helper_joint_4 = pm.ls(helper_joints[3])
# print 'Leg root joint:', helper_root_joint
# print '2nd helper joint:', helper_joint_2
# print '3rd helper joint:', helper_joint_3
# print '4th helper joint:', helper_joint_4