chore: checkpoint web Blender feature-gap work, docs and tests
- update native web_engine sources and rebuilt wasm artifacts - add task cards, status notes and tooling scripts - add web e2e specs, tutorial UI sources and tutorial assets - sync golden task manifests and audit records Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
@@ -45,6 +45,8 @@ export interface SceneNodeIR {
|
||||
type: SceneNodeType;
|
||||
parentId: string | null;
|
||||
dataId: string | null;
|
||||
/** Collection instantiated by this empty object, if any. */
|
||||
instanceCollectionId?: string;
|
||||
visible: boolean;
|
||||
selectable: boolean;
|
||||
localMatrix: number[];
|
||||
@@ -231,13 +233,25 @@ export interface MeshSummaryIR {
|
||||
|
||||
export interface MaterialNodeIR {
|
||||
id: string;
|
||||
type: "RGB" | "VALUE" | "MATH" | "PRINCIPLED" | "IMAGE_TEXTURE" | "NORMAL_MAP" | "OUTPUT" | "UNSUPPORTED";
|
||||
type: "RGB" | "VALUE" | "MATH" | "MIX" | "MAPPING" | "TEX_COORD" | "UV_MAP" | "BUMP" | "SEPARATE_COLOR" | "OBJECT_INFO" | "PRINCIPLED" | "IMAGE_TEXTURE" | "NORMAL_MAP" | "OUTPUT" | "UNSUPPORTED";
|
||||
name: string;
|
||||
location?: [number, number];
|
||||
sockets?: Array<{id:string;name:string;direction:'INPUT'|'OUTPUT';dataType:'VALUE'|'VECTOR'|'COLOR'|'BOOLEAN'|'SHADER'|'UNSUPPORTED';value?:number|boolean|number[];linked:boolean;integer?:boolean}>;
|
||||
sockets?: Array<{id:string;name:string;direction:'INPUT'|'OUTPUT';dataType:'VALUE'|'VECTOR'|'COLOR'|'BOOLEAN'|'SHADER'|'UNSUPPORTED';value?:number|boolean|number[];linked:boolean;integer?:boolean;available?:boolean;hidden?:boolean}>;
|
||||
imageId?: string | null;
|
||||
defaultValue?: number[];
|
||||
properties?: { operation?: "ADD" | "SUBTRACT" | "MULTIPLY" | "DIVIDE" | "MINIMUM" | "MAXIMUM" };
|
||||
properties?: {
|
||||
operation?: "ADD" | "SUBTRACT" | "MULTIPLY" | "DIVIDE" | "MINIMUM" | "MAXIMUM";
|
||||
dataType?: "FLOAT" | "VECTOR" | "RGBA";
|
||||
blendType?: string;
|
||||
vectorType?: "POINT" | "TEXTURE" | "VECTOR" | "NORMAL";
|
||||
space?: "TANGENT" | "OBJECT" | "WORLD";
|
||||
invert?: boolean;
|
||||
projection?: number;
|
||||
interpolation?: number;
|
||||
extension?: number;
|
||||
uvMap?: string;
|
||||
mode?: "RGB" | "HSV" | "HSL";
|
||||
};
|
||||
}
|
||||
|
||||
export interface MaterialLinkIR {
|
||||
@@ -247,6 +261,15 @@ export interface MaterialLinkIR {
|
||||
toSocket: string;
|
||||
}
|
||||
|
||||
export interface MaterialTextureBindingIR {
|
||||
imageId: string;
|
||||
usage: "BASE_COLOR" | "METALLIC" | "ROUGHNESS" | "EMISSION" | "ALPHA" | "NORMAL" | "BUMP";
|
||||
socket?: string;
|
||||
evaluated?: boolean;
|
||||
strength?: number;
|
||||
uvMap?: string;
|
||||
}
|
||||
|
||||
export interface MaterialIR {
|
||||
id: string;
|
||||
name: string;
|
||||
@@ -264,6 +287,7 @@ export interface MaterialIR {
|
||||
emissionStrength?: number;
|
||||
normalImageId?: string | null;
|
||||
imageIds?: string[];
|
||||
textureBindings?: MaterialTextureBindingIR[];
|
||||
warnings?: string[];
|
||||
/** SHA-256 of the serialized bounded shader graph when a node tree was read. */
|
||||
shaderGraphHash?: string;
|
||||
@@ -1248,6 +1272,12 @@ export function parseSceneSnapshotIR(value: unknown): SceneSnapshotIR {
|
||||
if (node.sourceLibrary !== undefined && node.sourceLibrary !== null) {
|
||||
requireString(node.sourceLibrary, `nodes[${index}].sourceLibrary`);
|
||||
}
|
||||
if (node.instanceCollectionId !== undefined) {
|
||||
const collectionId = requireString(node.instanceCollectionId, `nodes[${index}].instanceCollectionId`);
|
||||
if (!collectionId.startsWith("collection:")) {
|
||||
throw new Error(`SceneIR.nodes[${index}].instanceCollectionId is invalid`);
|
||||
}
|
||||
}
|
||||
requireBoolean(node.visible, `nodes[${index}].visible`);
|
||||
requireBoolean(node.selectable, `nodes[${index}].selectable`);
|
||||
if (!Array.isArray(node.localMatrix) || node.localMatrix.length !== 16) {
|
||||
@@ -1685,6 +1715,18 @@ export function parseSceneSnapshotIR(value: unknown): SceneSnapshotIR {
|
||||
if (material.imageIds !== undefined && (!Array.isArray(material.imageIds) || material.imageIds.some((item) => typeof item !== "string"))) {
|
||||
throw new Error(`SceneIR.materials[${index}].imageIds must contain strings`);
|
||||
}
|
||||
if (material.textureBindings !== undefined) {
|
||||
if (!Array.isArray(material.textureBindings)) throw new Error(`SceneIR.materials[${index}].textureBindings must be an array`);
|
||||
for (const [bindingIndex, binding] of material.textureBindings.entries()) {
|
||||
if (!isRecord(binding)) throw new Error(`SceneIR.materials[${index}].textureBindings[${bindingIndex}] must be an object`);
|
||||
requireString(binding.imageId, `materials[${index}].textureBindings[${bindingIndex}].imageId`);
|
||||
if (!["BASE_COLOR", "METALLIC", "ROUGHNESS", "EMISSION", "ALPHA", "NORMAL", "BUMP"].includes(binding.usage as string)) throw new Error(`SceneIR.materials[${index}].textureBindings[${bindingIndex}].usage is invalid`);
|
||||
if (binding.socket !== undefined) requireString(binding.socket, `materials[${index}].textureBindings[${bindingIndex}].socket`);
|
||||
if (binding.uvMap !== undefined) requireString(binding.uvMap, `materials[${index}].textureBindings[${bindingIndex}].uvMap`);
|
||||
if (binding.evaluated !== undefined && typeof binding.evaluated !== "boolean") throw new Error(`SceneIR.materials[${index}].textureBindings[${bindingIndex}].evaluated is invalid`);
|
||||
if (binding.strength !== undefined) requireNumber(binding.strength, `materials[${index}].textureBindings[${bindingIndex}].strength`);
|
||||
}
|
||||
}
|
||||
if (material.warnings !== undefined && (!Array.isArray(material.warnings) || material.warnings.some((item) => typeof item !== "string"))) {
|
||||
throw new Error(`SceneIR.materials[${index}].warnings must contain strings`);
|
||||
}
|
||||
@@ -1694,12 +1736,24 @@ export function parseSceneSnapshotIR(value: unknown): SceneSnapshotIR {
|
||||
if (!isRecord(node)) throw new Error(`SceneIR.materials[${index}].nodes[${nodeIndex}] must be an object`);
|
||||
requireString(node.id, `SceneIR.materials[${index}].nodes[${nodeIndex}].id`);
|
||||
requireString(node.name, `SceneIR.materials[${index}].nodes[${nodeIndex}].name`);
|
||||
if (!["RGB", "VALUE", "MATH", "PRINCIPLED", "IMAGE_TEXTURE", "NORMAL_MAP", "OUTPUT", "UNSUPPORTED"].includes(node.type as string)) throw new Error(`SceneIR.materials[${index}].nodes[${nodeIndex}].type is invalid`);
|
||||
if (!["RGB", "VALUE", "MATH", "MIX", "MAPPING", "TEX_COORD", "UV_MAP", "BUMP", "SEPARATE_COLOR", "OBJECT_INFO", "PRINCIPLED", "IMAGE_TEXTURE", "NORMAL_MAP", "OUTPUT", "UNSUPPORTED"].includes(node.type as string)) throw new Error(`SceneIR.materials[${index}].nodes[${nodeIndex}].type is invalid`);
|
||||
if (node.imageId !== undefined && node.imageId !== null) requireString(node.imageId, `SceneIR.materials[${index}].nodes[${nodeIndex}].imageId`);
|
||||
if (node.defaultValue !== undefined && (!Array.isArray(node.defaultValue) || node.defaultValue.length === 0 || node.defaultValue.length > 4 || node.defaultValue.some((value) => typeof value !== "number" || !Number.isFinite(value)))) throw new Error(`SceneIR.materials[${index}].nodes[${nodeIndex}].defaultValue is invalid`);
|
||||
if (node.properties !== undefined) {
|
||||
if (!isRecord(node.properties) || Object.keys(node.properties).some((key) => key !== "operation") ||
|
||||
(node.properties.operation !== undefined && !["ADD", "SUBTRACT", "MULTIPLY", "DIVIDE", "MINIMUM", "MAXIMUM"].includes(node.properties.operation as string))) {
|
||||
const properties = node.properties as Record<string, unknown>;
|
||||
const allowed = new Set(["operation", "dataType", "blendType", "vectorType", "space", "invert", "projection", "interpolation", "extension", "uvMap", "mode"]);
|
||||
const enumCheck = (key: string, values: readonly string[]) => properties[key] === undefined || (typeof properties[key] === "string" && values.includes(properties[key] as string));
|
||||
const numberCheck = (key: string) => properties[key] === undefined || (Number.isSafeInteger(properties[key]) && (properties[key] as number) >= 0 && (properties[key] as number) <= 32);
|
||||
if (!isRecord(node.properties) || Object.keys(properties).some((key) => !allowed.has(key)) ||
|
||||
!enumCheck("operation", ["ADD", "SUBTRACT", "MULTIPLY", "DIVIDE", "MINIMUM", "MAXIMUM"]) ||
|
||||
!enumCheck("dataType", ["FLOAT", "VECTOR", "RGBA"]) ||
|
||||
!enumCheck("vectorType", ["POINT", "TEXTURE", "VECTOR", "NORMAL"]) ||
|
||||
!enumCheck("space", ["TANGENT", "OBJECT", "WORLD"]) ||
|
||||
!enumCheck("mode", ["RGB", "HSV", "HSL"]) ||
|
||||
(properties.blendType !== undefined && (typeof properties.blendType !== "string" || properties.blendType.length > 32)) ||
|
||||
(properties.uvMap !== undefined && (typeof properties.uvMap !== "string" || properties.uvMap.length > 64)) ||
|
||||
(properties.invert !== undefined && typeof properties.invert !== "boolean") ||
|
||||
!numberCheck("projection") || !numberCheck("interpolation") || !numberCheck("extension")) {
|
||||
throw new Error(`SceneIR.materials[${index}].nodes[${nodeIndex}].properties is invalid`);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user