The shader tab previews the effect on the last picked image (#168)
A shader could only be judged by placing it on a sprite and running the scene. The shader tab now shows its effect next to the graph, on the image the user picked last, without a picker to maintain. - The preview follows the last selection that has an image: a placed sprite with its overrides, size and tint, a sprite asset, a texture or a frame. Clicking the shader, a node, a behavior or a scene keeps the picture. - Without such a selection, or when the picked image is deleted, a built-in 64 px test image is shown. Its colour runs with u and v, a checkerboard shows where a UV lands and the border fades for alpha. - Each property gets a slider. The sliders belong to the preview and never write to the project. They start at the sprite's values when it carries this shader, otherwise at the default. - The preview has its own clock. Hold and Restart are only enabled when a Time node is in the graph. - The graph | splitter | panel layout of the particles tab moves into PreviewSplit, and both tabs use it. - A nine-sliced frame is previewed unsliced. This is documented. Findings: - The slider row stayed squeezed to a few pixels when the properties changed while the tab was hidden. The layout was triggered one level too high. The slider check in block 28n holds this. - The graph canvas is narrower now, 385 px at a 1280 px window, the same as in the particles tab. Block 28b clicked at a fixed x+420 and now uses the measured width. Tests: - ./check.sh: 132 files, 1952 tests (was 131 / 1941), exit 0 - npm run build: exit 0 - GM_STEPS=28,31 freshly seeded: ALL PASSED, 105 checks - 11 new unit tests in tests/editor/shader-preview.test.ts - 7 new e2e checks in block 28n - Counter-probes: start values ignoring the sprite fail 1 unit test, a preview ignoring the selection fails 2 e2e checks - Check total 1209 in README is computed (1202 + 7), CI measures it Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2d79230b55
commit
73a71473f1
10 files changed
+843
-31
No files matched your search
@@ -417,6 +417,21 @@ export function installDebugHook(app: Application, state: EditorState, editor: E
|
||||
center: () => centreOf(editor.shaderEditor.canvas),
|
||||
snapping: () => editor.shaderEditor.canvas.snapEnabled,
|
||||
snapButton: () => snapButton(editor.shaderEditor.snap),
|
||||
/** The panel beside the graph (#168): what it shows, its clock and the sliders' values. */
|
||||
preview: () => ({
|
||||
...editor.shaderEditor.controls,
|
||||
holding: editor.shaderEditor.preview.holding,
|
||||
seconds: Math.round(editor.shaderEditor.preview.time * 100) / 100,
|
||||
}),
|
||||
previewRect: () => rectOf(editor.shaderEditor.preview),
|
||||
/** Where the picture sits inside the panel, in screen pixels. */
|
||||
pictureRect: () => editor.shaderEditor.preview.pictureRect,
|
||||
sliderAt: (key: string) => {
|
||||
const slider = editor.shaderEditor.sliderOf(key);
|
||||
return slider ? rectOf(slider) : null;
|
||||
},
|
||||
splitterAt: () => centreOf(editor.shaderEditor.splitter),
|
||||
hold: (at: number | null) => editor.shaderEditor.hold(at),
|
||||
},
|
||||
/** The console panel: its lines as kept, its drawn height, and the divider above it. */
|
||||
console: {
|
||||
|
||||
Reference in new issue
Block a user