base.BaseLoader

Method

BaseLoader.__init__(meta)[source]

Initialize loader.

Loaders take a ResourceDescription instance containing all the parameters needed to load and initialize this data.

Parameters:meta (ResourceDescription) – The resource to load
classmethod BaseLoader.supports_file(meta)[source]

Check if the loader has a supported file extension.

What extensions are supported can be defiened in the file_extensions class attribute.

BaseLoader.load() → Any[source]

Loads a resource.

When creating a loader this is the only method that needs to be implemented.

Returns:The loaded resource
BaseLoader.find_data(path)[source]

Find resource using data finders.

This is mainly a shortcut method to simplify the task.

Parameters:path – Path to resource
BaseLoader.find_program(path)[source]

Find resource using program finders.

This is mainly a shortcut method to simplify the task.

Parameters:path – Path to resource
BaseLoader.find_texture(path)[source]

Find resource using texture finders.

This is mainly a shortcut method to simplify the task.

Parameters:path – Path to resource
BaseLoader.find_scene(path)[source]

Find resource using scene finders.

This is mainly a shortcut method to simplify the task.

Parameters:path – Path to resource

Attributes

BaseLoader.kind = None

The kind of resource this loaded supports. This can be used when file extensions is not enough to decide what loader should be selected.

BaseLoader.file_extensions = []

A list defining the file extensions accepted by this loader.

Example:

# Loader will match .xyz and .xyz.gz files.
file_extensions = [
    ['.xyz'],
    ['.xyz', '.gz'],
]
BaseLoader.ctx

ModernGL context

Type:moderngl.Context