Programare Python Maya polyPlanarProjection

Script Example 1

#create a new blinn shader with a bitmap image
#Create a polygonal sphere
#select 100 faces and apply the planar projection to them
#apply the shader to all these faces

import maya.cmds as cmds
cmds.polySphere()
for i in range(100):
    cmds.select(‘pSphere1.f[%d]’%i)

    cmds.polyPlanarProjection(‘pSphere1.f[%d]’%i,md=’b’)
    cmds.hyperShade(assign=’blinn1′)

Script Example 2

for i in range(10):
for j in range(10):
cmds.polyCube()
cmds.move(i,j,0)
k=i*10+j+1
cmds.polyPlanarProjection('pCube%d.f[0]'%k,icx=0.05+i/10.0,icy=0.05+j/10.0,isu=.1,isv=.1)
cmds.hyperShade(assign='blinn1')
cmds.setKeyframe(at='rotateY',t=['0sec'],v=0)
cmds.setKeyframe(at='rotateY',t=['20sec'],v=90)

We create 100 cubes,use a bitmap image on a blinn shader, divide the image, apply the small pieces on the cubes, and rotate the cubes.