data.DataDescription¶
-
moderngl_window.meta.data.
DataDescription
[source]¶ Describes data file to load.
This is a generic resource description type for loading resources that are not textures, programs and scenes. That loaded class is used depends on the
kind
or the file extension.Currently used to load:
text files
json files
binary files
# Describe a text file. Text loader is used based on file extension DataDescription(path='data/text.txt') # Describe a json file. Json loader is used based on file extension DataDescription(path='data/data.json') # Describe a binary file. Specify a binary loader should be used. DataDescription(path='data/data.bin', kind='binary')
Methods¶
Attributes¶
-
DataDescription.
path
¶ The path to a resource when a single file is specified
- Type
str
-
DataDescription.
resolved_path
¶ The resolved path by a finder.
The absolute path to the resource can optionally be assigned by a loader class.
- Type
pathlib.Path
-
DataDescription.
attrs
¶ All keywords arguments passed to the resource
- Type
dict
-
DataDescription.
label
¶ optional name for the resource
Assigning a label is not mandatory but can help when aliasing resources. Some prefer to preload all needed resources and fetch them later by the label. This can he a lot less chaotic in larger applications.
- Type
str
-
DataDescription.
kind
¶ default resource kind.
The resource
kind
is directly matched with thekind
in loder classes.This property also supports assignment and is useful if the
kind
is detected based in the the attribute values.description.kind = 'something'
- Type
str
-
DataDescription.
loader_cls
¶ The loader class for this resource.
This property is assigned to during the loading stage were a loader class is assigned based on the kind.
- Type
Type
-
DataDescription.
default_kind
= None¶
-
DataDescription.
resource_type
= 'data'¶