3DCoat Python API
The 3DCoat Python API documentation.
Loading...
Searching...
No Matches
uv_to_sculpt.py

Get UV-s from the UV room and convert them to the sculpt room objects.

Get UV-s from the UV room and convert them to the sculpt room objects

1import coat
2
3# go to the uv-room to set the context
5n_sets = coat.uv.uvSetsCount()
6print("n_sets: " + str(n_sets) + "\n")
7
8# run through all uv-sets
9for s in range(n_sets):
10 n_islands = coat.uv.islandsCount(s)
11 # run through all islands
12 for i in range(n_islands):
13 print("uv_" + str(s) + "_island_"+str(i))
14 # convert the island to a mesh
15 island_mesh = coat.uv.islandToMesh(s,i)
16 # create a volume and add the mesh to it
17 v = coat.Scene.sculptRoot().addChild("uv_" + str(s) + "_island_"+str(i)).Volume()
18 # turn the volume to surface mode
19 v.toSurface()
20 # add some thickness to the mesh, just for pretty look
21 island_mesh.shell(0.02, 0.02, 4)
22 # we scale 100X to make the mesh well visible
23 island_mesh.toVolume(v, coat.mat4.Scaling(100))
24
25# go to the sculpt-room, see the result
26coat.ui.toRoom("Sculpt")
SceneElement sculptRoot()
get the root of all sculpt objects
Definition coat.py:2687
mat4 Scaling(float XYZ)
Definition coat.py:578
toRoom(str name, bool Force=False)
switch to the room
Definition coat.py:3284
int islandsCount(int uv_set)
get the islands count over the current uv-set
Definition coat.py:3971
int uvSetsCount()
get the UV-sets count.
Definition coat.py:3954
Mesh islandToMesh(int uv_set, int island_index)
get the mesh that contains the island, xy of each point is the UV coordinate.
Definition coat.py:3977