-
Notifications
You must be signed in to change notification settings - Fork 0
/
SkinTransfer
148 lines (74 loc) · 3.18 KB
/
SkinTransfer
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
#################################################################
###################### SkinTransfer ########################
#################################################################
#Author:Siddarth Mehra
#Email:[email protected]
#Mobile: +91-7728050400(Whatsapp)
#Copy&Run
import maya.cmds as cmds
import maya.mel as mel
def sknTransferUI():
if cmds.window('SkinTransfer', exists=True ):
cmds.deleteUI( 'SkinTransfer', window=True )
if cmds.windowPref('SkinTransfer', exists=True ):
cmds.windowPref( 'SkinTransfer', r=True )
cmds.window('SkinTransfer', title='Skin Transfer', iconName='Short Name', widthHeight=(336,150),s=0 )
form = cmds.formLayout(numberOfDivisions=100,bgc =[(.294),(.294),(.294)])
source = cmds.textField('sourcetxf',w=150,h=40)
destination = cmds.textScrollList('asd',h=40,w=150)
sourceButton = cmds.button(l='Source',w=150,bgc =[(.394),(.394),(.394)],c='sourceobjs()')
destinationButton = cmds.button(l='Destination',w=150,bgc =[(.394),(.394),(.394)],c='destinationObjs()')
transfer = cmds.button(l='Transfer',w=310,bgc =[(.2),(.5),(.4)],h=25,c='Transfer()')
author = cmds.symbolButton(i='UV_Freeze_Tool.png',c='author()')
cmds.formLayout(form,edit=True,attachForm=[
(source,'top',10),
(destination,'top',11),
(sourceButton,'top',60),
(destinationButton,'top',60),
(transfer,'top',91),
(author,'top',120),
(source,'left',12),
(destination,'left',12),
(sourceButton,'left',12),
(destinationButton,'left',12),
(transfer,'left',12),
(author,'left',302),
],
attachControl=[
(destination, 'left', 10, source),
(sourceButton, 'bottom', 20, source),
(destinationButton, 'left', 10, sourceButton),
]
)
cmds.showWindow('SkinTransfer')
objlst=[]
sourceobjctlst=[]
def sourceobjs():
print 'f'
sel = cmds.ls(sl=True)
cmds.textField('sourcetxf',e=True,tx=str(sel[0]),ed=0)
sourceobjctlst.append(sel[0])
def destinationObjs():
cmds.textScrollList('asd',e=True,ra=True)
destsel = cmds.ls(sl=True)
for i in destsel:
cmds.textScrollList('asd',e=True,a=i)
objlst.append(i)
def Transfer():
cmds.select(cl=True)
sel = str(sourceobjctlst[0])
a = mel.eval("findRelatedSkinCluster("+'"'+sel+'"'+")")
infJnts=cmds.skinCluster(a,q=True,wi=True)
cmds.select(infJnts,r=True)
for i in objlst:
try:
cmds.skinCluster(i,e=True,ub=True)
except:
pass
b = cmds.skinCluster(infJnts,i,mi=5)
cmds.select(sel,i)
mel.eval("copySkinWeights -noMirror -surfaceAssociation closestPoint -influenceAssociation closestJoint -normalize;")
cmds.select(cl=True)
def author():
cmds.launch(web='https://www.facebook.com/sidmehraajm/')
sknTransferUI()