728x90
2019. 3. 13. 10:39
드디어, 어떻게 미러링하는지를 알게 되었다.
I finally got how to mirror.
잎의 수를 늘리고, 더 큰 별을 달아주었다.
more and tinier leaves, a big star
import pymel.core as pm
import random
myPyramids = []
#make pyramids
for n in range (2872):
myPyramids.append(pm.polyPyramid())
count = 0
for x in range (20):
yran = 20 - x
for y in range (yran):
zran = 20 - y
for z in range (zran):
pm.select(myPyramids[count])
pm.move(0.05*x*x, y, 0.05*z*z) #curve
pm.scale(0.5, 0.5, 0.5)
rg = int(random.random()*10)%2 #red or green?
if (rg): #green
pm.polyColorPerVertex(colorRGB=[0, 1-random.random(), 0], colorDisplayOption=True)
else: #red
pm.polyColorPerVertex(colorRGB=[1-random.random(), 0, 0], colorDisplayOption=True)
pm.rotate(x*10.0, y*10.0, z*10.0)
pm.polyMirrorFace(direction=0, mergeMode=1)
pm.polyMirrorFace(direction=4, mergeMode=1)
count = count + 1
#star 1
pm.select(myPyramids[count])
pm.move(0, 20.1, 0.2)
pm.scale(1, 1, 1)
pm.rotate(0, 90, 0)
pm.polyColorPerVertex(colorRGB=[1,1,0], colorDisplayOption=True)
count = count + 1
#star 2
pm.select(myPyramids[count])
pm.move(0, 20.1, -0.2)
pm.scale(1, 1, 1)
pm.rotate(45, 270, 0)
pm.polyColorPerVertex(colorRGB=[1,1,0], colorDisplayOption=True)
* The completed codes are in my github: github.com/shinerd/Maya
728x90
댓글