GLTFMesh
-
class
compas.files.GLTFMesh(primitive_data_list, context, mesh_name=None, weights=None, extras=None, extensions=None)[source] Bases:
objectObject containing mesh data in a format compatible with the glTF standard.
- Attributes
mesh_name (str) – String of the name of the mesh.
weights (list) – List containing the weights to be applied to morph targets.
primitive_data_list (list) – List of objects defining the geometry and material of the mesh.
extras (object)
extensions (object)
context (GLTFContent) – GLTF context in which the mesh exists.
key (int) – Key of the mesh used in
compas.files.GLTFMesh.context.meshes.vertices (list) – List of xyz-tuples representing the points of the mesh.
faces (list) – List of tuples referencing the indices of
compas.files.GLTFMesh.verticesrepresenting faces of the mesh.
Methods
__init__(primitive_data_list, context[, …])Initialize self.
from_data(mesh, context, primitive_data_list)Creates a
compas.files.GLTFMeshfrom a glTF node dictionary and inserts it in the provided context.from_mesh(context, mesh)Construct a
compas.files.GLTFMeshobject from a compas mesh.from_vertices_and_faces(context, vertices, faces)Construct a
compas.files.GLTFMeshobject from lists of vertices and faces.group_indices(indices, group_size)Returns a list of the elements of
indicesgrouped into tuples of sizegroup_size.shift_indices(indices, shift)Given a list of indices, returns a list of indices, all shifted by
shift.to_data(primitives)Returns a JSONable dictionary object in accordance with glTF specifications.
validate_faces(faces)Raises an exception if not all faces in
facesare defining either all triangles, lines or points.validate_vertices(vertices)Raise an exception if there are either too many vertices, or the vertices do not represent points in 3-space.