Document generating collision outlines (#161)
- Textures: new section "Generate collision..." with the dialog rows and how the outline is traced. - Architecture: traceCollision and GenerateCollisionDialog. - Development: check sum 1202 (computed). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent
a79833f4bb
commit
3d5f892afb
3 files changed
+25
-3
No files matched your search
+2
-2
@@ -68,7 +68,7 @@
|
||||
|
||||
```
|
||||
web/index.html Vite source page (dev) index.html built page (generated, served)
|
||||
src/core/model/ Project (object holders), Asset + AssetTypes, SceneObject, Properties (value types), hierarchy, walk (generic parent/child walks), instance (container content resolved from its template), usages (where an asset is used), container (the cycle guard), placement (what may be dropped where), texture (frames, the slice grid, a frame's collision outlines), frameOutline (#193: a frame's outlines as a collider wears them, centred, a pixel to a unit, cut into pieces once per drawn list), generated (pictures that are drawn rather than uploaded, #185: the key `gen:<assetId>@<revision>` and the register of readers that tell the picture path an asset's canvas size and revision), vectorart (#129: the canvas as a property, which ring is worth drawing, and the revision as a fingerprint of the drawing rather than a counter) + vectorPath (what a shape draws, as plain commands: closed rings fill, every ring strokes, a segment is a line while neither of its ends carries a handle), polygon (an outline checked, cut into convex pieces and clipped to a rectangle), tile (the three kinds and their block shapes, reading a tile's pictures, the animation step), autotile (which quarter tile a neighbourhood asks for, the 47/16 tiles a block produces, 1 for a plain tile), tilemap (the cells of a layer, which neighbours a cell is joined to, the cells a stroke or a rectangle covers), tilemapCollision (the solid cells of a map, drawn in or out by their tile's collision scale and merged into rectangles, one group per one-way angle and per surface (`tileMaterials`, #193), the outlined cells as polygons — an autotile's outlines cut into its quarters and pieced together per cell like its picture —, where one sits in the world, and which cells of a placed map a world rectangle can reach, in cells (`cellsWithin`, #184)), animation (which frame at time t, a row's value there, what a row may aim at, the players on an object; KeyRef and its lookups) + animationPreview (the root at a frame, written into copies), graphLookup (what a graph sees of the project: behaviors to run, state machines to read), Scope (where a state machine's current state lives: per instance or one for the run — variables are shared by living on a Variables asset instead), collisionLayers (which colliders may meet: the project's named layers, a collider's layer and mask, and the one rule `layersMeet` the engine, Solids and the event pair search all answer by)
|
||||
src/core/model/ Project (object holders), Asset + AssetTypes, SceneObject, Properties (value types), hierarchy, walk (generic parent/child walks), instance (container content resolved from its template), usages (where an asset is used), container (the cycle guard), placement (what may be dropped where), texture (frames, the slice grid, a frame's collision outlines), frameOutline (#193: a frame's outlines as a collider wears them, centred, a pixel to a unit, cut into pieces once per drawn list), traceCollision (#161: a frame's outlines read off its picture — the pixels from an alpha threshold on are solid, each 4-connected island is walked round along the pixel edges and cut down to a few corners without ever crossing itself; crumbs below 1 % of the frame drop out), generated (pictures that are drawn rather than uploaded, #185: the key `gen:<assetId>@<revision>` and the register of readers that tell the picture path an asset's canvas size and revision), vectorart (#129: the canvas as a property, which ring is worth drawing, and the revision as a fingerprint of the drawing rather than a counter) + vectorPath (what a shape draws, as plain commands: closed rings fill, every ring strokes, a segment is a line while neither of its ends carries a handle), polygon (an outline checked, cut into convex pieces and clipped to a rectangle), tile (the three kinds and their block shapes, reading a tile's pictures, the animation step), autotile (which quarter tile a neighbourhood asks for, the 47/16 tiles a block produces, 1 for a plain tile), tilemap (the cells of a layer, which neighbours a cell is joined to, the cells a stroke or a rectangle covers), tilemapCollision (the solid cells of a map, drawn in or out by their tile's collision scale and merged into rectangles, one group per one-way angle and per surface (`tileMaterials`, #193), the outlined cells as polygons — an autotile's outlines cut into its quarters and pieced together per cell like its picture —, where one sits in the world, and which cells of a placed map a world rectangle can reach, in cells (`cellsWithin`, #184)), animation (which frame at time t, a row's value there, what a row may aim at, the players on an object; KeyRef and its lookups) + animationPreview (the root at a frame, written into copies), graphLookup (what a graph sees of the project: behaviors to run, state machines to read), Scope (where a state machine's current state lives: per instance or one for the run — variables are shared by living on a Variables asset instead), collisionLayers (which colliders may meet: the project's named layers, a collider's layer and mask, and the one rule `layersMeet` the engine, Solids and the event pair search all answer by)
|
||||
src/core/properties/ PropertySchema, kinds (one row per value kind), listItems (an item's kind, read off its value), resolve (the only override merge), deviation (what is gold), collider/camera/bounds geometry (with the side a one-way collider blocks from, and the rectangle around a shape a broad phase looks at first, #184), convex (capsules and polygons: rounded convex pieces against each other), ray (where a ray meets a shape, in double precision), rigidbody (what the engine reads off a rigidbody, a collider's material and the scene), aspect, enabled, editorRun, assetRef/textureRef (how a reference reads), declaredRows (the row a Property node declares in a shader or particle graph, and the params that node has in both)
|
||||
src/core/util/ list (take out, put back and move an item — what a command's undo is made of), vec (dot, the closest point on a segment — shared by the collider maths, the outline hit area and the polygon grips)
|
||||
src/core/commands/ undoable commands, CommandStack, SetBagValueCommand base, RenameCommand base (undone by renaming back: variable, struct field, port), one import command shape for texture/font/sound, require.ts (validated lookups, and what an instance may not change), naming.ts
|
||||
@@ -162,7 +162,7 @@ src/editor/graph/ GraphEditor (header, breadcrumb), GraphCanvas, graphView
|
||||
AnnotationView + annotationDrag (groups and comments: what a drag carries, each thing moved once),
|
||||
SnapToggle (the magnet every tab that snaps carries, the vector art tab included, #194)
|
||||
src/editor/container/ ContainerEditor (header), ContainerCanvas (a SceneViewport on a template)
|
||||
src/editor/texture/ TextureEditor (header), TextureCanvas (picture + frames), SliceDialog (a FormDialog), sheetView (the grid maths),
|
||||
src/editor/texture/ TextureEditor (header), TextureCanvas (picture + frames), SliceDialog (a FormDialog), GenerateCollisionDialog (#161: the rows, and a summary that traces while the numbers change; the texture library hands it the sheet's pixels), sheetView (the grid maths),
|
||||
ImagePicker + imageGrid (the "+ → Texture" dialog), checker (the transparency board)
|
||||
src/editor/vectorart/ VectorArtEditor (header: the two tools, the picked point's type and the magnet), VectorArtCanvas (the drawing
|
||||
painted from core/model/vectorPath onto its own Graphics, with points and handles over it;
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@ npm run check # typecheck + lint + format:check + tests, the gate CI runs
|
||||
npm run build # writes dist/ and regenerates index.html
|
||||
./build.sh # the same under `set -o pipefail`, for callers that pipe the output
|
||||
php tools/make-user.php <name> <password> # an account; every tool signs in (see Accounts)
|
||||
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1198 editor checks, screenshots in /tmp/gm-e2e-*.png
|
||||
node tools/seed-e2e.mjs && node tools/e2e.mjs # 1202 editor checks, screenshots in /tmp/gm-e2e-*.png
|
||||
GM_STEPS=20 node tools/e2e.mjs # or 1-12, or 6,20 — a subset while working on one step
|
||||
./e2e.sh start [GM_STEPS] # the same run detached, see below
|
||||
./e2e.sh status # live progress, or the last run's result
|
||||
|
||||
+22
@@ -92,6 +92,28 @@ Corners land on whole pixels inside the frame and are stored relative to its top
|
||||
they move with the frame. Every step is one undo step. The outlines of all frames are always shown;
|
||||
one that crosses itself is drawn red and collides as none.
|
||||
|
||||
### Generate collision…
|
||||
|
||||
Instead of clicking corners, **Generate collision…** in the header reads the outline off the
|
||||
picture (#161). The dialog asks for:
|
||||
|
||||
| Row | Default | Meaning |
|
||||
|---|---|---|
|
||||
| Max points | 8 | The most corners one outline keeps (3 … 64). |
|
||||
| Solid from … % alpha | 50 | A pixel at least this opaque is solid. |
|
||||
| All frames of the texture | off | Every frame of the sheet instead of the selected one. Always on when no frame is selected. |
|
||||
|
||||
- Every island of solid pixels gets an outline of its own. Pixels that touch at a corner only are
|
||||
two islands. An island below 1 % of the frame's area is a crumb and gets none, unless it is the
|
||||
largest one there is.
|
||||
- Holes are not traced: an outline blocks with everything it encloses.
|
||||
- The outline walks the pixel edges and is then cut down to the corners that matter most. A slope
|
||||
becomes one straight edge, not a staircase. An outline never crosses itself; where the picture
|
||||
would make it, the island's convex hull is taken.
|
||||
- The line under the rows says what **Generate** will write, while the numbers change
|
||||
(`Frame "Left": 1 outline, 3 corners`). With nothing solid, the button stays off.
|
||||
- The frames' **existing outlines are replaced**. It is one undo step, for one frame or all.
|
||||
|
||||
When the project is loaded, corners that are no numbers fall away, and an outline with fewer than
|
||||
three corners left is none. A frame saved with a single outline, before a frame could hold
|
||||
several, loads as a frame with that one outline.
|
||||
|
||||
Reference in new issue
Block a user