chore(web): checkpoint export fixes, operator routing and three-domain evidence

- Web engine CMake: apply WITH_WEB_USD_PYTHON to blender_web_engine_core,
  embed /usd resources, link pxr Python bindings after the core archive and
  whole-archive the monolithic OpenUSD archive. Fixes the wm.usd_export abort
  and restores Alembic/USD embedded export.
- ?ui=web menus: fix inverted localOnly gating and route queueLocalDesktopOperator
  and nativeAdd through the desktop operator channel with a VIEW_3D context;
  non-mesh edit-mode selection uses the native VIEW3D_SELECT bridge.
- Refresh WebEngine wasm/js artifacts, manual/course pages and the complete
  course video asset.
- Record focused Chromium probes for Add/F3/parameters/modifier/UV/curve/deform,
  scene operations, OPFS save/reopen and worker restart. Evidence is NOT_CLAIMED.

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
mes123456
2026-11-14 06:12:44 +08:00
parent 809b247bc8
commit 4eb08faf31
275 changed files with 104414 additions and 186 deletions

View File

@@ -1,3 +1,5 @@
import type { NativeWorkflowContext } from "./native-workflow";
export type BlenderOperatorPropertyType = "boolean" | "number" | "enum" | "string" | "pointer" | "collection" | "number-array" | "boolean-array" | "enum-set";
/** Local embedded-bpy pointer input, including nested dictionary/collection fields.
@@ -97,6 +99,10 @@ export interface BlenderFeatureRouteEntry {
httpRoute?: string;
/** Existing browser workflow used by BROWSER_EQUIVALENT routes. */
browserActionGroup?: BlenderBrowserActionGroup;
/** Real execution channel; absent means the entry is not invokable. */
invokeVia?: "typed-command" | "desktop-operator" | "server" | "browser";
/** Dotted bpy operator ID used by the execution channel. */
invokeId?: string;
label?: string;
description?: string;
properties?: BlenderOperatorPropertySpec[];
@@ -107,6 +113,10 @@ export interface BlenderFeatureRouteInvocation {
route: BlenderFeatureRouteEntry;
properties?: Record<string, BlenderOperatorPropertyValue>;
baseRevision?: number;
/** Current Main/editor context for the embedded desktop_operator channel. */
context?: NativeWorkflowContext;
/** Resolve and poll the operator through the native WM/RNA context. */
native?: boolean;
}
/** SERVER_NATIVE accepts bounded scalars, fixed RNA arrays and enum flag sets. */

View File

