Attention
You are viewing PyUnity docs under the develop
branch.
As such, they are only applicable if you installed from source.
Go to https://docs.pyunity.x10.bz/en/latest/ for the most recent
release.
pyunity.loader module¶
Source code: pyunity/loader.py
Utility functions related to loading and saving PyUnity meshes and scenes.
This will be imported as pyunity.Loader
.
- pyunity.loader.LoadObj(filename)[source]¶
Loads a .obj file to a PyUnity mesh.
- Parameters:
filename (Pathlike) – Name of file
- Returns:
A mesh of the object file
- Return type:
- pyunity.loader.SaveObj(mesh, path)[source]¶
Save a PyUnity Mesh to a .obj file.
- Parameters:
mesh (Mesh) – Mesh to save
path (Pathlike) – Path to save mesh
- pyunity.loader.LoadStl(filename)[source]¶
Loads a .stl mesh to a PyUnity mesh.
- Parameters:
filename (Pathlike) – Path to PyUnity mesh.
- Raises:
PyUnityException – If the file format is incorrect
- pyunity.loader.SaveStl(mesh, path)[source]¶
Save a PyUnity Mesh to a .stl file.
- Parameters:
mesh (Mesh) – Mesh to save
path (Pathlike) – Path to save mesh
- pyunity.loader.LoadMesh(filename)[source]¶
Loads a .mesh file generated by
SaveMesh()
. It is optimized for faster loading.- Parameters:
filename (Pathlike) – Name of file relative to the cwd
- Returns:
Generated mesh
- Return type:
- pyunity.loader.SaveMesh(mesh, path)[source]¶
Saves a mesh to a .mesh file for faster loading.
- Parameters:
mesh (Mesh) – Mesh to save
path (Pathlike) – Path to save mesh
- class pyunity.loader.Primitives[source]¶
Bases:
object
Primitive preloaded meshes. Do not instantiate this class.
- pyunity.loader.savable = (<class 'pyunity.meshes.Color'>, <class 'pyunity.values.vector.Vector3'>, <class 'pyunity.values.quaternion.Quaternion'>, <class 'bool'>, <class 'int'>, <class 'str'>, <class 'float'>, <class 'list'>, <class 'tuple'>, <class 'pyunity.core.SavesProjectID'>, <class 'pyunity.loader.ObjectInfo.SkipConv'>)¶
Type:
tuple
All savable types that will not be saved as UUIDs