File size: 3,582 Bytes
966b234
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
"""Read a build's recording again after deciding something about it.

    uv run python -m scripts.decide BUILD [--bodies N] [--judge]

scripts.splat_build makes a place and then reads things off the recording by rule: which of the things that move
are figures, which figure is the player's, who the player is up against, which figures get a body, what is drawn
on the screen, what happens. Rules are right most of the time and wrong in the case in front of you: a boss that is
not a person, a crowd, a prompt nothing noticed, a statue taken for a fighter. Whoever is building (an agent, a
person) looks, decides, writes it into BUILD/decisions.json and runs this; the rules then apply only where nothing
was decided. Every key is optional:

    {"figures": {"3": true, "5": false},          a thing of moving.json is a figure (its motion is read, it can have
                                                  a body) or is not, whatever the pose model made of it
     "player": 1,                                 the player's own figure (third person); null for none
     "roles": {"0": "opponent", "2": "other"},    who the player is up against, and who is merely there
     "bodies": [1, 0],                            which figures get a rigged model (Tripo), and no others
     "screen": {"drop": [[x0, y0, x1, y1]],       what lies in such a box of the picture (0 to 1) is not drawn on the screen
                "add": [{"box": [x0, y0, x1, y1], "at": 26.2}]}}     something is: a box of the picture and a moment it is
                                                  there (when it came and went is read from its pixels, as for the others)

What is behind the decisions is in the build to look at: moving.json and moving/ (every thing, its pictures),
actors.json (each one's evidence), overlays.json and overlays/, events.json; `scripts.probe BUILD frame T OUT.jpg`
for the recording itself. This does again what follows from them (actors.json, the models, overlays, events) and
leaves index.html alone. What a build is judged by stays as the pipeline read it: the list of what has to happen that
the judge holds (events.json is your copy of it) is not written again here, so a decision changes what your build
does, not what it is held to. ``--judge`` is for whoever runs the pipeline, on a place no builder has worked on: it
makes the page and that list again and fits the page's lag again. ``--bodies N`` is how many figures may get a body where decisions.json does not name them.
The place itself (cameras, splats, what was followed through the video) is not made again: for that, or to point
at a thing nothing followed (`--opponent`), run scripts.splat_build.
"""

from __future__ import annotations

import argparse
import sys
from pathlib import Path


def main(argv: list[str] | None = None) -> int:
    parser = argparse.ArgumentParser(description=__doc__.splitlines()[0])
    parser.add_argument("build", type=Path); parser.add_argument("--bodies", type=int, default=6); parser.add_argument("--judge", action="store_true")
    args = parser.parse_args(argv)
    from scripts import splat_build

    build = args.build.resolve(); data = Path((build / ".data").read_text().strip()) if (build / ".data").is_file() else build / ".splat" / "data"
    figures = args.bodies if (build / "actors.json").is_file() or (build / "decisions.json").is_file() else 0
    if args.judge:
        return splat_build.page(build, data.parent, figures)
    splat_build.findings(build, data.parent, figures, fresh=False)
    return 0


if __name__ == "__main__":
    sys.exit(main())