bread-format 0.1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- bread_format/__init__.py +44 -0
- bread_format/_bytes.py +127 -0
- bread_format/_zstd.py +80 -0
- bread_format/container.py +84 -0
- bread_format/errors.py +41 -0
- bread_format/file.py +192 -0
- bread_format/mesh.py +375 -0
- bread_format/meshopt.py +253 -0
- bread_format/metadata.py +80 -0
- bread_format/scene.py +163 -0
- bread_format/slicer.py +136 -0
- bread_format-0.1.0.dist-info/METADATA +107 -0
- bread_format-0.1.0.dist-info/RECORD +16 -0
- bread_format-0.1.0.dist-info/WHEEL +5 -0
- bread_format-0.1.0.dist-info/licenses/LICENSE +201 -0
- bread_format-0.1.0.dist-info/top_level.txt +1 -0
bread_format/scene.py
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 SynrgStudio
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
"""The scene chunk, SCNE (SPEC 5)."""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from collections.abc import Iterator
|
|
9
|
+
from dataclasses import dataclass
|
|
10
|
+
|
|
11
|
+
from ._bytes import Fields, Meta
|
|
12
|
+
from .errors import Malformed
|
|
13
|
+
|
|
14
|
+
#: A transform: the 3 x 3 matrix M, row by row, then the translation t, so
|
|
15
|
+
#: that a point p goes to M p + t (SPEC 5.2).
|
|
16
|
+
Transform = tuple[tuple[float, float, float], tuple[float, float, float], tuple[float, float, float], tuple[float, float, float]]
|
|
17
|
+
|
|
18
|
+
IDENTITY: Transform = ((1.0, 0.0, 0.0), (0.0, 1.0, 0.0), (0.0, 0.0, 1.0), (0.0, 0.0, 0.0))
|
|
19
|
+
|
|
20
|
+
GROUP, LEAF, SHARED_LEAF, REFERENCE, SUBTREE = 0, 1, 2, 4, 5
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True)
|
|
24
|
+
class Node:
|
|
25
|
+
"""A node record. ``kind`` is ``"group"``, ``"leaf"``, ``"shared leaf"``
|
|
26
|
+
or ``"reference"``; ``transform`` is None for a node stored without one,
|
|
27
|
+
which is the identity. Then, by kind: ``children`` (node indices),
|
|
28
|
+
``mesh`` (a mesh index), ``resource`` (a mesh resource index) or
|
|
29
|
+
``subtree`` (a subtree index)."""
|
|
30
|
+
|
|
31
|
+
kind: str
|
|
32
|
+
meta: Meta | None
|
|
33
|
+
transform: Transform | None
|
|
34
|
+
children: tuple[int, ...] = ()
|
|
35
|
+
mesh: int | None = None
|
|
36
|
+
resource: int | None = None
|
|
37
|
+
subtree: int | None = None
|
|
38
|
+
|
|
39
|
+
@property
|
|
40
|
+
def is_leaf(self) -> bool:
|
|
41
|
+
return self.kind in ("leaf", "shared leaf")
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
@dataclass(frozen=True)
|
|
45
|
+
class Scene:
|
|
46
|
+
meta: Meta | None
|
|
47
|
+
mesh_count: int
|
|
48
|
+
mesh_resources: tuple[int, ...]
|
|
49
|
+
nodes: tuple[Node, ...]
|
|
50
|
+
subtrees: tuple[int, ...]
|
|
51
|
+
roots: tuple[int, ...]
|
|
52
|
+
|
|
53
|
+
def mesh_of(self, node: int) -> int | None:
|
|
54
|
+
"""The mesh index a leaf shows, through the mesh resources for a
|
|
55
|
+
shared leaf, or None for a node that is not a leaf."""
|
|
56
|
+
n = self.nodes[node]
|
|
57
|
+
if n.kind == "leaf":
|
|
58
|
+
return n.mesh
|
|
59
|
+
if n.kind == "shared leaf":
|
|
60
|
+
return self.mesh_resources[n.resource]
|
|
61
|
+
return None
|
|
62
|
+
|
|
63
|
+
def placements(self) -> Iterator[tuple[int, int, Transform]]:
|
|
64
|
+
"""Every leaf shown, with the mesh it shows and its world transform,
|
|
65
|
+
in the order of the walk of SPEC 5.4. A leaf inside a subtree comes
|
|
66
|
+
once for every reference that reaches it."""
|
|
67
|
+
for root in self.roots:
|
|
68
|
+
yield from self._walk(root, IDENTITY)
|
|
69
|
+
|
|
70
|
+
def _walk(self, index: int, parent: Transform) -> Iterator[tuple[int, int, Transform]]:
|
|
71
|
+
node = self.nodes[index]
|
|
72
|
+
world = compose(parent, node.transform or IDENTITY)
|
|
73
|
+
if node.kind == "group":
|
|
74
|
+
for child in node.children:
|
|
75
|
+
yield from self._walk(child, world)
|
|
76
|
+
elif node.kind == "reference":
|
|
77
|
+
yield from self._walk(self.subtrees[node.subtree], world)
|
|
78
|
+
else:
|
|
79
|
+
yield index, self.mesh_of(index), world
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
def compose(a: Transform, b: Transform) -> Transform:
|
|
83
|
+
"""a after b: the transform that takes p to a(b(p)), in f64 (SPEC 5.4)."""
|
|
84
|
+
(a0, a1, a2, at), (b0, b1, b2, bt) = (a[0], a[1], a[2], a[3]), (b[0], b[1], b[2], b[3])
|
|
85
|
+
rows = (a0, a1, a2)
|
|
86
|
+
cols = tuple(zip(b0, b1, b2))
|
|
87
|
+
linear = tuple(tuple(sum(r[k] * c[k] for k in range(3)) for c in cols) for r in rows)
|
|
88
|
+
translation = tuple(sum(r[k] * bt[k] for k in range(3)) + at[i] for i, r in enumerate(rows))
|
|
89
|
+
return (*linear, translation)
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def apply(transform: Transform, point: tuple[float, float, float]) -> tuple[float, float, float]:
|
|
93
|
+
"""M p + t, in f64."""
|
|
94
|
+
m0, m1, m2, t = transform
|
|
95
|
+
return tuple(sum(row[k] * point[k] for k in range(3)) + t[i] for i, row in enumerate((m0, m1, m2)))
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def read_scene(payload: bytes) -> Scene:
|
|
99
|
+
"""Reads and checks a scene payload of version 1 (SPEC 5.1 to 5.3)."""
|
|
100
|
+
f = Fields(payload)
|
|
101
|
+
meta = f.meta()
|
|
102
|
+
mesh_count = f.u32()
|
|
103
|
+
|
|
104
|
+
resources = []
|
|
105
|
+
for _ in range(f.count(4)):
|
|
106
|
+
mesh = f.u32()
|
|
107
|
+
if mesh >= mesh_count:
|
|
108
|
+
raise Malformed
|
|
109
|
+
resources.append(mesh)
|
|
110
|
+
|
|
111
|
+
nodes: list[Node] = []
|
|
112
|
+
subtrees: list[int] = []
|
|
113
|
+
placed: set[int] = set()
|
|
114
|
+
|
|
115
|
+
def place(node: int) -> None:
|
|
116
|
+
# Names only what is listed before, and gives each node one place.
|
|
117
|
+
if node >= len(nodes) or node in placed:
|
|
118
|
+
raise Malformed
|
|
119
|
+
placed.add(node)
|
|
120
|
+
|
|
121
|
+
# A record takes at least 5 bytes: a subtree's kind and node index.
|
|
122
|
+
for _ in range(f.count(5)):
|
|
123
|
+
kind = f.u8()
|
|
124
|
+
if kind == SUBTREE:
|
|
125
|
+
root = f.u32()
|
|
126
|
+
place(root)
|
|
127
|
+
subtrees.append(root)
|
|
128
|
+
continue
|
|
129
|
+
if kind not in (GROUP, LEAF, SHARED_LEAF, REFERENCE):
|
|
130
|
+
raise Malformed
|
|
131
|
+
node_meta = f.meta()
|
|
132
|
+
transform = _transform(f) if f.flag() else None
|
|
133
|
+
if kind == GROUP:
|
|
134
|
+
children = tuple(f.u32() for _ in range(f.count(4)))
|
|
135
|
+
for child in children:
|
|
136
|
+
place(child)
|
|
137
|
+
nodes.append(Node("group", node_meta, transform, children=children))
|
|
138
|
+
elif kind == LEAF:
|
|
139
|
+
mesh = f.u32()
|
|
140
|
+
if mesh >= mesh_count:
|
|
141
|
+
raise Malformed
|
|
142
|
+
nodes.append(Node("leaf", node_meta, transform, mesh=mesh))
|
|
143
|
+
elif kind == SHARED_LEAF:
|
|
144
|
+
resource = f.u32()
|
|
145
|
+
if resource >= len(resources):
|
|
146
|
+
raise Malformed
|
|
147
|
+
nodes.append(Node("shared leaf", node_meta, transform, resource=resource))
|
|
148
|
+
else:
|
|
149
|
+
subtree = f.u32()
|
|
150
|
+
if subtree >= len(subtrees):
|
|
151
|
+
raise Malformed
|
|
152
|
+
nodes.append(Node("reference", node_meta, transform, subtree=subtree))
|
|
153
|
+
|
|
154
|
+
roots = tuple(f.u32() for _ in range(f.count(4)))
|
|
155
|
+
for root in roots:
|
|
156
|
+
place(root)
|
|
157
|
+
f.end()
|
|
158
|
+
return Scene(meta, mesh_count, tuple(resources), tuple(nodes), tuple(subtrees), roots)
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
def _transform(f: Fields) -> Transform:
|
|
162
|
+
values = [f.f64() for _ in range(12)]
|
|
163
|
+
return (tuple(values[0:3]), tuple(values[3:6]), tuple(values[6:9]), tuple(values[9:12]))
|
bread_format/slicer.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# SPDX-FileCopyrightText: 2026 SynrgStudio
|
|
2
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
3
|
+
|
|
4
|
+
"""The chunks a slicer adds: the application chunks PROJ, SUPP and HOLW
|
|
5
|
+
(SPEC 7.3), support previews, SPRV (SPEC 9), and surface paint, SURF
|
|
6
|
+
(SPEC 10). Only their envelopes: what a document holds belongs to the program
|
|
7
|
+
that wrote it."""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
import hashlib
|
|
12
|
+
import struct
|
|
13
|
+
from dataclasses import dataclass
|
|
14
|
+
|
|
15
|
+
from ._bytes import Fields
|
|
16
|
+
from .errors import Malformed
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
@dataclass(frozen=True)
|
|
20
|
+
class Entry:
|
|
21
|
+
"""A SUPP or HOLW entry. ``part`` is the support leaf's node index in
|
|
22
|
+
SUPP, and the original's mesh index in HOLW."""
|
|
23
|
+
|
|
24
|
+
model: int
|
|
25
|
+
part: int
|
|
26
|
+
generator: str
|
|
27
|
+
version: int
|
|
28
|
+
document: bytes
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def read_entries(payload: bytes) -> list[Entry]:
|
|
32
|
+
"""The entries of a SUPP or HOLW payload of version 2."""
|
|
33
|
+
f = Fields(payload)
|
|
34
|
+
entries = []
|
|
35
|
+
for _ in range(f.count(20)):
|
|
36
|
+
model = f.u32()
|
|
37
|
+
part = f.u32()
|
|
38
|
+
generator = f.text()
|
|
39
|
+
version = f.u32()
|
|
40
|
+
entries.append(Entry(model, part, generator, version, bytes(f.byte_string())))
|
|
41
|
+
f.end()
|
|
42
|
+
return entries
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
@dataclass(frozen=True)
|
|
46
|
+
class Preview:
|
|
47
|
+
"""A support preview: the support leaf, and its mesh's version 1 payload."""
|
|
48
|
+
|
|
49
|
+
leaf: int
|
|
50
|
+
mesh: bytes
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
def read_previews(payload: bytes) -> list[Preview]:
|
|
54
|
+
"""The previews of a SPRV payload of version 1, their meshes still
|
|
55
|
+
encoded."""
|
|
56
|
+
f = Fields(payload)
|
|
57
|
+
previews = []
|
|
58
|
+
for _ in range(f.count(8)):
|
|
59
|
+
leaf = f.u32()
|
|
60
|
+
previews.append(Preview(leaf, bytes(f.byte_string())))
|
|
61
|
+
f.end()
|
|
62
|
+
return previews
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@dataclass(frozen=True)
|
|
66
|
+
class Paint:
|
|
67
|
+
"""A SURF entry: one mask over the triangles of one leaf's mesh."""
|
|
68
|
+
|
|
69
|
+
leaf: int
|
|
70
|
+
kind: int # 0 detail, 1 supports must touch, 2 supports must not touch
|
|
71
|
+
version: int
|
|
72
|
+
document: bytes
|
|
73
|
+
|
|
74
|
+
def values(self, mesh) -> bytes | None:
|
|
75
|
+
"""The value of every triangle of ``mesh``, 0 to 255, or None when the
|
|
76
|
+
entry is to be treated as absent (SPEC 10.2): a reserved kind, a
|
|
77
|
+
document version other than 1, a malformed document, or one painted
|
|
78
|
+
on another mesh."""
|
|
79
|
+
if self.kind > 2 or self.version != 1:
|
|
80
|
+
return None
|
|
81
|
+
try:
|
|
82
|
+
f = Fields(self.document)
|
|
83
|
+
triangle_count = f.u32()
|
|
84
|
+
fingerprint = bytes(f.take(48))
|
|
85
|
+
runs = [(f.u32(), f.u8()) for _ in range(f.count(5))]
|
|
86
|
+
f.end()
|
|
87
|
+
except Malformed:
|
|
88
|
+
return None
|
|
89
|
+
if triangle_count != mesh.triangle_count or fingerprint != fingerprint_of(mesh):
|
|
90
|
+
return None
|
|
91
|
+
if sum(length for length, _ in runs) != triangle_count:
|
|
92
|
+
return None
|
|
93
|
+
return b"".join(bytes([value]) * length for length, value in runs)
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
def read_paint(payload: bytes) -> list[Paint]:
|
|
97
|
+
"""The entries of a SURF payload of version 1."""
|
|
98
|
+
f = Fields(payload)
|
|
99
|
+
entries = []
|
|
100
|
+
for _ in range(f.count(13)):
|
|
101
|
+
leaf = f.u32()
|
|
102
|
+
kind = f.u8()
|
|
103
|
+
version = f.u32()
|
|
104
|
+
entries.append(Paint(leaf, kind, version, bytes(f.byte_string())))
|
|
105
|
+
f.end()
|
|
106
|
+
return entries
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@dataclass(frozen=True)
|
|
110
|
+
class Role:
|
|
111
|
+
"""A ROLE entry: a leaf that is not a model (SPEC 11)."""
|
|
112
|
+
|
|
113
|
+
leaf: int
|
|
114
|
+
role: int # 1 supports, 2 a raft; other values are reserved and mean a model
|
|
115
|
+
|
|
116
|
+
@property
|
|
117
|
+
def is_known(self) -> bool:
|
|
118
|
+
return self.role in (1, 2)
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
def read_roles(payload: bytes) -> list[Role]:
|
|
122
|
+
"""The entries of a ROLE payload of version 1."""
|
|
123
|
+
f = Fields(payload)
|
|
124
|
+
entries = [Role(f.u32(), f.u8()) for _ in range(f.count(5))]
|
|
125
|
+
f.end()
|
|
126
|
+
return entries
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
def fingerprint_of(mesh) -> bytes:
|
|
130
|
+
"""The SHA-384 digest that names a mesh (SPEC 10.1)."""
|
|
131
|
+
digest = hashlib.sha384()
|
|
132
|
+
digest.update(struct.pack("<Q", mesh.vertex_count))
|
|
133
|
+
digest.update(mesh.vertex_bytes())
|
|
134
|
+
digest.update(struct.pack("<Q", mesh.triangle_count))
|
|
135
|
+
digest.update(mesh.triangle_bytes())
|
|
136
|
+
return digest.digest()
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: bread-format
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Reads .bread files: triangle meshes kept bit for bit, and the scene that places them.
|
|
5
|
+
License-Expression: Apache-2.0
|
|
6
|
+
Project-URL: Homepage, https://bread.synrgs.tech
|
|
7
|
+
Project-URL: Specification, https://github.com/breadslicer-app/bread-format/blob/main/SPEC.md
|
|
8
|
+
Project-URL: Source, https://github.com/breadslicer-app/bread-format/tree/main/python
|
|
9
|
+
Project-URL: Issues, https://github.com/breadslicer-app/bread-format/issues
|
|
10
|
+
Keywords: 3d,mesh,stl,3d-printing,resin,file-format,bread
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Operating System :: OS Independent
|
|
21
|
+
Classifier: Topic :: File Formats
|
|
22
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Rendering
|
|
23
|
+
Classifier: Topic :: Multimedia :: Graphics :: 3D Modeling
|
|
24
|
+
Requires-Python: >=3.10
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
Requires-Dist: zstandard>=0.23; python_version < "3.14"
|
|
28
|
+
Dynamic: license-file
|
|
29
|
+
|
|
30
|
+
# bread-format for Python
|
|
31
|
+
|
|
32
|
+
Reads `.bread` files: triangle meshes, kept bit for bit, and the scene that places them.
|
|
33
|
+
|
|
34
|
+
This reader is written from the specification alone,
|
|
35
|
+
[`SPEC.md`](https://github.com/breadslicer-app/bread-format/blob/main/SPEC.md), without the code of
|
|
36
|
+
the reference implementation. It reads every conformance file the way the reference reader does,
|
|
37
|
+
which shows that the specification is enough to read the format. Being plain Python, it is also
|
|
38
|
+
meant to be read, and to be a starting point for importing `.bread` into other programs.
|
|
39
|
+
|
|
40
|
+
## Install
|
|
41
|
+
|
|
42
|
+
```text
|
|
43
|
+
pip install bread-format
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
It needs Python 3.10 or later. On Python 3.14 and later it uses nothing but the standard library,
|
|
47
|
+
whose `compression.zstd` decompresses the chunks; before 3.14, pip also installs the `zstandard`
|
|
48
|
+
package for that.
|
|
49
|
+
|
|
50
|
+
## Use
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from bread_format import BreadError, read_file
|
|
54
|
+
|
|
55
|
+
with open("model.bread", "rb") as f:
|
|
56
|
+
bread = read_file(f.read())
|
|
57
|
+
|
|
58
|
+
for leaf, mesh, transform in bread.placements():
|
|
59
|
+
node = bread.scene.nodes[leaf]
|
|
60
|
+
print(node.meta and node.meta.name, mesh.vertex_count, mesh.triangle_count)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
`read_file` returns a `BreadFile`:
|
|
64
|
+
|
|
65
|
+
| Field | What it holds |
|
|
66
|
+
|---|---|
|
|
67
|
+
| `scene` | the scene: `nodes`, `roots`, `subtrees`, `mesh_resources`, and its `meta` |
|
|
68
|
+
| `meshes` | one `Mesh` per `MESH` chunk, in file order |
|
|
69
|
+
| `settings` | the `PROJ` payload, a TOML document, or `None` |
|
|
70
|
+
| `thumbnail` | the `THMB` payload, a PNG, or `None` |
|
|
71
|
+
| `supports`, `hollows` | the `SUPP` and `HOLW` entries |
|
|
72
|
+
| `support_previews` | each support leaf with a preview, mapped to its mesh |
|
|
73
|
+
| `surface` | the `SURF` entries; `entry.values(mesh)` gives the paint of each triangle |
|
|
74
|
+
| `metadata` | the `META` entries a reader keeps: each has `node` (`None` for the whole file), `key` and `value`, and `text` or `uuid` for the registered keys |
|
|
75
|
+
| `roles` | the `ROLE` entries: each `leaf` that is not a model, and its `role`, `1` supports or `2` a raft (`is_known` is false for a reserved role, which means a model) |
|
|
76
|
+
|
|
77
|
+
A `Mesh` keeps its vertices as the bits of their `f32` coordinates, so that every one comes back
|
|
78
|
+
exactly, NaN payloads included:
|
|
79
|
+
|
|
80
|
+
- `mesh.vertex_bytes()` and `mesh.triangle_bytes()` give them as little-endian `f32` and `u32`,
|
|
81
|
+
ready for an array library: `numpy.frombuffer(mesh.vertex_bytes(), "<f4").reshape(-1, 3)`;
|
|
82
|
+
- `mesh.positions()` gives each vertex as three Python floats.
|
|
83
|
+
|
|
84
|
+
`placements()` walks the scene from each root (SPEC 5.4) and gives every leaf shown, its mesh and
|
|
85
|
+
its world transform, a 3 × 3 matrix and a translation in `f64`. `apply(transform, point)` places a
|
|
86
|
+
point.
|
|
87
|
+
|
|
88
|
+
Lengths are millimetres, with Z up (SPEC 3.5).
|
|
89
|
+
|
|
90
|
+
When a file is refused, `read_file` raises `BreadError`, whose `reason` is one of the reason codes
|
|
91
|
+
of [`conformance/README.md`](https://github.com/breadslicer-app/bread-format/blob/main/conformance/README.md), such as `"crc"` or `"malformed"`, and
|
|
92
|
+
whose `chunk` names the chunk at fault.
|
|
93
|
+
|
|
94
|
+
## Speed
|
|
95
|
+
|
|
96
|
+
The reader favours being easy to follow over being fast: a mesh of 2 million triangles takes about
|
|
97
|
+
half a minute. For speed, use the reference implementation, the `bread-format` Rust crate.
|
|
98
|
+
|
|
99
|
+
## Tests
|
|
100
|
+
|
|
101
|
+
```text
|
|
102
|
+
python -m unittest discover -s tests
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
run from this folder with `src` on `PYTHONPATH`, or after `pip install -e .`. They read every file
|
|
106
|
+
in [`conformance/`](https://github.com/breadslicer-app/bread-format/tree/main/conformance), so they
|
|
107
|
+
run from a clone of the repository.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
bread_format/__init__.py,sha256=5lxnlg0Y9dSc_9zu7-op-1PJgOY7ygzmKqEY7Zj9ltk,1082
|
|
2
|
+
bread_format/_bytes.py,sha256=WLmE5XCV6Va0nT__S2MY1KRR3W9ZBqM618dsQZG7jW0,3678
|
|
3
|
+
bread_format/_zstd.py,sha256=9OsgiMkWbdRSbOnOcY8ZvHtpzIyVMHpp7s-3fdWYV5o,2991
|
|
4
|
+
bread_format/container.py,sha256=f9BDBWv6R-fjjMBEBXarGgrB3q1ir_wfVaZO-yfaIQc,3023
|
|
5
|
+
bread_format/errors.py,sha256=jIKsPcejPZrSOFbzgSlVakR1hq9UbUU-UR4XBRIXlAw,1485
|
|
6
|
+
bread_format/file.py,sha256=Xondkqg-h7hC76jpgdv5JeJY2u3ttE9xwAce6s__69A,7638
|
|
7
|
+
bread_format/mesh.py,sha256=8R2g6jQT6BfCjRTq04UU9eaNO4PAdKvARHYoFxCrTLU,13426
|
|
8
|
+
bread_format/meshopt.py,sha256=ImJHHU53YKh1ny5Rf3uS7I-OSEc-loN_t4MCbKi9lN8,9021
|
|
9
|
+
bread_format/metadata.py,sha256=hgKqWNrSp-SAyM56z62-Qgyt5tuYpIpAbJPBRpl9IM0,2538
|
|
10
|
+
bread_format/scene.py,sha256=rb0HTLZdAUFdcMTtMpLBuw_vBO1Vi19mVEK6Ajnaatg,6030
|
|
11
|
+
bread_format/slicer.py,sha256=TdQ8q2uRLGMiJ6sDPDytrkfHCUI1u7IaQ8dsO_af7W8,4115
|
|
12
|
+
bread_format-0.1.0.dist-info/licenses/LICENSE,sha256=HrhfyXIkWY2tGFK11kg7vPCqhgh5DcxleloqdhrpyMY,11558
|
|
13
|
+
bread_format-0.1.0.dist-info/METADATA,sha256=WOlS5gnlQvnTiWiHhGzCXTpGLnBEGelnsxS0hdNzReo,4906
|
|
14
|
+
bread_format-0.1.0.dist-info/WHEEL,sha256=mOdXR9C3wMVov7cSY8PY-XCzo3SmmWCHvGQr5csJoao,91
|
|
15
|
+
bread_format-0.1.0.dist-info/top_level.txt,sha256=hCWwwXAQ9G9U7VNGYyXqjvFMReEai5bT95Fpi-Mijvk,13
|
|
16
|
+
bread_format-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bread_format
|