alias_api.AlMesh

class alias_api.AlMesh

Bases: AlObject

Interface to Alias meshes.

AlMesh is the interface to meshes and their data in Alias. This class lets a developer create and manipulate mesh objects. Data access methods to all properties are provided. The following properties are used throughout the mesh class.

vertices - Vertices are passed by this class using

an array of floating point values. A vertex consists of three values; x,y,z respectively. Refer to the definition of triangles for a description of the relationship between vertices and triangles. numVertices - The number of vertices is equivalent to the number of x,y,z triplets stored in the vertices array. The total number of floats in the vertices array is equivalent to three times the number of vertices.

triangles - Triangles are passed by this class using

an array of integer values. A triangle consists of three integer indices. These indices reference a vertex in the vertices array such that vertices[3*index] returns the x coordinate of the vertex. Similarly, vertices[3*index+1] and vertices[3*index+2] return the y and z coordinate respectively. Indices are to be specified in counter clockwise order relative to the front of their face.

num_triangles - The number of triangles is equivalent to

the number of integer triplets stored in the triangles array. The total number of integers in the triangles array is equivalent to three times the number of triangles.

normals - Normals are passed by this class using

an array of floating point values. They consist of three values; x,y,z respectively. Normals are per vertex. They are referenced by triangles in the same manner that vertices are referenced.

uvs - UVs are passed by this class using an array

of float values. They consist of two floating point values; u,v respectively. UVs are per vertex. They are referenced by triangles in the same manner that vertices are referenced.

assign_layered_shader(self: alias_api.AlMesh, shader: AlLayeredShader) int

Assigns shader to the mesh.

Parameters

shader (AlShader) – the shader to assign

Returns

The status code result Success - The shader was successfully assigned to the mesh. InvalidArgument - shader is invalid. InvalidObject - The mesh was not created properly. Failure - Unable to process request.

assign_shader(self: alias_api.AlMesh, shader: AlShader) int

Assigns shader to the mesh.

Parameters

shader (AlShader) – the shader to assign

Returns

The status code result Success - The shader was successfully assigned to the mesh. InvalidArgument - shader is invalid. InvalidObject - The mesh was not created properly. Failure - Unable to process request.

assign_switch_shader(self: alias_api.AlMesh, shader: AlSwitchShader) int

Assigns shader to the mesh.

Parameters

shader (AlShader) – the shader to assign

Returns

The status code result Success - The shader was successfully assigned to the mesh. InvalidArgument - shader is invalid. InvalidObject - The mesh was not created properly. Failure - Unable to process request.

copy_wrapper(self: alias_api.AlMesh) alias_api.AlObject

Return an exact duplicate of this AlMesh wrapper.

create(self: alias_api.AlMesh, vertices: collections.abc.Sequence[SupportsFloat], triangles: collections.abc.Sequence[SupportsInt], normals: collections.abc.Sequence[SupportsFloat], uvs: collections.abc.Sequence[SupportsFloat]) int

Creates a mesh object with the supplied data. The is expected to allocate memory and seed data for the various arrays. Passing a uv array is optional. Passing a normal array is optional. Note that normals are recalculated as the mesh is edited.

:return the status code

The status code result: Success - the file was stored successfully Failure - the wire file could not be stored properly InvalidArgument - unrecognized file type or fileName is NULL.

delete_object(self: alias_api.AlMesh) int

Delete the AlMesh from the Alias Universe and return the status of the performed operation.

first_shader(self: alias_api.AlMesh) AlShader

Return the first shader that this mesh object references. The function will return 0 if there are no shaders or the mesh was not created properly.

get_layered_shader(self: alias_api.AlMesh) AlLayeredShader

Return the layered shader that this mesh object references. The function will return 0 if there are no shaders or the mesh was not created properly.

get_switch_shader(self: alias_api.AlMesh) AlSwitchShader

Return the switch shader that this mesh object references. The function will return 0 if there are no shaders or the mesh was not created properly.

layer_shader(self: alias_api.AlMesh, shader: AlShader) int

Layers the shader on the mesh.

Returns

The status code result Success - the shader was successfully layered on the mesh. InvalidArgument - shader is invalid. InvalidObject - The mesh was not created properly. Failure - Unable to process request.

mesh_node(self: alias_api.AlMesh) AlMeshNode

Return the AlMeshNode for this mesh. Return None if there is not an attached polyset node.

property name

Get or set the AlMesh name.

next_shader(self: alias_api.AlMesh, shader: AlShader) AlShader

Return the shader after the one specified by shader.

The function will return 0 if:
  • The end of the shading list has been reached.

  • The argument, shader, is 0.

  • the mesh was not created properly.

  • There are no shaders.

Parameters

shader (AlShader) – the shader to get the next one from

Returns

The next shader, or 0 if it could not find a next shader.

Return type

AlShader | int

normals(self: alias_api.AlMesh) list[float]

Returns a list of the mesh’s normal data.

number_of_triangles(self: alias_api.AlMesh) int

Return the number of triangles currently stored in the mesh. The function will return -1 if the mesh was not created properly.

number_of_vertices(self: alias_api.AlMesh) int

Return the number of vertices currently stored in the mesh. The function will return -1 if the mesh was not created properly.

triangles(self: alias_api.AlMesh) list[int]

Returns a list of the mesh’s triangle data.

type(self: alias_api.AlMesh) alias_api.AlObjectType

Return the AlMesh type identifier.

uvs(self: alias_api.AlMesh) list[float]

Returns a list of the mesh’s uv data.

vertices(self: alias_api.AlMesh) list[float]

Returns a list of the mesh’s vertex data.