trimesh.resolvers module

resolvers.py

Provides a common interface to load assets referenced by name like MTL files, texture images, etc. Assets can be from ZIP archives, web assets, or a local file path.

Classes

FilePathResolver(source)

Resolve files from a source path on the file system.

Resolver(*args, **kwargs)

The base class for resolvers.

WebResolver(url)

Resolve assets from a remote URL.

ZipResolver(archive)

Resolve files inside a ZIP archive.

class trimesh.resolvers.FilePathResolver(source)

Bases: trimesh.resolvers.Resolver

Resolve files from a source path on the file system.

Methods

get(name)

Get an asset.

write(name, data)

Write an asset to a file path.

get(name)

Get an asset.

Parameters

name (str) – Name of the asset

Returns

data – Loaded data from asset

Return type

bytes

write(name, data)

Write an asset to a file path.

Parameters
  • name (str) – Name of the file to write

  • data (str or bytes) – Data to write to the file

class trimesh.resolvers.Resolver(*args, **kwargs)

Bases: object

The base class for resolvers.

Methods

write(name, data)

write(name, data)
class trimesh.resolvers.WebResolver(url)

Bases: trimesh.resolvers.Resolver

Resolve assets from a remote URL.

Methods

get(name)

Get a resource from the remote site.

get(name)

Get a resource from the remote site.

Parameters

name (str) – Asset name, i.e. ‘quadknot.obj.mtl’

class trimesh.resolvers.ZipResolver(archive)

Bases: trimesh.resolvers.Resolver

Resolve files inside a ZIP archive.

Methods

get(name)

Get an asset from the ZIP archive.

get(name)

Get an asset from the ZIP archive.

Parameters

name (str) – Name of the asset

Returns

data – Loaded data from asset

Return type

bytes