Polygonal
Python API functions
Read time 9 minutesLast updated 19 hours ago
configureFunctionLogger
polygonal.configureFunctionLogger(functionName, enableFunction, enableParameters, enableExecutionTime)
Parameters
getPolygonCount
Returns the number of polygon of a mesh.
polygonal.getPolygonCount(mesh, asTriangleCount=False) -> core.ULong
Parameters
Type | Name | Description |
|---|
| Mesh | mesh | The mesh. |
| Bool | asTriangleCount | If true count the equivalent of triangles for each polygon. |
Returns
Type | Name | Description |
|---|
| ULong | polygonCount | The number of polygons. |
checksum
computeMeshTopoChecksum
Compute a checksum of the mesh topology, connectivity.
polygonal.computeMeshTopoChecksum(mesh) -> core.String
Parameters
Type | Name | Description |
|---|
| Mesh | mesh | The mesh. |
Returns
Type | Name | Description |
|---|
| String | checksum | The mesh. |
See also:
computeMeshVertexPositionsChecksum
Compute a checksum of the mesh vertices positions.
polygonal.computeMeshVertexPositionsChecksum(mesh, precisionFloat=-1) -> core.String
Parameters
Type | Name | Description |
|---|
| Mesh | mesh | The mesh. |
| Int | precisionFloat | Floating point precision [1..24], number of significant numbers kept. -1 means no rounded will be applied. |
Returns
Type | Name | Description |
|---|
| String | checksum | The mesh. |
See also:
computeUVTopoChecksum
Compute a checksum of the uvs topology, connectivity.
polygonal.computeUVTopoChecksum(mesh, uvChannel) -> core.String
Parameters
Type | Name | Description |
|---|
| Mesh | mesh | The mesh. |
| Int | uvChannel | The uv channel. |
Returns
Type | Name | Description |
|---|
| String | checksum | The mesh. |
See also:
computeUVVertexPositionsChecksum
Compute a checksum of the vertices positions in uv space.
polygonal.computeUVVertexPositionsChecksum(mesh, uvChannel, precisionFloat=-1) -> core.String
Parameters
Type | Name | Description |
|---|
| Mesh | mesh | The mesh. |
| Int | uvChannel | The uv channel. |
| Int | precisionFloat | Floating point precision [1..24], number of significant numbers kept. -1 means no rounded will be applied. |
Returns
Type | Name | Description |
|---|
| String | checksum | The mesh. |
See also:
draco
dracoDecode
Decode a mesh using draco.
polygonal.dracoDecode(buffer, jointIndicesId=-1, jointWeightsId=-1) -> polygonal.StaticMesh
Parameters
Type | Name | Description |
|---|
| ByteList | buffer | |
| Int | jointIndicesId | Unique ID of Generic attribute encoding joint indices. |
| Int | jointWeightsId | Unique ID of Generic attribute encoding joint weights. |
Returns
See also:
dracoEncode
Encode a mesh using draco.
polygonal.dracoEncode(mesh, compressionLevel=7, quantizationPosition=-1, quantizationNormal=-1, quantizationTexCoord=-1) -> core.ByteList, core.Int, core.Int
Parameters
Type | Name | Description |
|---|
| StaticMesh | mesh | |
| Int | compressionLevel | 0=faster but the worst compression, 10=slower but the best compression. |
| Int | quantizationPosition | Number of quantization bits used for position attributes. |
| Int | quantizationNormal | Number of quantization bits used for normal attributes. |
| Int | quantizationTexCoord | Number of quantization bits used for texture coordinates attributes. |
Returns
Type | Name | Description |
|---|
| ByteList | buffer | |
| Int | jointIndicesId | Unique ID of Generic attribute encoding joint indices (-1 if not applicable or if enocdeSkeleton is false). |
| Int | jointWeightsId | Unique ID of Generic attribute encoding joint weights (-1 if not applicable or if enocdeSkeleton is false). |
See also:
geometry access
createJointPlaceholders
Create fake joint to store in mesh definitions. Thus we can retrieve stored data from getJointPlaceholders.
polygonal.createJointPlaceholders(data, worldMatrices) -> polygonal.PlaceholderJointList
Parameters
Type | Name | Description |
|---|
| ULongList | data | Create as much joints as there are data, each joint store one data. |
| Matrix4List | worldMatrices | World matrix for each joints. |
Returns
See also:
createMeshFromDefinition
Create a new mesh with the given MeshDefinition.
polygonal.createMeshFromDefinition(meshDefinition) -> polygonal.Mesh
Parameters
Returns
Type | Name | Description |
|---|
| Mesh | mesh | The new mesh. |
See also:
createMeshFromDefinitions
Create a new mesh from multiple MeshDefinition.
polygonal.createMeshFromDefinitions(meshDefinition) -> polygonal.Mesh
Parameters
Returns
Type | Name | Description |
|---|
| Mesh | mesh | The new mesh. |
See also:
createMeshFromText
Creates an occurrence from string.
polygonal.createMeshFromText(text, matrix, font="ChicFont", fontSize=64, color=None, heigth3D=40) -> polygonal.Mesh, material.Material
Parameters
Type | Name | Description |
|---|
| String | text | Text to create. |
| Matrix4 | matrix | A matrix to apply on mesh. |
| String | font | The font to use. |
| Int | fontSize | The font size. |
| ColorAlpha | color | The occurrence color. |
| Double | heigth3D | 3D height of text. |
Returns
See also:
createMeshesFromDefinitions
Create new meshes with the given MeshDefinitions.
polygonal.createMeshesFromDefinitions(meshDefinitions) -> polygonal.MeshList
Parameters
Returns
Type | Name | Description |
|---|
| MeshList | meshes | The new Meshes. |
See also:
getJointPlaceholders
Get data stored in joint placeholders.
polygonal.getJointPlaceholders(joints) -> core.ULongList
Parameters
Returns
Type | Name | Description |
|---|
| ULongList | data | Data stored in each placehold joint (for invalid joint, returned data is undefined). |
See also:
getMeshDefinition
Returns the mesh definition.
polygonal.getMeshDefinition(mesh) -> polygonal.MeshDefinition
Parameters
Type | Name | Description |
|---|
| Mesh | mesh | The mesh to get definition. |
Returns
See also:
getMeshDefinitions
Returns the meshes definitions.
polygonal.getMeshDefinitions(meshes) -> polygonal.MeshDefinitionList
Parameters
Type | Name | Description |
|---|
| MeshList | meshes | The meshes to get definitions. |
Returns
See also:
getMeshSkinning
Returns the joints/IBMs list of a given mesh (those referenced by jointIndices).
polygonal.getMeshSkinning(mesh) -> polygonal.JointList, geom.Matrix4List
Parameters
Returns
See also:
hasMeshJoints
Check if the mesh has joints.
polygonal.hasMeshJoints(mesh) -> core.Bool
Parameters
Type | Name | Description |
|---|
| Mesh | mesh | The Mesh. |
Returns
Type | Name | Description |
|---|
| Bool | value | Return True if the mesh contains joints. |
See also:
hasNormalizedUVs
Check if the provided mesh UV channel contains normalized texture coordinates.
polygonal.hasNormalizedUVs(mesh, channel) -> core.Bool
Parameters
Type | Name | Description |
|---|
| Mesh | mesh | The mesh that needs to be checked. |
| Int | channel | The channel to verity. If set to -1, all channels are checked. |
Returns
Type | Name | Description |
|---|
| Bool | value | Return True if the mesh UV channel is defined and contains normalized texture coordinates. |
See also:
hasUVs
Check if one or some UV channels are defined in the mesh.
polygonal.hasUVs(mesh, channel=-1) -> core.Bool
Parameters
Type | Name | Description |
|---|
| Mesh | mesh | The mesh to check. |
| Int | channel | The UV channel to check, or -1 for any. |
Returns
Type | Name | Description |
|---|
| Bool | value | Return True if the mesh contains the provided UV channel, or if channel is -1 and the mesh contains any UV channel. |
See also:
setMeshSkinning
Set/Replace the list of joints/IBMs of a given mesh (those referenced by jointIndices).
polygonal.setMeshSkinning(mesh, joints, IBMs)
Parameters
See also:
modification
usePointGapFillerNormal
This triangulates a set of points and normals.
polygonal.usePointGapFillerNormal(points, normals) -> core.IntList
Parameters
Type | Name | Description |
|---|
| Point3List | points | The set of points to triangulate. |
| Vector3List | normals | The normals associated to the points to triangulate. This can be empty. |
Returns
Type | Name | Description |
|---|
| IntList | triangulation | The indexes of the points from the given array arranged as triangles. |