@@ -9,7 +9,7 @@ export function isEditorResourcePath(value: unknown): value is string {
if (parts[0] !== 'cache' || !/^[0-9a-f-]{36}$/.test(parts[1] ?? '') || parts.length < 3 || parts.length > 16 || bytes.encode('/browser/' + value).length > 1023) return false;
if (parts.some(part => !part || part === '.' || part === '..' || /[\\\u0000-\u001f\u007f]/.test(part) || bytes.encode(part).length > 200)) return false;
try { if (normalizeProjectAssetPath(value) !== value) return false; } catch { return false; }
return parts[2] === 'shader' || parts[2] === 'model' ? parts.length > 3 : parts.length === 3 && /^[A-Za-z0-9._-]{1,200}\.(?:abc|usd|usda|usdc|usdz|btx|osl|oso)$/i.test(parts[2]);
return parts[2] === 'shader' || parts[2] === 'model' ? parts.length > 3 : parts.length === 3 && /^[A-Za-z0-9._-]{1,200}\.(?:abc|usd|usda|usdc|usdz|btx|osl|oso|mp4|mov|webm|mkv|wav|mp3|ogg|flac|png|jpg|jpeg|exr|tif|tiff)$/i.test(parts[2]);
}
export function modelResourcePath(batchId: string, relativePath: string): string {
const path = `cache/${batchId}/model/${relativePath}`;

View File

@@ -16,6 +16,29 @@ const nodeSockets = (type: string): GeometryNodeSocketIR[] => {
if (type === "FunctionNodeInputVector") return [socket("Vector", "Vector", "OUTPUT", "VECTOR", [0, 0, 0])];
if (type === "ShaderNodeValue") return [socket("Value", "Value", "OUTPUT", "FLOAT", 0)];
if (type === "ShaderNodeMath") return [socket("Value", "Value", "INPUT", "FLOAT", 0), socket("Value_001", "Value", "INPUT", "FLOAT", 0), socket("Value", "Value", "OUTPUT", "FLOAT")];
if (type === "GeometryNodeSubdivisionSurface") return [socket("Geometry", "Geometry", "INPUT", "GEOMETRY"), socket("Level", "Level", "INPUT", "INT"), socket("Render Level", "Render Level", "INPUT", "INT"), socket("Geometry", "Geometry", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeMeshToPoints") return [socket("Mesh", "Mesh", "INPUT", "GEOMETRY"), socket("Selection", "Selection", "INPUT", "BOOLEAN"), socket("Position", "Position", "INPUT", "VECTOR"), socket("Radius", "Radius", "INPUT", "FLOAT"), socket("Points", "Points", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodePoints") return [socket("Count", "Count", "INPUT", "INT"), socket("Position", "Position", "INPUT", "VECTOR"), socket("Radius", "Radius", "INPUT", "FLOAT"), socket("Points", "Points", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeInstanceOnPoints") return [socket("Points", "Points", "INPUT", "GEOMETRY"), socket("Selection", "Selection", "INPUT", "BOOLEAN"), socket("Instance", "Instance", "INPUT", "GEOMETRY"), socket("Pick Instance", "Pick Instance", "INPUT", "BOOLEAN"), socket("Instance Index", "Instance Index", "INPUT", "INT"), socket("Rotation", "Rotation", "INPUT", "VECTOR"), socket("Scale", "Scale", "INPUT", "VECTOR"), socket("Instances", "Instances", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeMeshCube") return [socket("Size", "Size", "INPUT", "VECTOR"), socket("Vertices X", "Vertices X", "INPUT", "INT"), socket("Vertices Y", "Vertices Y", "INPUT", "INT"), socket("Vertices Z", "Vertices Z", "INPUT", "INT"), socket("Mesh", "Mesh", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeMeshGrid") return [socket("Size X", "Size X", "INPUT", "FLOAT"), socket("Size Y", "Size Y", "INPUT", "FLOAT"), socket("Vertices X", "Vertices X", "INPUT", "INT"), socket("Vertices Y", "Vertices Y", "INPUT", "INT"), socket("Mesh", "Mesh", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeMeshIcoSphere") return [socket("Radius", "Radius", "INPUT", "FLOAT"), socket("Subdivisions", "Subdivisions", "INPUT", "INT"), socket("Mesh", "Mesh", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeMeshUVSphere") return [socket("Segments", "Segments", "INPUT", "INT"), socket("Rings", "Rings", "INPUT", "INT"), socket("Radius", "Radius", "INPUT", "FLOAT"), socket("Mesh", "Mesh", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeMeshCylinder") return [socket("Vertices", "Vertices", "INPUT", "INT"), socket("Side Segments", "Side Segments", "INPUT", "INT"), socket("Radius", "Radius", "INPUT", "FLOAT"), socket("Depth", "Depth", "INPUT", "FLOAT"), socket("Mesh", "Mesh", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeDeleteGeometry") return [socket("Geometry", "Geometry", "INPUT", "GEOMETRY"), socket("Selection", "Selection", "INPUT", "BOOLEAN"), socket("Geometry", "Geometry", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeSetShadeSmooth") return [socket("Geometry", "Geometry", "INPUT", "GEOMETRY"), socket("Selection", "Selection", "INPUT", "BOOLEAN"), socket("Shade Smooth", "Shade Smooth", "INPUT", "BOOLEAN"), socket("Geometry", "Geometry", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeInputPosition") return [socket("Position", "Position", "OUTPUT", "VECTOR")];
if (type === "GeometryNodeInputIndex") return [socket("Index", "Index", "OUTPUT", "INT")];
if (type === "GeometryNodeInputNormal") return [socket("Normal", "Normal", "OUTPUT", "VECTOR")];
if (type === "GeometryNodeDistributePointsOnFaces") return [socket("Mesh", "Mesh", "INPUT", "GEOMETRY"), socket("Selection", "Selection", "INPUT", "BOOLEAN"), socket("Distance Min", "Distance Min", "INPUT", "FLOAT"), socket("Density Max", "Density Max", "INPUT", "FLOAT"), socket("Density Factor", "Density Factor", "INPUT", "FLOAT"), socket("Seed", "Seed", "INPUT", "INT"), socket("Points", "Points", "OUTPUT", "GEOMETRY"), socket("Normal", "Normal", "OUTPUT", "VECTOR"), socket("Rotation", "Rotation", "OUTPUT", "VECTOR")];
if (type === "GeometryNodeTranslateInstances") return [socket("Instances", "Instances", "INPUT", "GEOMETRY"), socket("Selection", "Selection", "INPUT", "BOOLEAN"), socket("Translation", "Translation", "INPUT", "VECTOR"), socket("Local Space", "Local Space", "INPUT", "BOOLEAN"), socket("Instances", "Instances", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeRotateInstances") return [socket("Instances", "Instances", "INPUT", "GEOMETRY"), socket("Selection", "Selection", "INPUT", "BOOLEAN"), socket("Rotation", "Rotation", "INPUT", "VECTOR"), socket("Local Space", "Local Space", "INPUT", "BOOLEAN"), socket("Instances", "Instances", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeScaleInstances") return [socket("Instances", "Instances", "INPUT", "GEOMETRY"), socket("Selection", "Selection", "INPUT", "BOOLEAN"), socket("Scale", "Scale", "INPUT", "VECTOR"), socket("Local Space", "Local Space", "INPUT", "BOOLEAN"), socket("Instances", "Instances", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeCurvePrimitiveCircle") return [socket("Resolution", "Resolution", "INPUT", "INT"), socket("Radius", "Radius", "INPUT", "FLOAT"), socket("Curve", "Curve", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeCurveToMesh") return [socket("Curve", "Curve", "INPUT", "GEOMETRY"), socket("Profile Curve", "Profile Curve", "INPUT", "GEOMETRY"), socket("Fill Caps", "Fill Caps", "INPUT", "BOOLEAN"), socket("Mesh", "Mesh", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeMeshToCurve") return [socket("Mesh", "Mesh", "INPUT", "GEOMETRY"), socket("Selection", "Selection", "INPUT", "BOOLEAN"), socket("Curve", "Curve", "OUTPUT", "GEOMETRY")];
if (type === "GeometryNodeExtrudeMesh") return [socket("Mesh", "Mesh", "INPUT", "GEOMETRY"), socket("Selection", "Selection", "INPUT", "BOOLEAN"), socket("Offset", "Offset", "INPUT", "VECTOR"), socket("Offset Scale", "Offset Scale", "INPUT", "FLOAT"), socket("Individual", "Individual", "INPUT", "BOOLEAN"), socket("Mesh", "Mesh", "OUTPUT", "GEOMETRY"), socket("Top", "Top", "OUTPUT", "BOOLEAN"), socket("Side", "Side", "OUTPUT", "BOOLEAN")];
if (type === "GeometryNodeTriangulate") return [socket("Mesh", "Mesh", "INPUT", "GEOMETRY"), socket("Selection", "Selection", "INPUT", "BOOLEAN"), socket("Minimum Vertices", "Minimum Vertices", "INPUT", "INT"), socket("Mesh", "Mesh", "OUTPUT", "GEOMETRY")];
return [];
};

View File

@@ -162,6 +162,29 @@ export const GEOMETRY_NODE_ALLOWLIST = Object.freeze([
"GeometryNodeObjectInfo",
"GeometryNodeCollectionInfo",
"GeometryNodeImageInfo",
"GeometryNodeSubdivisionSurface",
"GeometryNodeMeshToPoints",
"GeometryNodePoints",
"GeometryNodeInstanceOnPoints",
"GeometryNodeMeshCube",
"GeometryNodeMeshGrid",
"GeometryNodeMeshIcoSphere",
"GeometryNodeMeshUVSphere",
"GeometryNodeMeshCylinder",
"GeometryNodeDeleteGeometry",
"GeometryNodeSetShadeSmooth",
"GeometryNodeInputPosition",
"GeometryNodeInputIndex",
"GeometryNodeInputNormal",
"GeometryNodeDistributePointsOnFaces",
"GeometryNodeTranslateInstances",
"GeometryNodeRotateInstances",
"GeometryNodeScaleInstances",
"GeometryNodeCurvePrimitiveCircle",
"GeometryNodeCurveToMesh",
"GeometryNodeMeshToCurve",
"GeometryNodeExtrudeMesh",
"GeometryNodeTriangulate",
] as const);
const supportedNodeTypes = new Set<string>(GEOMETRY_NODE_ALLOWLIST);

View File

@@ -18,6 +18,16 @@ const nodeSockets = (type: ShaderNodeType): ShaderSocketIR[] => {
if (type === "SEPARATE_COLOR") return [input("Color", "Color", "COLOR", [0, 0, 0, 1]), output("Red", "Red", "VALUE"), output("Green", "Green", "VALUE"), output("Blue", "Blue", "VALUE")];
if (type === "OBJECT_INFO") return [output("Location", "Location", "VECTOR"), output("Color", "Color", "COLOR"), output("Alpha", "Alpha", "VALUE"), output("Object Index", "Object Index", "VALUE"), output("Material Index", "Material Index", "VALUE"), output("Random", "Random", "VALUE")];
if (type === "MIX") return [input("Factor_Float", "Factor", "VALUE", 0.5), input("A_Float", "A", "VALUE", 0), input("B_Float", "B", "VALUE", 0), output("Result_Float", "Result", "VALUE")];
if (type === "DIFFUSE") return [input("Color", "Color", "COLOR", [0.8, 0.8, 0.8, 1]), input("Roughness", "Roughness", "VALUE", 0), input("Normal", "Normal", "VECTOR", [0, 0, 0]), output("BSDF", "BSDF", "SHADER")];
if (type === "GLOSSY") return [input("Color", "Color", "COLOR", [0.8, 0.8, 0.8, 1]), input("Roughness", "Roughness", "VALUE", 0.2), input("Normal", "Normal", "VECTOR", [0, 0, 0]), output("BSDF", "BSDF", "SHADER")];
if (type === "EMISSION") return [input("Color", "Color", "COLOR", [1, 1, 1, 1]), input("Strength", "Strength", "VALUE", 1), output("Emission", "Emission", "SHADER")];
if (type === "MIX_SHADER") return [input("Fac", "Fac", "VALUE", 0.5), input("Shader", "Shader", "SHADER"), input("Shader_001", "Shader", "SHADER"), output("Shader", "Shader", "SHADER")];
if (type === "ADD_SHADER") return [input("Shader", "Shader", "SHADER"), input("Shader_001", "Shader", "SHADER"), output("Shader", "Shader", "SHADER")];
if (type === "NOISE") return [input("Vector", "Vector", "VECTOR", [0, 0, 0]), input("Scale", "Scale", "VALUE", 5), input("Detail", "Detail", "VALUE", 2), input("Roughness", "Roughness", "VALUE", 0.5), input("Distortion", "Distortion", "VALUE", 0), output("Fac", "Fac", "VALUE"), output("Color", "Color", "COLOR")];
if (type === "GRADIENT") return [input("Vector", "Vector", "VECTOR", [0, 0, 0]), output("Fac", "Fac", "VALUE"), output("Color", "Color", "COLOR")];
if (type === "CHECKER") return [input("Vector", "Vector", "VECTOR", [0, 0, 0]), input("Color1", "Color1", "COLOR", [0.8, 0.8, 0.8, 1]), input("Color2", "Color2", "COLOR", [0.2, 0.2, 0.2, 1]), input("Scale", "Scale", "VALUE", 5), output("Color", "Color", "COLOR"), output("Fac", "Fac", "VALUE")];
if (type === "FRESNEL") return [input("IOR", "IOR", "VALUE", 1.45), input("Normal", "Normal", "VECTOR", [0, 0, 0]), output("Fac", "Fac", "VALUE")];
if (type === "LAYER_WEIGHT") return [input("Blend", "Blend", "VALUE", 0.5), input("Normal", "Normal", "VECTOR", [0, 0, 0]), output("Fresnel", "Fresnel", "VALUE"), output("Facing", "Facing", "VALUE")];
return [];
};

View File

@@ -3,10 +3,10 @@ import { blockedGate, capabilityIssue, readyGate, type CapabilityGateResult } fr
export const SHADER_GRAPH_SCHEMA = 1 as const;
export type ShaderSocketType = "VALUE" | "VECTOR" | "COLOR" | "BOOLEAN" | "SHADER" | "CLOSURE";
export type ShaderNodeType = "RGB" | "VALUE" | "MIX" | "MATH" | "MAPPING" | "TEX_COORD" | "UV_MAP" | "SEPARATE_COLOR" | "OBJECT_INFO" | "IMAGE_TEXTURE" | "NORMAL_MAP" | "BUMP" | "PRINCIPLED" | "MATERIAL_OUTPUT";
export type ShaderNodeType = "RGB" | "VALUE" | "MIX" | "MATH" | "MAPPING" | "TEX_COORD" | "UV_MAP" | "SEPARATE_COLOR" | "OBJECT_INFO" | "IMAGE_TEXTURE" | "NORMAL_MAP" | "BUMP" | "PRINCIPLED" | "MATERIAL_OUTPUT" | "DIFFUSE" | "GLOSSY" | "EMISSION" | "MIX_SHADER" | "ADD_SHADER" | "NOISE" | "GRADIENT" | "CHECKER" | "FRESNEL" | "LAYER_WEIGHT";
export type ShaderSocketValue = boolean | number | string | number[];
export type ShaderNodeEdit =
| {action:'ADD';nodeType:'RGB'|'VALUE'|'MATH'|'MIX'|'MAPPING'|'TEX_COORD'|'UV_MAP'|'SEPARATE_COLOR'|'OBJECT_INFO'|'IMAGE_TEXTURE'|'NORMAL_MAP'|'BUMP'|'PRINCIPLED'|'OUTPUT';location:[number,number]}
| {action:'ADD';nodeType:'RGB'|'VALUE'|'MATH'|'MIX'|'MAPPING'|'TEX_COORD'|'UV_MAP'|'SEPARATE_COLOR'|'OBJECT_INFO'|'IMAGE_TEXTURE'|'NORMAL_MAP'|'BUMP'|'PRINCIPLED'|'OUTPUT'|'DIFFUSE'|'GLOSSY'|'EMISSION'|'MIX_SHADER'|'ADD_SHADER'|'NOISE'|'GRADIENT'|'CHECKER'|'FRESNEL'|'LAYER_WEIGHT';location:[number,number]}
| {action:'MOVE';nodeId:string;location:[number,number]}
| {action:'RENAME';nodeId:string;name:string}
| {action:'REMOVE';nodeId:string}
@@ -87,6 +87,8 @@ function socket(value: unknown, path: string): value is ShaderSocketIR {
const supportedTypes = new Set<ShaderNodeType>([
"RGB", "VALUE", "MIX", "MATH", "MAPPING", "TEX_COORD", "UV_MAP", "SEPARATE_COLOR",
"OBJECT_INFO", "IMAGE_TEXTURE", "NORMAL_MAP", "BUMP", "PRINCIPLED", "MATERIAL_OUTPUT",
"DIFFUSE", "GLOSSY", "EMISSION", "MIX_SHADER", "ADD_SHADER", "NOISE", "GRADIENT",
"CHECKER", "FRESNEL", "LAYER_WEIGHT",
]);
const supportedMathOperations = new Set(["ADD", "SUBTRACT", "MULTIPLY", "DIVIDE", "MINIMUM", "MAXIMUM"]);
const integerInRange = (value: unknown, minimum: number, maximum: number): boolean =>

View File

@@ -369,7 +369,8 @@ export type WebEngineJsonCommand =
| "setRNAEnumProperty"
| "readRNACollection"
| "importScene"
| "exportScene";
| "exportScene"
| "compositorEvaluate";
export type WebEngineRequest =
| { requestId: string; command: { type: "init" } }

View File

@@ -55,6 +55,9 @@ export interface WebPreferencesIR {
files: {
note: string;
};
themes: {
preset: "DARK" | "LIGHT" | "HIGH_CONTRAST";
};
}
export interface AreaLayoutRecord {
@@ -119,6 +122,7 @@ export const DEFAULT_WEB_PREFERENCES: WebPreferencesIR = {
usePreferencesSave: true,
},
files: { note: "OPFS 存储;本地 .blend 仅通过“下载 .blend”手动导出。" },
themes: { preset: "DARK" },
};
export interface PreferenceDefinition {
@@ -176,7 +180,7 @@ export const PREFERENCE_DEFINITIONS: PreferenceDefinition[] = [
{ path: "saveLoad.saveVersion", tab: "saveLoad", label: "保存版本数", kind: "number", min: 0, max: 32, step: 1, supported: false, desktopSource: "preferences.filepaths.save_version (1)" },
{ path: "saveLoad.usePreferencesSave", tab: "saveLoad", label: "自动保存偏好设置", kind: "boolean", supported: true, desktopSource: "preferences.use_preferences_save (true)" },
{ path: "themes.note", tab: "themes", label: "主题", kind: "readonly", supported: false, desktopSource: "preferences.themes;Web 当前固定 dark" },
{ path: "themes.preset", tab: "themes", label: "主题预设", kind: "select", options: [{ value: "DARK", label: "Dark" }, { value: "LIGHT", label: "Light" }, { value: "HIGH_CONTRAST", label: "High Contrast" }], supported: true, desktopSource: "preferences.themes" },
{ path: "system.note", tab: "system", label: "系统 / 输入设备 / 扩展", kind: "readonly", supported: false, desktopSource: "preferences.system / inputs / addons / extensions" },
];
@@ -205,6 +209,7 @@ export function validateWebPreferences(value: unknown): WebPreferencesIR {
const n = record(value.navigation) ? value.navigation : {};
const k = record(value.keymap) ? value.keymap : {};
const s = record(value.saveLoad) ? value.saveLoad : {};
const t = record(value.themes) ? value.themes : {};
const bindings: Record<string, string> = {};
if (record(k.bindings)) {
for (const [key, chord] of Object.entries(k.bindings)) {
@@ -254,6 +259,7 @@ export function validateWebPreferences(value: unknown): WebPreferencesIR {
usePreferencesSave: bool(s.usePreferencesSave, d.saveLoad.usePreferencesSave),
},
files: { note: d.files.note },
themes: { preset: t.preset === "LIGHT" || t.preset === "HIGH_CONTRAST" ? t.preset : "DARK" },
};
}