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
@@ -3,20 +3,20 @@ import { ancestorIdsOf, type ObjectTree } from '../model/hierarchy';
|
||||
import { instanceTargetOf, isEmptyEdit, resolveObjects } from '../model/instance';
|
||||
import { findAsset, type Project } from '../model/Project';
|
||||
import type { SceneObject } from '../model/SceneObject';
|
||||
import { type PropertySchema, schemaFor, schemaForAsset } from './PropertySchema';
|
||||
import { type PropertySchema, schemaFor, schemaForAsset, schemaForObject } from './PropertySchema';
|
||||
import { deviatesFromAsset, isModified } from './resolve';
|
||||
|
||||
/**
|
||||
* The rows the asset inspector marks as modified. A behavior's variables are left out: their
|
||||
* default is declared on the variable itself, so the asset value cannot differ from it.
|
||||
*/
|
||||
export function markedAssetSchema(asset: Asset): PropertySchema {
|
||||
return asset.type === 'behavior' ? schemaFor('behavior') : schemaForAsset(asset);
|
||||
export function markedAssetSchema(project: Project, asset: Asset): PropertySchema {
|
||||
return asset.type === 'behavior' ? schemaFor('behavior') : schemaForAsset(project, asset);
|
||||
}
|
||||
|
||||
/** Whether any asset property the inspector would mark gold differs from its default. */
|
||||
export function assetDeviates(asset: Asset): boolean {
|
||||
return markedAssetSchema(asset).some((def) => isModified(asset, def.key));
|
||||
export function assetDeviates(project: Project, asset: Asset): boolean {
|
||||
return markedAssetSchema(project, asset).some((def) => isModified(project, asset, def.key));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -33,8 +33,9 @@ export function objectDeviates(project: Project, holder: ObjectTree, object: Sce
|
||||
}
|
||||
if (object.editorOffset.x !== 0 || object.editorOffset.y !== 0) return true;
|
||||
const asset = findAsset(project, object.assetId);
|
||||
return (
|
||||
asset !== undefined && schemaForAsset(asset).some((def) => deviatesFromAsset(object, asset, def.key))
|
||||
if (!asset) return false;
|
||||
return schemaForObject(project, asset, object).some((def) =>
|
||||
deviatesFromAsset(project, object, asset, def.key),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user