ContentPack¶
from acron.core import ContentPack
- class ContentPack¶
Bases:
Bases:
ReferenceCountA pack of the program’s files, kept in a Multifile apart from the files it starts with, so that a large program can start before all of it has arrived. On the web, a pack is downloaded in the background by the page (packs/<name>.mf beside it) while the program runs; on the desktop it is packs/<name>.mf beside the program, or nothing at all when the files were not packed, so the same code runs on both:
pack = ContentPack.request(“arena”) # starts the download … if pack.is_ready(): # mounted: load from it loader.load_model(“maps/arena/arena.bam”)
A pack is mounted over the directory the program was started in (or the mount point given to
request()), so its files keep the paths they had in the program’s directory.Inheritance diagram
digraph inheritance00ecde5ac2 { bgcolor=transparent; rankdir=BT; size="8.0, 12.0"; "ContentPack" [URL="acron.core.ContentPack.html#acron.core.ContentPack",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "ReferenceCount" -> "ContentPack" [arrowsize=0.75,style=""]; "DTOOL_SUPER_BASE" [fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style=""]; "ReferenceCount" [URL="acron.core.ReferenceCount.html#acron.core.ReferenceCount",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=11,height=0.25,shape=box,style="",target="_top",tooltip="/**"]; "DTOOL_SUPER_BASE" -> "ReferenceCount" [arrowsize=0.75,style=""]; }-
enum State
-
enumerator S_loading = 0¶
being downloaded
-
enumerator S_ready = 1¶
mounted, or nothing to mount
-
enumerator S_failed = 2¶
could not be downloaded or opened; see get_error()
-
enumerator S_loading = 0¶
- __init__()¶
- get_bytes_loaded()¶
Bytes of the pack downloaded so far (0 when it is not streamed).
- get_bytes_total()¶
The pack’s size in bytes, when known (0 when it is not streamed).
- get_error()¶
Why the pack failed, or the empty string.
- get_name()¶
The pack’s name: packs/<name>.mf.
- static get_pack()¶
The pack requested under this name, or nullptr.
- get_progress()¶
How much of the pack is here, 0 to 1 (1 once it is ready).
- get_state()¶
Loading, ready (mounted) or failed. Mounts the pack once it has arrived.
- is_failed()¶
True if the pack could not be downloaded or mounted.
- is_ready()¶
True once the pack is mounted (or there was nothing to mount): its files can be loaded.
- static is_streamed()¶
True when packs are downloaded while the program runs (on the web); false when they are local files, ready at once.
- static request()¶
Starts getting the named pack (once; later calls return the same object). Its files are mounted over mount_point, by default the current directory, which is the program’s own when it starts.
-
enum State