-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathShading using python in maya
More file actions
142 lines (97 loc) · 3.6 KB
/
Copy pathShading using python in maya
File metadata and controls
142 lines (97 loc) · 3.6 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
136
137
138
139
140
141
142
---------------------------------------
import maya.cmds as sb
sb.polyCube(n='a',w=2,d=2)
myshader=sb.shadingNode('lambert',asShader=1)
sb.setAttr(myshader+'.color',0.7,0.3,0.5,type='double3')
sb.select('a')
sb.hyperShade(assign=myshader)
---------------------------------------
import maya.cmds as sb
myshadeR=sb.shadingNode('lambert',asShader=1,n='R')
sb.setAttr(myshadeR+'.color',1,0,0,type='double3')
myshadeG=sb.shadingNode('lambert',asShader=1,n='G')
sb.setAttr(myshadeG+'.color',0,1,0,type='double3')
myshadeB=sb.shadingNode('lambert',asShader=1,n='B')
sb.setAttr(myshadeB+'.color',0,0,1,type='double3')
sb.polyCone(n='ff')
sb.hyperShade(assign='R')
sb.polyCone(n='dd')
sb.hyperShade(assign='R')
sb.move(3,0,0)
-------------------------------------------
import maya.cmds as sb
myshadeR=sb.shadingNode('lambert',asShader=1,n='R')
sb.setAttr(myshadeR+'.color',1,0,0,type='double3')
myshadeG=sb.shadingNode('lambert',asShader=1,n='G')
sb.setAttr(myshadeG+'.color',0,1,0,type='double3')
myshadeB=sb.shadingNode('lambert',asShader=1,n='B')
sb.setAttr(myshadeB+'.color',0,0,1,type='double3')
sb.polyCone(n='ff')
sb.hyperShade(assign='R')
sb.setAttr('R.transparency',0.5,0.5,0.5,type='double3')
sb.setAttr('R.glowIntensity',0.1)
sb.setAttr('R.translucence',0.2)
---------------------------------------------
import maya.cmds as sb
shaderMix=['lambert','blinn','phong' ]
mLam=sb.shadingNode(shaderMix[0],asShader=1,n='MRedLam')
sb.setAttr(mLam+'.color',1,0,0,type='double3')
mBli=sb.shadingNode(shaderMix[1],asShader=1,n='MRedBli')
sb.setAttr(mBli+'.color',1,0,0,type='double3')
mPho=sb.shadingNode(shaderMix[2],asShader=1,n='MRedPho')
sb.setAttr(mPho+'.color',1,0,0,type='double3')
sb.polyCube(n='a')
sb.hyperShade(assign='MRedLam')
sb.polyCube(n='b')
sb.move(1,0,0)
sb.hyperShade(assign='MRedBli')
sb.polyCube(n='c')
sb.move(2,0,0)
sb.hyperShade(assign='MRedPho')
sb.polyPrism(n='mprism',ns=3,w=5)
--------------------------------------------------
import maya.cmds as sb
import random
top=sb.shadingNode('blinn',asShader=1,n='head1')
sb.setAttr(top+'.color',0,1,0,type='double3')
middle=sb.shadingNode('phong',asShader=1,n='body1')
sb.setAttr(middle+'.color',0.54,0.27,0.074,type='double3')
storus=sb.shadingNode('blinn',asShader=1,n='ring1')
sb.setAttr(storus+'.color',0,0,1,type='double3')
py=sb.shadingNode('blinn',asShader=1,n='base1')
sb.setAttr(py+'.color',0,1,0,type='double3')
sb.polyCylinder(n='body',r=0.1,h=3)
sb.hyperShade(assign='body1')
sb.polySphere(n='head',r=0.5)
sb.move(0,2,0)
sb.hyperShade(assign='head1')
sb.polyTorus(n='ring',sr=0.1,r=0.2)
sb.move(0,1,0)
sb.hyperShade(assign='ring1')
sb.polyPyramid(n='pyramid')
sb.move(0,-1.5,0)
sb.hyperShade(assign='base1')
sb.setAttr('head1.glowIntensity',0.05)
sb.setAttr('ring1.glowIntensity',0.3)
sb.setAttr('base1.glowIntensity',0.0005)
sb.group('body','head','ring','pyramid',n='new')
for i in range(0,25):
sb.duplicate()
sb.move(random.randrange(-20,20),0,random.randrange(-20,20))
--------------------------------------------------
#last class
import maya.cmds as sb
sb.polyPlane(n='plane')
for i in range(0,100,2):
if(i/10)%2==0:
myShaderr=sb.shadingNode('lambert',asShader=1,n='red')
sb.setAttr(myShaderr+'.color',1,0,0,type='double3')
sb.select('plane.f['+str(i)+']',add=1)
sb.polyExtrudeFacet(kft=0,ltz=0.02)
sb.hyperShade(a=myShaderr)
else:
myShaderb=sb.shadingNode('lambert',asShader=1,n='blue')
sb.setAttr(myShaderb+'.color',0,0,1,type='double3')
sb.select('plane.f['+str(i+1)+']',add=1)
sb.hyperShade(a=myShaderb)
-----------------------------------------------