-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathJoint_on_Curve.py
102 lines (35 loc) · 1.54 KB
/
Joint_on_Curve.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
# First run all script and select Curve and Run CurveJnt()
import maya.cmds as cmds
def CurveJnt():
selection01 = cmds.ls( sl = True)
selection01 = cmds.ls( sl = True)
if cmds.objExists(selection01[0]+'_Jnt*'):
cmds.select(selection01[0]+'_Jnt*')
cmds.delete()
cmds.select(selection01[0], r = True)
if len(selection01) == 1:
'%s' %(selection01[0])
cmds.duplicate(rr = True)
cmds.makeIdentity( apply=True )
selection = cmds.ls( sl = True)
selectionShape = cmds.pickWalk(d = 'down')
cmds.select(cl= True)
'%s' %(selection[0])
cvs = cmds.getAttr(selection[0]+'.cp',s=1)
StartWdZero = cvs
i = 0
while i < StartWdZero:
controlPoints = 'controlPoints['+('%s' %(i))+']'
Xvalue = cmds.getAttr (selectionShape[0]+"."+ controlPoints+ ".xValue")
Yvalue = cmds.getAttr (selectionShape[0]+"."+ controlPoints+ ".yValue")
Zvalue = cmds.getAttr (selectionShape[0]+"."+ controlPoints+ ".zValue")
cmds.joint(n = selection01[0]+'_Jnt_', p = (Xvalue,Yvalue,Zvalue))
cmds.select(cl= True)
i = i + 1
cmds.select(selection[0], r = True)
cmds.Delete()
else:
cmds.error('Select one Curve at a time ')
#addnew thing...
#parent or not parent joints
#joint or somthing else to create