MeshCollection#
plupy.data.meshes: primitive, generated and imported (.glb) meshes.
class MeshCollection(DataCollection)Inherits DataCollection: its members are documented there.
Usage and examples
Members: import_file
import_file#
import_file(path: str) -> MeshCopy a .glb model into Assets/Models and return its new mesh datablock (place it with an object's mesh component).
Re-import a changed file with mesh.replace_model(path).
Copies a .glb (binary glTF) model into Assets/Models and creates a mesh datablock named after the file, the same as the editor's model import. path is absolute or relative to the project root. A .gltf text file, another format or an unsupported model raises PlupyError and creates no data; export the model as .glb. Show the mesh by giving an object a mesh component. To bring in a changed version of a model already in the project, use Mesh.replace_model(path), which keeps the mesh's ID.
with plupy.edit("Import a barrel"):
mesh = plupy.data.meshes.import_file("/Users/me/Downloads/barrel.glb")
barrel = plupy.data.objects.new("Barrel")
barrel.components.add("mesh", mesh=mesh)
plupy.data.scenes["Main"].objects.add(barrel)Related types#
DataCollection · Mesh · PlupyError · edit
Source#
- _live.py:346