- ClipGraphView follows clip_graph_draw.cc/space_clip.cc: curves in the View2D data rect (scene frames 0..efra, values -10..10), active-track 2px/opaque vs 1px/50%, knots only for the active track on SPEED_X/SPEED_Y; clip-graph now asserts every knot against that mapping within 0.6px. - Fix the knot <title> crash from referencing `curve` outside its map scope, which threw on every render with a selected track and stalled graph refresh. - clip-stab-composite: pixel-level stabilized composite reference test; caught the column-major matrix translation being read from slots 3/7 instead of 12/13 in the canvas and pointer mapping. - tracking-mask.ts accepts pattern corners within -4..4, matching the engine's clamp for out-of-frame patterns. - New headed cases: clip-track-panel (scopes preview, colour presets, average error), clip-point-motion (opens synthetic-point-motion.blend). - Headed suite 27/27 PASS, receipt tests/golden/CLIP-HEADED-20261204-082003, check-clip-headed status PASS, acceptance NOT_CLAIMED. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
23 lines
1.6 KiB
TypeScript
23 lines
1.6 KiB
TypeScript
import { normalizeProjectAssetPath } from './asset-path';
|
|
|
|
export const EDITOR_RESOURCE_MAX_BYTES = 256 * 1024 * 1024;
|
|
export const SHADER_BUNDLE_MAX_FILES = 256;
|
|
export interface ShaderResourceSelection { batchId: string; relativePath: string }
|
|
export function isEditorResourcePath(value: unknown): value is string {
|
|
if (typeof value !== 'string') return false;
|
|
const parts = value.split('/'), bytes = new TextEncoder();
|
|
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|mp4|mov|avi|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}`;
|
|
if (!isEditorResourcePath(path)) throw new Error('请选择不含路径跳转的模型相对路径');
|
|
return path;
|
|
}
|
|
export function shaderResourcePath(selection: ShaderResourceSelection): string {
|
|
const path = `cache/${selection.batchId}/shader/${selection.relativePath}`;
|
|
if (!isEditorResourcePath(path)) throw new Error('Choose a bounded shader-relative path without traversal or renamed characters'); return path;
|
|
}
|