Properties node: name each shader param by its shader (#66)
game-maker / suite (push) Successful in 8m23s
game-maker / suite (push) Successful in 8m23s
The + Property menu of the Properties node offered every shader's params for every sprite. Each shader row now carries its shader name, and a name shared by two shaders lists both: "brightness (Adjust colors, Neon glow)". Sprite-owned rows stay unlabelled. The note hangs off a map keyed by the def object, not by the name -- a sprite property and a shader param may share a name (#63), and keying by name would label the wrong row. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
05f7a2745e
commit
5c1c3c6fd6
5 files changed
+103
-13
No files matched your search
@@ -237,12 +237,25 @@ export function shaderParamRows(project: Project, shaderId: string): PropertyDef
|
||||
return shader ? shaderParamDefs(shader.graph) : [];
|
||||
}
|
||||
|
||||
/** The parameters of every shader in the project, one row per name – what a sprite *may* have. */
|
||||
export function allShaderParamRows(project: Project): PropertyDef[] {
|
||||
const rows = new Map<string, PropertyDef>();
|
||||
/** A shader parameter a sprite *may* have, with the shaders that declare it under that name. */
|
||||
export interface ShaderParamRow {
|
||||
def: PropertyDef;
|
||||
shaders: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* The parameters of every shader in the project, one row per name – which sprite wears which shader
|
||||
* is only known at runtime, so the picker offers them all and names where each one comes from.
|
||||
*/
|
||||
export function allShaderParamRows(project: Project): ShaderParamRow[] {
|
||||
const rows = new Map<string, ShaderParamRow>();
|
||||
for (const asset of project.assets)
|
||||
if (asset.type === 'shader')
|
||||
for (const row of shaderParamDefs(asset.graph)) if (!rows.has(row.key)) rows.set(row.key, row);
|
||||
for (const def of shaderParamDefs(asset.graph)) {
|
||||
const row = rows.get(def.key);
|
||||
if (!row) rows.set(def.key, { def, shaders: [asset.name] });
|
||||
else if (!row.shaders.includes(asset.name)) row.shaders.push(asset.name);
|
||||
}
|
||||
return [...rows.values()];
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user