This is example just to discover operations over meshes in the retop room.
This is example just to discover operations over meshes in the retop room. There we create random spheres in retopo rool, delete one of groups, select random faces, extrude them and move along normals.
1
2
3from coat import *
4import random
5
6
7ui.toRoom("Retopo")
8
9ui.cmd("$TopToolSelectAndOperate")
10
11
12mesh = Model.fromRetopo()
13
14mesh.clear()
15
16sphere = Mesh.sphere(radius = 20)
17mesh += sphere
18
19
20n = mesh.facesCount()
21print("Faces count: " + str(n))
22for i in range(0, int(n / 6)):
23 index = int(random.random() * n)
24
25 mesh.selectFace(index)
26
27for i in range(0, 12):
28 mesh.extrudeSelected()
29 mesh.moveSelectedFacesAlongFacesNormals(5)
30 shift = vec3.RandNormal() + vec3.AxisNegY * i/2
31 mesh.transformSelected(mat4.Translation(shift), False)
32 mesh.scaleSelectedFacesClusters(0.7)
33
34mesh.unselectAllFaces()