3DCoat Python API
The 3DCoat Python API documentation.
|
Public Member Functions | |
__init__ (self) | |
__init__ (self) | |
__init__ (self, Mesh m) | |
__init__ (self, any m) | |
Mesh | __assign__ (self, Mesh m) |
Mesh | __assign__ (self, any m) |
Mesh | MakeCopy (self) |
bool | Read (self, str name) |
Load the mesh from the file. | |
bool | Write (self, str name) |
Save the mesh to file. | |
bool | valid (self) |
Check if mesh is valid. | |
clear (self) | |
clear the mesh | |
Mesh | __iadd__ (self, Mesh m) |
Mesh | __iadd__ (self, any m) |
addTransformed (self, Mesh m, mat4 t) | |
concatenate the transformed mesh with the current one | |
boolean (self, Mesh m, BoolOpType op) | |
boolean operation | |
transform (self, mat4 transform) | |
transform the mesh | |
rotateToXYAxis (self, vec3 axisX, vec3 axisY) | |
rotate the mesh so that X axis will be aligned with axisX, Y axis will be aligned with axisY | |
rotateToYZAxis (self, vec3 axisY, vec3 axisZ) | |
rotate the mesh so that Y axis will be aligned with axisY, Z axis will be aligned with axisZ | |
rotateToZXAxis (self, vec3 axisZ, vec3 axisX) | |
rotate the mesh so that Z axis will be aligned with axisZ, X axis will be aligned with axisX | |
int | vertsCount (self) |
returns the amount of verts in the mesh | |
int | vertsUvCount (self) |
returns the amount of UV - verts in the mesh | |
int | vertsNormalCount (self) |
returns the amount of normal - verts in the mesh | |
int | facesCount (self) |
returns the faces amount | |
vec3 | getVertex (self, int idx) |
get the vertex coordinate | |
setVertex (self, int idx, vec3 v) | |
set the vertex coordinate | |
int | createNewVertex (self, vec3 position) |
create the positional vertex | |
vec2 | getVertexUV (self, int idx) |
get the UV coordinate of the vertex, pay attention position verts and UV verts are different, they have different indices | |
setVertexUV (self, int idx, vec2 v) | |
set the UV coordinate of the vertex, pay attention position verts and UV verts are different, they have different indices | |
int | createNewUvVertex (self, vec2 uv) |
create new UV vertex to be used for faces | |
vec3 | getVertexNormal (self, int idx) |
get the normal of the vertex, pay attention position verts and normal verts are different, they have different indices | |
setVertexNormal (self, int idx, vec3 v) | |
set the normal of the vertex, pay attention position verts and normal verts are different, they have different indices | |
calcNormals (self) | |
re-calculate normals over the mesh | |
calcNormalsIgnoreSharpEdges (self) | |
re-calculate normals over the mesh, ignore the sharp edges | |
int | getFaceVertsCount (self, int face) |
get the amount of vertices over the face | |
int | getFaceUvVertsCount (self, int face) |
get the amount of UV vertices over the face | |
int | getFaceVertex (self, int faceIndex, int faceVertexIndex) |
get the positional vertex index over the face | |
list | getFaceVerts (self, int face) |
get the list of UV vertex indices over the face, pay attention UV vertices are not same as position vertices | |
setFaceVerts (self, int face, list vertices) | |
set the list of positional vertex indices over the face | |
int | getFaceUvVertex (self, int faceIndex, int faceVertexIndex) |
get the UV vertex index over the face | |
setFaceUvVertex (self, int faceIndex, int faceVertexIndex, int uvVertexIndex) | |
set the UV vertex index over the face | |
int | getFaceNormalVertex (self, int faceIndex, int faceVertexIndex) |
get the normal vertex index over the face | |
setFaceNormalVertex (self, int faceIndex, int faceVertexIndex, int normalVertexIndex) | |
set the normal vertex index over the face | |
list | getFaceUvVerts (self, int face) |
get the list of UV vertices indices over the face | |
int | getFaceObject (self, int faceIndex) |
get the object index over the face, see the getObjectsCount(), getObjectName() | |
setFaceObject (self, int faceIndex, int objectIndex) | |
set the object index for the face, see the getObjectsCount(), getObjectName() | |
int | getFaceMaterial (self, int faceIndex) |
get the material index over the face, see the getMaterialsCount(), getMaterialName() | |
setFaceMaterial (self, int faceIndex, int materialIndex) | |
set the material index over the face, see the getMaterialsCount(), getMaterialName() | |
int | getObjectsCount (self) |
returns the objects count in the mesh | |
str | getObjectName (self, int idx) |
get the name of the object | |
setObjectName (self, int idx, str name) | |
set object name | |
int | addObject (self, str name) |
add new object to the mesh | |
removeObject (self, int idx) | |
remove object from the mesh | |
unifyAllObjects (self, str name="") | |
unify all objects in the mesh, i.e. | |
int | getMaterialsCount (self) |
get the materials count in the mesh | |
int | addMaterial (self, str name) |
add new material to the mesh | |
removeMaterial (self, int idx) | |
remove the material (and corresponding faces) from the mesh | |
str | getMaterialName (self, int idx) |
get the name of the material | |
setMaterialName (self, int idx, str name) | |
set material name | |
str | getMaterialTexture (self, int idx, int texture_layer) |
get the texture name of the material | |
setMaterialTexture (self, int idx, int texture_layer, str texture_path) | |
set the texture layer filename of the material | |
fromVolume (self, Volume v, bool with_subtree=False, bool all_selected=False) | |
extract the mesh from the volume | |
fromReducedVolume (self, Volume v, float reduction_percent, bool with_subtree=False, bool all_selected=False) | |
extract the mesh from the volume and reduce it by the given percent | |
fromVolumeWithMaxPolycount (self, Volume v, int max_polycount, bool with_subtree=False, bool all_selected=False) | |
extract the mesh from the volume and reduce to the given polycount | |
toVolume (self, Volume v, mat4 transform=mat4.Identity, BoolOpType op=BoolOpType.BOOL_MERGE) | |
merge this mesh to the volume object | |
insertInVolume (self, Volume v, mat4 transform=mat4.Identity) | |
insert without boolean operation, if the volume is not in surface mode (volumetric) the boolean ADD will be performed anyway | |
addToVolume (self, Volume v, mat4 transform=mat4.Identity) | |
boolean add to volume | |
subtractFromVolume (self, Volume v, mat4 transform=mat4.Identity) | |
boolean subtraction of the mesh from the volume | |
intersectWithVolume (self, Volume v, mat4 transform=mat4.Identity) | |
boolean intersection of the mesh with the volume | |
fromRetopo (self) | |
take the whole mesh from the retopo room | |
fromPaintRoom (self) | |
get the mesh from the paint room | |
reduceToPolycount (self, int destination_triangles_count) | |
reduce the mesh to the given polycount, mesh will be triangulated | |
triangulate (self) | |
triangulate the mesh | |
booleanOp (self, Mesh With, BoolOpType op) | |
Perform the boolean operation with the given mesh. | |
list | getMeshVertices (self) |
get the list of all positional vertices of the mesh | |
list | getMeshNormals (self) |
get the list of all normal vertices of the mesh | |
list | getMeshUVs (self) |
get the list of all UV vertices of the mesh | |
setMeshVertices (self, list positions) | |
set the list of all positional vertices for the mesh | |
setMeshNormals (self, list normals) | |
set the list of all normal vertices for the mesh | |
setMeshUVs (self, list uvs) | |
set the list of all UV vertices for the mesh | |
setMeshFaces (self, list faces) | |
set the complete list of faces for the mesh | |
addMeshVertices (self, list positions) | |
add the list of all positional vertices for the mesh | |
addMeshNormals (self, list normals) | |
add the list of all normal vertices for the mesh | |
addMeshUVs (self, list uvs) | |
add the list of all UV vertices for the mesh | |
addMeshFaces (self, list faces) | |
add the list of faces for the mesh, pay attention, all vertex indices are global over the whole mesh! | |
clearVerts (self) | |
clear all positional vertices of the mesh | |
clearUvVerts (self) | |
clear all uv vertices of the mesh | |
clearNormals (self) | |
clear all normal vertices of the mesh | |
clearFaces (self) | |
clear all faces of the mesh | |
removeFaces (self, list faces) | |
remove the set of vertices from the mesh | |
clearObject (self) | |
clear all objects | |
clearMaterials (self) | |
clear all materials | |
ensureMaterialsAndObjectsExist (self) | |
ensure that at least one material and one object exist in the mesh | |
int | addObject (self, str name) |
add the named object | |
int | addMaterial (self, str name) |
add the named material | |
removeUnusedObjectsAndMaterials (self) | |
remove all unused objects and materials | |
removeUnusedVerts (self) | |
remove all unused vertices | |
removeUnusedFaces (self) | |
remove all faces that contain zero vertices | |
cutByPlane (self, vec3 start, vec3 NormalDirection) | |
Cut off the mesh by the plane, the result is stored in the current mesh, the part of the mesh that is on the side of the negative normal direction is removed. | |
cutByDistortedPlane (self, vec3 start, vec3 NormalDirection, float noise_degree, float noise_scale, int seed=0) | |
Cut off the mesh by the distorted plane (using the Perlin noise), the result is stored in the current mesh, the part of the mesh that is on the side of the negative normal direction is removed. | |
distortByPerlinNoise (self, float noise_degree, float noise_scale, bool anisotropic=False, int seed=0) | |
distort the mesh by the Perlin noise | |
list | splitDisconnectedParts (self) |
split the mesh into disconnected parts | |
symmetry (self, vec3 start, vec3 NormalDirection, bool resultInQuads) | |
apply symmetry to the mesh | |
list | autodetectSymmetryPlanes (self) |
Detect the symmetry planes of the mesh. | |
weld (self, float minimal_relative_distance=0.0001) | |
weld the mesh, remove all vertices that are closer than minimal_relative_distance*mesh_bound_box_diagonal to each other | |
boundbox | getBounds (self) |
get the mesh bound box | |
float | getVolume (self) |
get the volume of the mesh | |
float | getOpenSurfaceVolume (self, vec3 start, vec3 dir) |
calculate the volume even if the mesh is not closed, in this case we define plane that limits the integration | |
float | getSquare (self) |
get square of the mesh | |
float | getFaceSquare (self, int face) |
get the squareof the face | |
float | getFaceUVSquare (self, int face) |
get the face square in UV space | |
vec3 | getFaceNormal (self, int face) |
get the face normal | |
relax (self, float degree, bool tangent, float crease_angle=180) | |
relax the mesh, keep the vertices count | |
createVDM (self, int side, str path_to_exr, vec3 center=vec3.Zero, float radius=1, vec3 up=vec3.AxisZ, vec3 x=vec3.AxisX, vec3 y=vec3.AxisY) | |
Create the vector displacement map from the mesh and save it as EXR file. | |
shell (self, float thickness_out, float thickness_in, int divisions=1) | |
add some thickness to the mesh (intrude a bit) | |
list | extrudeOpenEdges (self, float distance, vec3 direction=vec3.Zero) |
extrude open edges of the mesh | |
list | expandOpenEdges (self, float distance) |
extrude open edges of the mesh | |
list | getOpenEdges (self) |
get the list of open edges | |
float | getLengthAlongDirection (self, vec3 dir) |
get the mesh size along some axis | |
vec3 | getCenterMass (self) |
calculate the center mass of the mesh | |
Static Public Member Functions | |
Mesh | box (vec3 center=vec3.Zero, vec3 size=vec3.One, vec3 xAxis=vec3.Zero, vec3 yAxis=vec3.Zero, vec3 zAxis=vec3.Zero, float detail_size=1, float fillet=0.0, int nx=0, int ny=0, int nz=0) |
create the box mesh | |
Mesh | sphere (vec3 center=vec3.Zero, float radius=1.0, float detail_size=1) |
create the sphere mesh | |
Mesh | cylinder (vec3 center=vec3.Zero, float radius=1, float height=2, float detail_size=1, int slices=0, int caps=0, int rings=0, float fillet=0) |
create the cylinder mesh | |
Mesh | cone (vec3 center=vec3.Zero, float radius=1, float height=2, float detail_size=1, vec3 topAxis=vec3.AxisY) |
create the cone mesh | |
Mesh | plane (vec3 center=vec3.Zero, float sizeX=2, float sizeY=2, int divisionsX=2, int divisionsY=2, vec3 xAxis=vec3.AxisX, vec3 yAxis=vec3.AxisY) |
create the single-side plane mesh, the faces normals are put toward the vec3.Cross(xAxis, yAxis) | |
Mesh | hexagonal_plane (vec3 center=vec3.Zero, float sizeX=2, float sizeY=2, int divisionsX=2, int divisionsY=2, vec3 xAxis=vec3.AxisX, vec3 yAxis=vec3.AxisY) |
create the single-side triangular plane mesh that consists mostly of quasi equally-sided triangles | |
Mesh | text (str string, str font="tahoma", float height=10.0, vec3 center=vec3.Zero, vec3 text_direction=vec3.AxisX, vec3 text_normal=vec3.AxisY, float thickness=1, int align=1) |
Create the text mesh. | |
coat.Mesh.__init__ | ( | self | ) |
coat.Mesh.__init__ | ( | self | ) |
coat.Mesh.__init__ | ( | self, | |
Mesh | m ) |
coat.Mesh.__init__ | ( | self, | |
any | m ) |
Mesh coat.Mesh.__assign__ | ( | self, | |
any | m ) |
Mesh coat.Mesh.__iadd__ | ( | self, | |
any | m ) |
int coat.Mesh.addMaterial | ( | self, | |
str | name ) |
add new material to the mesh
name | the material name |
int coat.Mesh.addMaterial | ( | self, | |
str | name ) |
add the named material
name | the name for the material |
coat.Mesh.addMeshFaces | ( | self, | |
list | faces ) |
add the list of faces for the mesh, pay attention, all vertex indices are global over the whole mesh!
faces | the format of faces is: amount_ot_vets_in_face1, vertex1_face1, vertex2_face1...vertexN-1_face1, amount_ot_vets_in_face2, vertex1_face2, vertex2_face2... ... |
coat.Mesh.addMeshNormals | ( | self, | |
list | normals ) |
add the list of all normal vertices for the mesh
normals | the list of normals (vec3) |
coat.Mesh.addMeshUVs | ( | self, | |
list | uvs ) |
add the list of all UV vertices for the mesh
uvs | the list of UVs (vec2) |
coat.Mesh.addMeshVertices | ( | self, | |
list | positions ) |
add the list of all positional vertices for the mesh
positions | the list of positions |
int coat.Mesh.addObject | ( | self, | |
str | name ) |
add new object to the mesh
name | the object name |
int coat.Mesh.addObject | ( | self, | |
str | name ) |
add the named object
name | the name for the object |
boolean add to volume
v | the destination volume |
transform | the transform |
concatenate the transformed mesh with the current one
m | the mesh |
t | the transform |
list coat.Mesh.autodetectSymmetryPlanes | ( | self | ) |
Detect the symmetry planes of the mesh.
coat.Mesh.boolean | ( | self, | |
Mesh | m, | ||
BoolOpType | op ) |
boolean operation
m | the mesh to operate |
coat.Mesh.booleanOp | ( | self, | |
Mesh | With, | ||
BoolOpType | op ) |
Perform the boolean operation with the given mesh.
With | the mesh to perform the operation with over the current mesh |
op | the operation, see BoolOpType (-1 means no operation, 0 - add, 1 - subtract, 2 - intersect) |
|
static |
create the box mesh
center | the box center |
size | the box size |
xAxis | the x-axis direction, if zero, the x-axis is default - (1,0,0) |
yAxis | the y-axis direction, if zero, the y-axis is default - (0,1,0) |
zAxis | the z-axis direction, if zero, the z-axis is default - (0,0,1) |
detail_size | the average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size |
fillet | the fillet radius |
nx | the number of segments along the x-axis (if all of nx, ny, nz are above zero, it overrides the detail_size) |
ny | the number of segments along the y-axis (if all of nx, ny, nz are above zero, it overrides the detail_size) |
nz | the number of segments along the z-axis (if all of nx, ny, nz are above zero, it overrides the detail_size) |
coat.Mesh.calcNormals | ( | self | ) |
re-calculate normals over the mesh
coat.Mesh.calcNormalsIgnoreSharpEdges | ( | self | ) |
re-calculate normals over the mesh, ignore the sharp edges
coat.Mesh.clear | ( | self | ) |
clear the mesh
coat.Mesh.clearFaces | ( | self | ) |
clear all faces of the mesh
coat.Mesh.clearMaterials | ( | self | ) |
clear all materials
coat.Mesh.clearNormals | ( | self | ) |
clear all normal vertices of the mesh
coat.Mesh.clearObject | ( | self | ) |
clear all objects
coat.Mesh.clearUvVerts | ( | self | ) |
clear all uv vertices of the mesh
coat.Mesh.clearVerts | ( | self | ) |
clear all positional vertices of the mesh
|
static |
create the cone mesh
center | the center of the cone (the cone base center) |
radius | the cone radius |
height | the cone height |
detail_size | the average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size |
topAxis | the top axis direction, if zero, the top axis is default - (0,1,0) |
int coat.Mesh.createNewUvVertex | ( | self, | |
vec2 | uv ) |
create new UV vertex to be used for faces
uv | the texture coordinates |
int coat.Mesh.createNewVertex | ( | self, | |
vec3 | position ) |
create the positional vertex
position | the position |
coat.Mesh.createVDM | ( | self, | |
int | side, | ||
str | path_to_exr, | ||
vec3 | center = vec3.Zero, | ||
float | radius = 1, | ||
vec3 | up = vec3.AxisZ, | ||
vec3 | x = vec3.AxisX, | ||
vec3 | y = vec3.AxisY ) |
Create the vector displacement map from the mesh and save it as EXR file.
The mesh is put on plane at center and clamped by that plane.
side | the EXR file side size |
path_to_exr | the path to the EXR file |
center | the center of the plane |
radius | the radius that should include the mesh |
up | the up vector of the plane |
x | the x vector of the plane |
y | the y vector of the plane |
coat.Mesh.cutByDistortedPlane | ( | self, | |
vec3 | start, | ||
vec3 | NormalDirection, | ||
float | noise_degree, | ||
float | noise_scale, | ||
int | seed = 0 ) |
Cut off the mesh by the distorted plane (using the Perlin noise), the result is stored in the current mesh, the part of the mesh that is on the side of the negative normal direction is removed.
start | the start point of the plane |
NormalDirection | the normal direction of the plane |
noise_degree | the degree of the noise |
noise_scale | the scale of the noise |
seed | the seed for the noise |
Cut off the mesh by the plane, the result is stored in the current mesh, the part of the mesh that is on the side of the negative normal direction is removed.
start | the start point of the plane |
NormalDirection | the normal direction of the plane |
|
static |
create the cylinder mesh
center | the center of the cylinder |
radius | the radius of the cylinder |
height | the height of the cylinder |
detail_size | the average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size |
slices | the number of slices, it overrides the detail_size if all of slices, caps, rings are above zero |
caps | the number of caps, it overrides the detail_size if all of slices, caps, rings are above zero |
rings | the number of rings, it overrides the detail_size if all of slices, caps, rings are above zero |
fillet | the fillet radius |
coat.Mesh.distortByPerlinNoise | ( | self, | |
float | noise_degree, | ||
float | noise_scale, | ||
bool | anisotropic = False, | ||
int | seed = 0 ) |
distort the mesh by the Perlin noise
noise_degree | the degree of the noise |
noise_scale | the scale of the noise |
anisotropic | if false, the noise will be applied in the direction of the normals, othervice the noise directed in random direction regardless the normals |
seed | the seed for the noise |
coat.Mesh.ensureMaterialsAndObjectsExist | ( | self | ) |
ensure that at least one material and one object exist in the mesh
list coat.Mesh.expandOpenEdges | ( | self, | |
float | distance ) |
extrude open edges of the mesh
distance | the distance to extrude |
list coat.Mesh.extrudeOpenEdges | ( | self, | |
float | distance, | ||
vec3 | direction = vec3.Zero ) |
extrude open edges of the mesh
distance | the distance to extrude |
direction | the extrude direction, if zero , the direction is the local vertex normal |
int coat.Mesh.facesCount | ( | self | ) |
returns the faces amount
coat.Mesh.fromPaintRoom | ( | self | ) |
get the mesh from the paint room
coat.Mesh.fromReducedVolume | ( | self, | |
Volume | v, | ||
float | reduction_percent, | ||
bool | with_subtree = False, | ||
bool | all_selected = False ) |
extract the mesh from the volume and reduce it by the given percent
v | the source volume |
reduction_percent | 0 means no reduction, 100 means 100% reduction, i.e. the mesh will be reduced to a single triangle |
with_subtree | if true, the subtree will be extracted, otherwise the single volume taken |
all_selected | if true, all selected volumes will be extracted, otherwise only the current volume |
coat.Mesh.fromRetopo | ( | self | ) |
take the whole mesh from the retopo room
coat.Mesh.fromVolume | ( | self, | |
Volume | v, | ||
bool | with_subtree = False, | ||
bool | all_selected = False ) |
extract the mesh from the volume
v | the source volume |
with_subtree | if true, the subtree will be extracted, otherwise the single volume taken |
all_selected | if true, all selected volumes will be extracted, otherwise only the current volume |
coat.Mesh.fromVolumeWithMaxPolycount | ( | self, | |
Volume | v, | ||
int | max_polycount, | ||
bool | with_subtree = False, | ||
bool | all_selected = False ) |
extract the mesh from the volume and reduce to the given polycount
v | the source volume |
max_polycount | the required polycount |
with_subtree | if true, the subtree will be extracted, otherwise the single volume taken |
all_selected | if true, all selected volumes will be extracted, otherwise only the current volume |
boundbox coat.Mesh.getBounds | ( | self | ) |
get the mesh bound box
vec3 coat.Mesh.getCenterMass | ( | self | ) |
calculate the center mass of the mesh
int coat.Mesh.getFaceMaterial | ( | self, | |
int | faceIndex ) |
get the material index over the face, see the getMaterialsCount(), getMaterialName()
faceIndex | the face index, should be in [0..facesCount() - 1] |
vec3 coat.Mesh.getFaceNormal | ( | self, | |
int | face ) |
get the face normal
face | the face index |
int coat.Mesh.getFaceNormalVertex | ( | self, | |
int | faceIndex, | ||
int | faceVertexIndex ) |
get the normal vertex index over the face
faceIndex | the face index, should be in [0..facesCount() - 1] |
faceVertexIndex | the index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1] |
int coat.Mesh.getFaceObject | ( | self, | |
int | faceIndex ) |
get the object index over the face, see the getObjectsCount(), getObjectName()
faceIndex | the face index, should be in [0..facesCount() - 1] |
float coat.Mesh.getFaceSquare | ( | self, | |
int | face ) |
get the squareof the face
face | the face index |
float coat.Mesh.getFaceUVSquare | ( | self, | |
int | face ) |
get the face square in UV space
face | the face index |
int coat.Mesh.getFaceUvVertex | ( | self, | |
int | faceIndex, | ||
int | faceVertexIndex ) |
get the UV vertex index over the face
faceIndex | the face index, should be in [0..facesCount() - 1] |
faceVertexIndex | the index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1] |
list coat.Mesh.getFaceUvVerts | ( | self, | |
int | face ) |
get the list of UV vertices indices over the face
face | the face index |
int coat.Mesh.getFaceUvVertsCount | ( | self, | |
int | face ) |
get the amount of UV vertices over the face
face | the face index |
int coat.Mesh.getFaceVertex | ( | self, | |
int | faceIndex, | ||
int | faceVertexIndex ) |
get the positional vertex index over the face
faceIndex | the face index, should be in [0..facesCount() - 1] |
faceVertexIndex | the index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1] |
list coat.Mesh.getFaceVerts | ( | self, | |
int | face ) |
get the list of UV vertex indices over the face, pay attention UV vertices are not same as position vertices
face | the face index |
int coat.Mesh.getFaceVertsCount | ( | self, | |
int | face ) |
get the amount of vertices over the face
face | the face index, should be in [0..facesCount() - 1] |
float coat.Mesh.getLengthAlongDirection | ( | self, | |
vec3 | dir ) |
get the mesh size along some axis
dir | the axis direction |
str coat.Mesh.getMaterialName | ( | self, | |
int | idx ) |
get the name of the material
idx | the material index |
int coat.Mesh.getMaterialsCount | ( | self | ) |
get the materials count in the mesh
str coat.Mesh.getMaterialTexture | ( | self, | |
int | idx, | ||
int | texture_layer ) |
get the texture name of the material
idx | the material index |
texture_layer | the texture layer, 0 - color, 1 - gloss, 2 - bump/displacement, 3 - normalmap, 4 - specular color, 5 - emossive (color), 6 - emissive power |
list coat.Mesh.getMeshNormals | ( | self | ) |
get the list of all normal vertices of the mesh
list coat.Mesh.getMeshUVs | ( | self | ) |
get the list of all UV vertices of the mesh
list coat.Mesh.getMeshVertices | ( | self | ) |
get the list of all positional vertices of the mesh
str coat.Mesh.getObjectName | ( | self, | |
int | idx ) |
get the name of the object
idx | the object index |
int coat.Mesh.getObjectsCount | ( | self | ) |
returns the objects count in the mesh
list coat.Mesh.getOpenEdges | ( | self | ) |
get the list of open edges
calculate the volume even if the mesh is not closed, in this case we define plane that limits the integration
start | the point on that plane |
dir | the normalized vector, normal to the plane |
float coat.Mesh.getSquare | ( | self | ) |
get square of the mesh
vec3 coat.Mesh.getVertex | ( | self, | |
int | idx ) |
get the vertex coordinate
idx | the vertex index |
vec3 coat.Mesh.getVertexNormal | ( | self, | |
int | idx ) |
get the normal of the vertex, pay attention position verts and normal verts are different, they have different indices
idx | the normal vertex index, [0..vertsNormalCount() - 1] |
vec2 coat.Mesh.getVertexUV | ( | self, | |
int | idx ) |
get the UV coordinate of the vertex, pay attention position verts and UV verts are different, they have different indices
idx | the UV vertex index, [0..vertsUvCount() - 1] |
float coat.Mesh.getVolume | ( | self | ) |
get the volume of the mesh
|
static |
create the single-side triangular plane mesh that consists mostly of quasi equally-sided triangles
center | the center of the plane |
sizeX | the plane size along the X-axis |
sizeY | the plane size along the Y-axis |
divisionsX | amount of divisions along the X-axis |
divisionsY | amount of divisions along the Y-axis |
xAxis | the vector of the X-axis |
yAxis | the vector of the Y-axis |
insert without boolean operation, if the volume is not in surface mode (volumetric) the boolean ADD will be performed anyway
v | the destination volume |
transform | the transform |
boolean intersection of the mesh with the volume
v | the destination volume |
transform | the transform |
Mesh coat.Mesh.MakeCopy | ( | self | ) |
|
static |
create the single-side plane mesh, the faces normals are put toward the vec3.Cross(xAxis, yAxis)
center | the center of the plane |
sizeX | the plane size along the X-axis |
sizeY | the plane size along the Y-axis |
divisionsX | amount of divisions along the X-axis |
divisionsY | amount of divisions along the Y-axis |
xAxis | the vector of the X-axis |
yAxis | the vector of the Y-axis |
bool coat.Mesh.Read | ( | self, | |
str | name ) |
Load the mesh from the file.
name | the filename. May contain full path or relative to the coat's install or documents folder. |
coat.Mesh.reduceToPolycount | ( | self, | |
int | destination_triangles_count ) |
reduce the mesh to the given polycount, mesh will be triangulated
destination_triangles_count | the required triangles count, if it is above the existing, nothing happens |
coat.Mesh.relax | ( | self, | |
float | degree, | ||
bool | tangent, | ||
float | crease_angle = 180 ) |
relax the mesh, keep the vertices count
degree | the degree of relax, may be > 1 |
tangent | should be tangent relax |
crease_angle | the crease angle between faces (degrees), if the angle between faces is less than crease_angle, the edge relaxed |
coat.Mesh.removeFaces | ( | self, | |
list | faces ) |
remove the set of vertices from the mesh
faces | the list of faces indices to remove |
coat.Mesh.removeMaterial | ( | self, | |
int | idx ) |
remove the material (and corresponding faces) from the mesh
idx | the material index |
coat.Mesh.removeObject | ( | self, | |
int | idx ) |
remove object from the mesh
idx | the object index |
coat.Mesh.removeUnusedFaces | ( | self | ) |
remove all faces that contain zero vertices
coat.Mesh.removeUnusedObjectsAndMaterials | ( | self | ) |
remove all unused objects and materials
coat.Mesh.removeUnusedVerts | ( | self | ) |
remove all unused vertices
rotate the mesh so that X axis will be aligned with axisX, Y axis will be aligned with axisY
axisX | the new X axis |
axisY | the new Y axis |
rotate the mesh so that Y axis will be aligned with axisY, Z axis will be aligned with axisZ
axisY | the new Y axis |
axisZ | the new Z axis |
rotate the mesh so that Z axis will be aligned with axisZ, X axis will be aligned with axisX
axisZ | the new Z axis |
axisX | the new X axis |
coat.Mesh.setFaceMaterial | ( | self, | |
int | faceIndex, | ||
int | materialIndex ) |
set the material index over the face, see the getMaterialsCount(), getMaterialName()
faceIndex | the face index, should be in [0..facesCount() - 1] |
materialIndex | the material index to set for the face |
coat.Mesh.setFaceNormalVertex | ( | self, | |
int | faceIndex, | ||
int | faceVertexIndex, | ||
int | normalVertexIndex ) |
set the normal vertex index over the face
faceIndex | the face index, should be in [0..facesCount() - 1] |
faceVertexIndex | the index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1] |
normalVertexIndex | the normal vertex index, should be in [0..vertsNormalCount() - 1] |
coat.Mesh.setFaceObject | ( | self, | |
int | faceIndex, | ||
int | objectIndex ) |
set the object index for the face, see the getObjectsCount(), getObjectName()
faceIndex | the face index, should be in [0..facesCount() - 1] |
objectIndex | the object index to set for the face |
coat.Mesh.setFaceUvVertex | ( | self, | |
int | faceIndex, | ||
int | faceVertexIndex, | ||
int | uvVertexIndex ) |
set the UV vertex index over the face
faceIndex | the face index, should be in [0..facesCount() - 1] |
faceVertexIndex | the index of the vertex within the face, should be in [0..getFaceVertsCount(faceIndex) - 1] |
uvVertexIndex | the UV vertex index, should be in [0..vertsUvCount() - 1] |
coat.Mesh.setFaceVerts | ( | self, | |
int | face, | ||
list | vertices ) |
set the list of positional vertex indices over the face
face | the face index |
vertices | the list of vertex indices |
coat.Mesh.setMaterialName | ( | self, | |
int | idx, | ||
str | name ) |
set material name
idx | the material index |
name | the new name |
coat.Mesh.setMaterialTexture | ( | self, | |
int | idx, | ||
int | texture_layer, | ||
str | texture_path ) |
set the texture layer filename of the material
idx | the material index |
texture_layer | the texture layer, 0 - color, 1 - gloss, 2 - bump/displacement, 3 - normalmap, 4 - specular color, 5 - emossive (color), 6 - emissive power |
texture_path | the texture path (full or relative to 3DCoat documents folder) |
coat.Mesh.setMeshFaces | ( | self, | |
list | faces ) |
set the complete list of faces for the mesh
faces | the format of faces is: amount_ot_vets_in_face1, vertex1_face1, vertex2_face1...vertexN-1_face1, amount_ot_vets_in_face2, vertex1_face2, vertex2_face2... ... |
coat.Mesh.setMeshNormals | ( | self, | |
list | normals ) |
set the list of all normal vertices for the mesh
normals | the list of normals (vec3) |
coat.Mesh.setMeshUVs | ( | self, | |
list | uvs ) |
set the list of all UV vertices for the mesh
uvs | the list of UVs (vec2) |
coat.Mesh.setMeshVertices | ( | self, | |
list | positions ) |
set the list of all positional vertices for the mesh
positions | the list of positions |
coat.Mesh.setObjectName | ( | self, | |
int | idx, | ||
str | name ) |
set object name
idx | the object index |
name | the new name |
coat.Mesh.setVertex | ( | self, | |
int | idx, | ||
vec3 | v ) |
set the vertex coordinate
idx | the vertex index |
v | the coordinate |
coat.Mesh.setVertexNormal | ( | self, | |
int | idx, | ||
vec3 | v ) |
set the normal of the vertex, pay attention position verts and normal verts are different, they have different indices
idx | the normal vertex index, [0..vertsNormalCount() - 1] |
v | the normal |
coat.Mesh.setVertexUV | ( | self, | |
int | idx, | ||
vec2 | v ) |
set the UV coordinate of the vertex, pay attention position verts and UV verts are different, they have different indices
idx | the UV vrertex index, [0..vertsUvCount() - 1] |
v | the UV coordinate |
coat.Mesh.shell | ( | self, | |
float | thickness_out, | ||
float | thickness_in, | ||
int | divisions = 1 ) |
add some thickness to the mesh (intrude a bit)
thickness_out | the thickness in the outer direction (extrusion) |
thickness_in | the thickness in the inner direction (intrusion) |
divisions | the amount of divisions of the edge |
create the sphere mesh
center | the sphere center |
radius | the sphere radius |
detail_size | the average length of the edge over the figure. The figure will be divided so that edges length will be approximately the detail_size |
list coat.Mesh.splitDisconnectedParts | ( | self | ) |
split the mesh into disconnected parts
boolean subtraction of the mesh from the volume
v | the destination volume |
transform | the transform |
apply symmetry to the mesh
start | the start point of the plane |
NormalDirection | the negative part (regarding the plane normal) of the mesh is removed, replaced with positive part |
resultInQuads | the cut faces will produce quads instead of triangles |
|
static |
Create the text mesh.
string | the text string |
font | the font name |
height | the text height |
center | the text center |
text_direction | the text direction left to right |
text_normal | the normal direction of the text |
thickness | the thickness of the text |
align | the text align, 0 - left, 1 - center, 2 - right |
coat.Mesh.toVolume | ( | self, | |
Volume | v, | ||
mat4 | transform = mat4.Identity, | ||
BoolOpType | op = BoolOpType.BOOL_MERGE ) |
merge this mesh to the volume object
v | the destination volume |
transform | the applied transformation |
op | the boolean operation to be performed, -1 means no operation, raw merge, 0 - 1, 1 - subtract, 2 - intersect |
coat.Mesh.transform | ( | self, | |
mat4 | transform ) |
transform the mesh
transform | the transformation matrix |
coat.Mesh.triangulate | ( | self | ) |
triangulate the mesh
coat.Mesh.unifyAllObjects | ( | self, | |
str | name = "" ) |
unify all objects in the mesh, i.e.
make one object
name | the name of the new object, if empty, the name of the first object will be used |
bool coat.Mesh.valid | ( | self | ) |
Check if mesh is valid.
int coat.Mesh.vertsCount | ( | self | ) |
returns the amount of verts in the mesh
int coat.Mesh.vertsNormalCount | ( | self | ) |
returns the amount of normal - verts in the mesh
int coat.Mesh.vertsUvCount | ( | self | ) |
returns the amount of UV - verts in the mesh
coat.Mesh.weld | ( | self, | |
float | minimal_relative_distance = 0.0001 ) |
weld the mesh, remove all vertices that are closer than minimal_relative_distance*mesh_bound_box_diagonal to each other
minimal_relative_distance | the minimal distance between vertices, relative to the mesh bound box diagonal |
bool coat.Mesh.Write | ( | self, | |
str | name ) |
Save the mesh to file.
name | Full or relative path |