Skip to main content

Module ownership

Module ownership 

Source
Expand description

Checks that an edit changed only what the editor owns (SPEC.md, section 7.4). Nothing in a file can stop a program from changing another program’s data, but a program that writes through this crate can call check_edit before saving, and its tests can too.

The scene, the meshes that leaves show, the metadata, the roles and the thumbnail are shared. The settings, the supports, the hollows and the support previews belong to Breadslicer (BREADSLICER). Each program data, surface paint and volume entry belongs to the program it names, and a mesh that no leaf shows to the owner of the entry that names it. Paint read from surface chunk version 1 names no program, so anyone may change it. The chunks this build does not know are kept as they were read, unless the edit removes or renumbers nodes or meshes.

Structs§

Remap
Where each node and each mesh of the original file went in the edited one: nodes[i] is the new index of node i, or None if the edit removed it, and the same for meshes.

Enums§

Change
How data changed.
Data
A part of a file, named by its indices in the original file.
Editor
Who made an edit.
Violation
A change the editor may not make.

Constants§

BREADSLICER
The program name that owns the application chunks (PROJ, SUPP, HOLW) and the support preview (SPRV).

Functions§

check_edit
Checks that edited changes original only where editor may, with every node and mesh keeping its index. Returns every change it may not make.
check_edit_remapped
Checks that edited changes original only where editor may, with the nodes and meshes moved or removed as remap says. Entries about a removed node may be gone, whoever owns them; an entry that names a moved node or mesh must name its new index. A mesh repair keeps every index, so for Editor::MeshRepair a remap other than the identity is a violation.