Shader assets: graph-built shaders, the Shader tab and sprite rows from the graph (#62)
game-maker / suite (push) Failing after 3m59s

A shader is an asset carrying a node graph (Texture color, Output, Property,
Color, Add/Subtract/Multiply/Divide, Mix, Luminance) that compiles to the GLSL
fragment of a Pixi filter. The Shader tab reuses the Behavior canvas; a sprite
wears a shader through its Shader picker, and the rows below it are the
graph's Property nodes. Property schema, resolution and deviation take the
project because a sprite's rows now live in another asset. The built-in
registry of the prototype is gone; "Adjust colors" ships as a graph in the
fixture and the three example games.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
rootandClaude Fable 5.1 committed 2026-09-12 22:41:14 +02:00
1 parent 6141d07d4f
commit 42cafa7543
62 files changed
+1682 -144

No files matched your search

+12 -9
View File
@@ -30,7 +30,7 @@ import {
isCommonProp,
type PropertyDef,
schemaFor,
schemaForAsset,
schemaForObject,
} from '../../core/properties/PropertySchema';
import {
deviatesFromAsset,
@@ -69,7 +69,8 @@ export function objectSignature(
: isLiveInstance(project, holder, object)
? 'instance'
: '';
return `${object.parentId}|${kind}|` + schemaForAsset(asset).map(defSignature).join(',');
const rows = schemaForObject(project, asset, object);
return `${object.parentId}|${kind}|` + rows.map(defSignature).join(',');
}
/** Several objects: what they are, and the actions that apply to all of them at once. */
@@ -125,7 +126,7 @@ export function buildObjectSection(host: InspectorHost, holderId: string, object
if (target) assetLink(host, 'Part of', target.asset);
// The master switch, right where it is looked for: above everything type-specific.
const resolved = resolveSceneObjectProps(asset, object);
const resolved = resolveSceneObjectProps(host.state.project, asset, object);
for (const def of COMMON_PROPS) propertyRow(host, holderId, objectId, asset, def, resolved);
// A behavior's own switches sit with it rather than in the section below: that one lists what
// the behavior *declares*, and `Run in editor` is not something it declared.
@@ -178,11 +179,11 @@ export function buildObjectSection(host: InspectorHost, holderId: string, object
}
// Asset properties (or behavior variables) with overrides; the switches are shown above.
const values = resolveSceneObjectProps(asset, object);
const values = resolveSceneObjectProps(host.state.project, asset, object);
const own =
asset.type === 'behavior'
? asset.variables
: schemaForAsset(asset).filter((def) => !isCommonProp(def.key));
: schemaForObject(host.state.project, asset, object).filter((def) => !isCommonProp(def.key));
if (own.length > 0 || asset.type === 'behavior')
addTitle(host, asset.type === 'behavior' ? 'VARIABLES' : 'PROPERTIES');
if (own.length === 0 && asset.type === 'behavior') addNote(host, 'The behavior declares no variables.');
@@ -248,8 +249,9 @@ export function refreshObjectSection(host: InspectorHost, holderId: string, obje
host.nameField?.setValue(object.name);
for (const axis of POSITION_AXES) host.fields.get(axis)?.setValue(object.position[axis]);
for (const axis of OFFSET_AXES) host.fields.get(offsetKey(axis))?.setValue(object.editorOffset[axis]);
const values = resolveSceneObjectProps(asset, object);
for (const def of schemaForAsset(asset)) host.fields.get(def.key)?.setValue(values[def.key] ?? def.default);
const values = resolveSceneObjectProps(project, asset, object);
for (const def of schemaForObject(project, asset, object))
host.fields.get(def.key)?.setValue(values[def.key] ?? def.default);
markObjectRows(host, object, asset, targetOf(project, holderId, objectId));
return true;
}
@@ -343,10 +345,11 @@ function markObjectRows(
?.setModified(Boolean(target) && object.position[axis] !== target!.base.position[axis]);
for (const axis of OFFSET_AXES)
host.fields.get(offsetKey(axis))?.setModified(object.editorOffset[axis] !== 0);
for (const def of schemaForAsset(asset)) {
const project = host.state.project;
for (const def of schemaForObject(project, asset, object)) {
const deviates = target
? deviatesFromTemplate(object, target.base, def.key)
: deviatesFromAsset(object, asset, def.key);
: deviatesFromAsset(project, object, asset, def.key);
host.fields.get(def.key)?.setModified(deviates);
}
}