Show lists in the inspector and variables in their own tab (#252)
game-maker / gate (push) Successful in 3m24s
game-maker / suite (push) Successful in 10m22s

The List tab could show one list at a time and was the only place to
see its items. A list now shows its items right where it lives, and a
new Variables tab shows all variables of an asset or placed object.

- InlineList draws the items of a list under its row in the inspector,
  in struct fields and in the Variables tab. A list inside a list or a
  struct field is drawn the same way, one step indented.
- The index column is the indent. Items sit under their list without an
  own margin, and the index column is 16 px wide instead of 28 px.
- Above 20 items (INLINE_LIMIT) the rest collapses into "... N more -
  open in tab". During a run the rows show the values from the game.
- ListHead puts "N items" and "+ Item" in one row. "N items" opens the
  list in a tab. A separate Open button squeezed the counter to zero
  width in the narrow inspector column.
- VariablesEditor shows every variable of a behavior asset, a variables
  asset or a placed behavior. On an asset it edits the declarations. On
  a placed object an edit only overrides that object, with the usual
  reset and push buttons.
- Opening a list inside a tab adds a new tab and keeps the open one.
  valuesKey gives each list its own document, so a list that is already
  open is shown instead of opened twice.
- Titles read "Pickup · Variables" or "Listy · nums · [3]". The tab
  closes when its asset or object is deleted.
- Lists on node inputs stay inline only, a node owns no variables.
- The List tab, ListEditor and the __gm.list hook are gone.

Tests:
- ./check.sh: 181 files, 2645 tests, CHECK EXIT 0
- GM_STEPS=1,21,22,32: ALL PASSED, 123 checks
- e2e 21 is rewritten for inline lists and the new tab, 22 and 32 are
  adapted. Sum in README: 1486 (+6 in 21, -1 in 22), counted by hand.
- Counter-probes fail as expected: sub-lists not told apart (1 unit
  test), sub-list replacing the open tab, all items drawn inline (60
  rows instead of 20), no live values (0 rows at 24 items in a run).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
adminandClaude Opus 5.5 committed 2026-09-27 21:56:21 +02:00
1 parent 92fad6b9e3
commit 4857bb75e6
26 files changed
+1203 -427

No files matched your search

+31 -7
View File
@@ -4,9 +4,15 @@ import { currentFramesDialog } from '../animation/FramesDialog';
import { currentRowDialog } from '../animation/RowDialog';
import { centreOf, type HookContext } from './hookHelpers';
/** The Texture, Animation, Tile and List tabs. */
/** Where a check looks for an inline list: the Variables tab showing, or the inspector. */
type ListPlace = 'tab' | 'inspector';
/** The Texture, Animation, Tile and Variables tabs. */
export function documentHooks({ state, editor }: HookContext) {
const { textureEditor } = editor;
const listsIn = (where: ListPlace) =>
where === 'tab' ? editor.variablesEditor.lists() : editor.inspector.lists();
const listIn = (where: ListPlace, title: string) => listsIn(where).find((list) => list.title === title);
return {
texture: {
current: () => textureEditor.currentAssetId,
@@ -81,14 +87,32 @@ export function documentHooks({ state, editor }: HookContext) {
pictureRowAt: (index: number) => editor.tileEditor.strip.list.rowGlobal(String(index)),
fitAt: () => centreOf(editor.tileEditor.fitButton),
},
list: {
info: () => editor.listEditor.debugInfo(),
values: {
/** What the Variables tab showing now is pointed at, and the variable rows it built. */
info: () => editor.variablesEditor.debugInfo(),
/**
* Every list drawn inline – in the showing Variables tab or in the inspector – with what it
* holds and how much of it is drawn; the others below find one by its title (#252).
*/
lists: (where: ListPlace) => listsIn(where).map((list) => list.debugInfo()),
/** Where an item's widget sits, so a check can click it – a number field has no findable text. */
fieldAt: (index: number, field = '') => editor.listEditor.fieldAt(index, field),
fieldAt: (where: ListPlace, title: string, index: number, field = '') =>
listIn(where, title)?.fieldAt(index, field) ?? null,
/** The kind mark of a row, or of one field of a struct item – both are pickers. */
markAt: (index: number, field = '') => editor.listEditor.markAt(index, field),
nameAt: (index: number, field: string) => editor.listEditor.nameAt(index, field),
removeAt: (index: number) => editor.listEditor.removeAt(index),
markAt: (where: ListPlace, title: string, index: number, field = '') =>
listIn(where, title)?.markAt(index, field) ?? null,
nameAt: (where: ListPlace, title: string, index: number, field: string) =>
listIn(where, title)?.nameAt(index, field) ?? null,
removeAt: (where: ListPlace, title: string, index: number) =>
listIn(where, title)?.removeAt(index) ?? null,
moreAt: (where: ListPlace, title: string) => listIn(where, title)?.moreAt() ?? null,
/** The head of a list: its "+ Item" and – where it has one – its "Open". */
headAt: (where: ListPlace, title: string) => {
const head = listIn(where, title)?.head;
return head
? { add: centreOf(head.addButton), open: head.openButton ? centreOf(head.openButton) : null }
: null;
},
},
};
}