Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: Refactor Load Types #2241

Open
wants to merge 73 commits into
base: main
Choose a base branch
from
Open

Release: Refactor Load Types #2241

wants to merge 73 commits into from

Conversation

mikedh
Copy link
Owner

@mikedh mikedh commented Jun 13, 2024

A very common source of annoyance and confusion is that trimesh.load can return lots of different types depending on what type of file was passed (i.e. #2239). This refactor changes the return types for the loading functions to:

  • trimesh.load_scene -> Scene
    • This loads into a Scene, the most general container which can hold any loadable type. Most people should probably use this to load geometry.
  • trimesh.load_mesh -> Trimesh
    • Forces all mesh objects in a scene into a single Trimesh object. This potentially has to drop information and irreversibly concatenate multiple meshes.
    • The implementation of the concatenation logic is now in Scene.to_mesh rather than load.
  • trimesh.load_path -> Path
    • This loads into either a Path2D or Path3D which both inherit from Path
  • trimesh.load -> Geometry
    • This was the original load entry point and is deprecated, but there are no current plans to remove it. It has been modified into a thin wrapper for load_scene that attempts to match the behavior of the previous loader for backwards compatibility. In my testing against the current main branch it was returning the same types 99.8% of the time although there may be other subtle differences.
    • trimesh.load(..., force='mesh') will emit a deprecation warning in favor of load_mesh
    • trimesh.load(..., force='scene') will emit a deprecation warning in favor of load_scene

Additional changes:

This was referenced Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants