Shader assets: graph-built shaders, the Shader tab and sprite rows from the graph (#62)
game-maker / suite (push) Failing after 3m59s
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:
1 parent
6141d07d4f
commit
42cafa7543
62 files changed
+1682
-144
No files matched your search
@@ -12,7 +12,12 @@ import { isList, type ListValue, type PropertyValue, type StructValue } from '..
|
||||
import { findAsset } from '../../core/model/Project';
|
||||
import { FIELD_KINDS, LIST_ITEM_KINDS, type ListItemKind } from '../../core/properties/kinds';
|
||||
import { fieldLike, type ListItem, itemLike, structItemOf } from '../../core/properties/listItems';
|
||||
import { type PropertyDef, schemaForAsset, structOf } from '../../core/properties/PropertySchema';
|
||||
import {
|
||||
type PropertyDef,
|
||||
schemaForAsset,
|
||||
schemaForObject,
|
||||
structOf,
|
||||
} from '../../core/properties/PropertySchema';
|
||||
import { resolveAssetProps } from '../../core/properties/resolve';
|
||||
import type { FieldHandlers } from '../inspector/fieldFactory';
|
||||
import { currentProps, currentRef } from '../inspector/objectQueries';
|
||||
@@ -149,14 +154,14 @@ function access<Target>(
|
||||
|
||||
function assetOwner(state: EditorState, slot: Extract<ListSlot, { kind: 'asset' }>): Owner<Asset> | null {
|
||||
const asset = findAsset(state.project, slot.assetId);
|
||||
const def = asset && schemaForAsset(asset).find((d) => d.key === slot.key);
|
||||
const def = asset && schemaForAsset(state.project, asset).find((d) => d.key === slot.key);
|
||||
if (!asset || !def) return null;
|
||||
return {
|
||||
def,
|
||||
title: `${asset.name} · ${def.label}`,
|
||||
current: () => {
|
||||
const now = findAsset(state.project, slot.assetId);
|
||||
return now && resolveAssetProps(now)[slot.key];
|
||||
return now && resolveAssetProps(state.project, now)[slot.key];
|
||||
},
|
||||
spec: assetValue(state, slot.assetId, slot.key),
|
||||
};
|
||||
@@ -168,7 +173,7 @@ function objectOwner(
|
||||
): Owner<ObjectRef> | null {
|
||||
const ref = currentRef(state, slot.holderId, slot.objectId);
|
||||
const owner = ref && findAsset(state.project, ref.object.assetId);
|
||||
const def = owner && schemaForAsset(owner).find((d) => d.key === slot.key);
|
||||
const def = owner && schemaForObject(state.project, owner, ref.object).find((d) => d.key === slot.key);
|
||||
if (!ref || !def) return null;
|
||||
return {
|
||||
def,
|
||||
|
||||
Reference in new issue
Block a user