@deepblend/dsh-blender-contracts 0.24.0 → 0.26.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/recipe.js +2 -2
- package/lib/runtime-types.d.ts +12 -0
- package/lib/scene-patch.js +37 -0
- package/lib/scene-spec.js +29 -0
- package/lib/schema-types.d.ts +6 -6
- package/lib/schemas/recipe.schema.json +3 -2
- package/lib/schemas/scene-patch.schema.json +25 -0
- package/lib/schemas/scene-spec.schema.json +21 -0
- package/lib/sdk.d.ts +1 -0
- package/lib/ui-api.js +9 -3
- package/package.json +1 -1
package/lib/recipe.js
CHANGED
|
@@ -3,14 +3,14 @@ import { inflateSync } from 'node:zlib'
|
|
|
3
3
|
import { sha256, sha256Canonical } from './canonical.js'
|
|
4
4
|
import { compileSchema } from './json-schema.js'
|
|
5
5
|
import { decodePng } from './png.js'
|
|
6
|
-
import { validateSceneSpec, compileSceneSpec, BOX_DIMENSIONS_FEATURE, MESH_GEOMETRY_FEATURE, SUBDIVISION_FEATURE, SURFACE_SCATTER_FEATURE, requiredSceneFeatures } from './scene-spec.js'
|
|
6
|
+
import { validateSceneSpec, compileSceneSpec, BOX_DIMENSIONS_FEATURE, HALF_LAP_FEATURE, MESH_GEOMETRY_FEATURE, SUBDIVISION_FEATURE, SURFACE_SCATTER_FEATURE, requiredSceneFeatures } from './scene-spec.js'
|
|
7
7
|
import { deformLatheShell, latheShellTargets } from './lathe-shell.js'
|
|
8
8
|
import recipeSchema from './schemas/recipe.schema.json' with { type: 'json' }
|
|
9
9
|
|
|
10
10
|
export const RECIPE_SCHEMA_VERSION = 'deepblend.recipe/v1'
|
|
11
11
|
export const RECIPE_CAPABILITIES = Object.freeze([
|
|
12
12
|
'geometry.primitive', BOX_DIMENSIONS_FEATURE, 'geometry.lathe', 'geometry.curve', 'geometry.handled_cup', 'geometry.handled_cup.tension', 'geometry.handled_cup.tension.extended', 'geometry.modifiers',
|
|
13
|
-
MESH_GEOMETRY_FEATURE, SUBDIVISION_FEATURE, SURFACE_SCATTER_FEATURE,
|
|
13
|
+
MESH_GEOMETRY_FEATURE, SUBDIVISION_FEATURE, SURFACE_SCATTER_FEATURE, HALF_LAP_FEATURE,
|
|
14
14
|
'material.principled', 'material.glass', 'material.emission', 'material.procedural', 'material.procedural.uv', 'material.anisotropy',
|
|
15
15
|
'animation.transform', 'animation.material',
|
|
16
16
|
'recipe.geometry-bindings',
|
package/lib/runtime-types.d.ts
CHANGED
|
@@ -90,6 +90,16 @@ export interface CompileSceneRequest extends RuntimeOptions {
|
|
|
90
90
|
/** Copy or move result.blend before resolving; never retain a scratch path as a durable artifact. */
|
|
91
91
|
onWorkingDirectory?: WorkingDirectoryCallback<CompileReport>;
|
|
92
92
|
}
|
|
93
|
+
export interface HalfLapInspectionReport extends CompileReport {
|
|
94
|
+
outputBlend: null;
|
|
95
|
+
halfLapInspection: {
|
|
96
|
+
schemaVersion: 'deepblend.half-lap-inspection/v1'; crossings: number; partialCrossings: number; sample: 'partial' | 'full';
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
export interface HalfLapInspectionRequest extends Omit<CompileSceneRequest, 'cameraFraming' | 'session' | 'onWorkingDirectory'> {
|
|
100
|
+
joint: { lowerEntityId: string; upperEntityId: string };
|
|
101
|
+
onWorkingDirectory: WorkingDirectoryCallback<HalfLapInspectionReport>;
|
|
102
|
+
}
|
|
93
103
|
export interface RenderOverrides { engine?: EngineKey; width?: number; height?: number; samples?: number }
|
|
94
104
|
/** Default world-axis bounds; optional physical object axes include native scale. Neither certifies semantic body dimensions or wall thickness. */
|
|
95
105
|
export interface GeometryInspectionRequest extends RuntimeOptions {
|
|
@@ -296,6 +306,8 @@ export interface BlenderRuntime {
|
|
|
296
306
|
invalidateCapabilities(): void;
|
|
297
307
|
resolveEngineKey(engineKey: EngineKey, options?: RuntimeOptions): Promise<EngineResolution>;
|
|
298
308
|
compileScene(request: CompileSceneRequest): Promise<RuntimeActionResult<CompileReport>>;
|
|
309
|
+
/** Optional draft inspection. Two PNGs are available to the working-directory callback. */
|
|
310
|
+
compileHalfLapInspection?(request: HalfLapInspectionRequest): Promise<RuntimeActionResult<HalfLapInspectionReport>>;
|
|
299
311
|
renderPreview(request: RenderPreviewRequest): Promise<RuntimeActionResult<PreviewReport>>;
|
|
300
312
|
renderViews(request: RenderViewsRequest): Promise<RenderViewsResult>;
|
|
301
313
|
startFrameSequence(request: FrameSequenceRequest): Promise<FrameSequenceRun>;
|
package/lib/scene-patch.js
CHANGED
|
@@ -72,6 +72,7 @@ export const SCENE_OPERATION_NAMES = Object.freeze([
|
|
|
72
72
|
'project.reviewSubject.set',
|
|
73
73
|
'entity.uv.project',
|
|
74
74
|
'project.aspectRatio.set',
|
|
75
|
+
'joint.halfLap.set',
|
|
75
76
|
])
|
|
76
77
|
|
|
77
78
|
/** The `id` grammar shared with SceneSpec. */const ID_PATTERN = /^[a-zA-Z][a-zA-Z0-9._-]*$/
|
|
@@ -148,6 +149,10 @@ export function validateScenePatch(patch) {
|
|
|
148
149
|
}
|
|
149
150
|
}
|
|
150
151
|
|
|
152
|
+
if (op === 'joint.halfLap.set' && operation.lowerEntityId === operation.upperEntityId) {
|
|
153
|
+
errors.push({ code: 'PATCH_OPERATION_INVALID', path: at, message: 'a half lap needs two distinct timber groups' })
|
|
154
|
+
}
|
|
155
|
+
|
|
151
156
|
if (op === 'entity.transform.update') {
|
|
152
157
|
const supplied = ['location', 'rotationEuler', 'scale'].filter(key => operation[key] !== undefined)
|
|
153
158
|
if (supplied.length === 0) {
|
|
@@ -548,6 +553,9 @@ export function applyPatchToSpec(spec, patch) {
|
|
|
548
553
|
}
|
|
549
554
|
const dependents = []
|
|
550
555
|
if (next.project.reviewSubjectId === operation.entityId) dependents.push('review subject')
|
|
556
|
+
if (next.halfLaps?.some(joint => [joint.lowerEntityId, joint.upperEntityId].includes(operation.entityId))) {
|
|
557
|
+
dependents.push('half lap')
|
|
558
|
+
}
|
|
551
559
|
if (next.entities.some(entity => (entity.modifiers ?? []).some(modifier =>
|
|
552
560
|
modifier.type === 'boolean' && modifier.targetEntityId === operation.entityId))) {
|
|
553
561
|
dependents.push('boolean operand')
|
|
@@ -956,6 +964,35 @@ export function applyPatchToSpec(spec, patch) {
|
|
|
956
964
|
break
|
|
957
965
|
}
|
|
958
966
|
|
|
967
|
+
case 'joint.halfLap.set': {
|
|
968
|
+
const { lowerEntityId, upperEntityId, enabled = true } = operation
|
|
969
|
+
const ids = [lowerEntityId, upperEntityId]
|
|
970
|
+
if (lowerEntityId === upperEntityId) fail('PATCH_OPERATION_INVALID', 'a half lap needs two distinct timber groups')
|
|
971
|
+
const joints = next.halfLaps ?? []
|
|
972
|
+
const found = joints.find(joint => ids.includes(joint.lowerEntityId) && ids.includes(joint.upperEntityId))
|
|
973
|
+
if (enabled) {
|
|
974
|
+
for (const id of ids) {
|
|
975
|
+
if (indexOfId(next.entities, id) < 0) fail('PATCH_TARGET_MISSING', `no entity "${id}" exists in this scene`)
|
|
976
|
+
}
|
|
977
|
+
if (joints.some(joint => joint !== found && (ids.includes(joint.lowerEntityId) || ids.includes(joint.upperEntityId)))) {
|
|
978
|
+
fail('PATCH_TARGET_IN_USE', 'a timber group already belongs to a different half lap; remove that joint first')
|
|
979
|
+
}
|
|
980
|
+
}
|
|
981
|
+
const changed = enabled ? found?.lowerEntityId !== lowerEntityId : found !== undefined
|
|
982
|
+
if (changed) {
|
|
983
|
+
const remaining = joints.filter(joint => joint !== found)
|
|
984
|
+
if (enabled) remaining.push({ lowerEntityId, upperEntityId })
|
|
985
|
+
if (remaining.length) next.halfLaps = remaining.sort((a, b) => a.lowerEntityId.localeCompare(b.lowerEntityId))
|
|
986
|
+
else delete next.halfLaps
|
|
987
|
+
}
|
|
988
|
+
applied.push({
|
|
989
|
+
op, target: lowerEntityId,
|
|
990
|
+
summary: `${enabled ? 'set' : 'removed'} half lap between "${lowerEntityId}" and "${upperEntityId}"`,
|
|
991
|
+
changedPaths: changed ? ['halfLaps'] : [],
|
|
992
|
+
})
|
|
993
|
+
break
|
|
994
|
+
}
|
|
995
|
+
|
|
959
996
|
case 'project.aspectRatio.set': {
|
|
960
997
|
next.project = { ...next.project, aspectRatio: operation.aspectRatio }
|
|
961
998
|
applied.push({ op, target: next.project.id, summary: `set the project aspect ratio to ${operation.aspectRatio}`,
|
package/lib/scene-spec.js
CHANGED
|
@@ -34,6 +34,7 @@ export const BOX_DIMENSIONS_FEATURE = 'geometry.primitive.dimensions'
|
|
|
34
34
|
export const MESH_GEOMETRY_FEATURE = 'geometry.procedural.mesh'
|
|
35
35
|
export const SUBDIVISION_FEATURE = 'geometry.modifier.subdivision'
|
|
36
36
|
export const SURFACE_SCATTER_FEATURE = 'geometry.modifier.surface_scatter'
|
|
37
|
+
export const HALF_LAP_FEATURE = 'geometry.joinery.half_lap'
|
|
37
38
|
|
|
38
39
|
/** Features whose absence must refuse compilation rather than reinterpret the scene. */
|
|
39
40
|
export function requiredSceneFeatures(spec) {
|
|
@@ -42,6 +43,7 @@ export function requiredSceneFeatures(spec) {
|
|
|
42
43
|
if (entities.some(entity => entity.type === 'generator' && entity.generator?.shape === 'mesh')) features.push(MESH_GEOMETRY_FEATURE)
|
|
43
44
|
if (entities.some(entity => entity.modifiers?.some(modifier => modifier.type === 'subdivision'))) features.push(SUBDIVISION_FEATURE)
|
|
44
45
|
if (entities.some(entity => entity.modifiers?.some(modifier => modifier.type === 'surface_scatter'))) features.push(SURFACE_SCATTER_FEATURE)
|
|
46
|
+
if (spec.halfLaps?.length) features.push(HALF_LAP_FEATURE)
|
|
45
47
|
return features
|
|
46
48
|
}
|
|
47
49
|
|
|
@@ -516,6 +518,31 @@ export function validateSceneSpec(spec) {
|
|
|
516
518
|
}
|
|
517
519
|
for (const id of modifierEntities.keys()) visitModifiers(id)
|
|
518
520
|
|
|
521
|
+
const joinedEntities = new Set()
|
|
522
|
+
const movingEntities = new Set((document.animationTracks ?? []).filter(track =>
|
|
523
|
+
(track.targetKind ?? 'entity') === 'entity' && ['location', 'rotationEuler', 'scale'].includes(track.property.split('.')[0]),
|
|
524
|
+
).map(track => track.targetEntityId))
|
|
525
|
+
for (const [index, joint] of (document.halfLaps ?? []).entries()) {
|
|
526
|
+
for (const field of ['lowerEntityId', 'upperEntityId']) {
|
|
527
|
+
const id = joint[field], path = `halfLaps[${index}].${field}`
|
|
528
|
+
requiresId('entities', id, path, 'half-lap timber group')
|
|
529
|
+
const timber = modifierEntities.get(id)
|
|
530
|
+
if (joinedEntities.has(id)) {
|
|
531
|
+
errors.push({ severity: 'error', code: 'SCENE_HALF_LAP_INVALID', path,
|
|
532
|
+
message: 'a timber group must be distinct and can belong to only one half lap' })
|
|
533
|
+
}
|
|
534
|
+
joinedEntities.add(id)
|
|
535
|
+
if (timber && (timber.type !== 'generator' || timber.generator?.shape !== 'mesh' ||
|
|
536
|
+
timber.generator.vertices.length !== 8 || timber.generator.faces.length !== 6 ||
|
|
537
|
+
timber.modifiers?.some(modifier => !['array', 'mirror'].includes(modifier.type)) ||
|
|
538
|
+
timber.transform?.scale?.some(value => value <= 0) || movingEntities.has(id) ||
|
|
539
|
+
['armatureId', 'rigidBody', 'cloth', 'softBody', 'fluid'].some(key => timber[key] != null))) {
|
|
540
|
+
errors.push({ severity: 'error', code: 'SCENE_HALF_LAP_INVALID', path,
|
|
541
|
+
message: 'half laps require static box control meshes with positive scales and optional array or mirror modifiers' })
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
}
|
|
545
|
+
|
|
519
546
|
;(document.lights ?? []).forEach((light, position) => {
|
|
520
547
|
checkScale(light.transform?.scale, `lights[${position}].transform.scale`, errors, light.id)
|
|
521
548
|
})
|
|
@@ -1013,6 +1040,7 @@ export function sceneProjection(spec) {
|
|
|
1013
1040
|
shots: spec.shots ?? [],
|
|
1014
1041
|
animationTracks: spec.animationTracks ?? [],
|
|
1015
1042
|
renderProfiles: spec.renderProfiles ?? {},
|
|
1043
|
+
...(spec.halfLaps?.length ? { halfLaps: spec.halfLaps } : {}),
|
|
1016
1044
|
// ABSENCE IS PRESERVED, for the same reason `applyPatchToSpec` preserves it: a
|
|
1017
1045
|
// scene that never mentions a world must keep the digest it was recorded with.
|
|
1018
1046
|
// `world: spec.world ?? null` here would silently re-digest every revision in
|
|
@@ -1134,6 +1162,7 @@ export function summarizeSceneSpec(document, context = {}) {
|
|
|
1134
1162
|
// against the manifest and conclude the revision was corrupt.
|
|
1135
1163
|
digest: context.digest ?? sceneSpecDigest(document),
|
|
1136
1164
|
schemaVersion: spec.schemaVersion,
|
|
1165
|
+
...(spec.halfLaps?.length ? { halfLaps: structuredClone(spec.halfLaps) } : {}),
|
|
1137
1166
|
project: {
|
|
1138
1167
|
id: spec.project.id,
|
|
1139
1168
|
title: spec.project.title,
|
package/lib/schema-types.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/** Generated by deepblend/tools/generate-sdk-types.mjs. Do not edit.
|
|
2
2
|
* Types describe JSON shape. Numeric bounds, ID grammar and references still require validation. */
|
|
3
3
|
|
|
4
|
-
/** Source SHA-256:
|
|
4
|
+
/** Source SHA-256: 26178d840f13b9f4d65f071e8edea665635aed11a0a8b52c136d0e34827340f7 */
|
|
5
5
|
export namespace SceneSpecSchema {
|
|
6
6
|
export type Id = string;
|
|
7
7
|
export type World = { "color"?: SceneSpecSchema.UnitColor; "strength"?: number; "environment"?: { "assetId": SceneSpecSchema.Id; "rotation"?: number; }; };
|
|
@@ -38,11 +38,11 @@ export namespace SceneSpecSchema {
|
|
|
38
38
|
export type MaterialTangent = ({ "mode": "uv"; "uvMap": string; }) | ({ "mode": "radial"; "axis": "x" | "y" | "z"; });
|
|
39
39
|
export type ReferenceImage = { "id": SceneSpecSchema.Id; "assetId": SceneSpecSchema.Id; "sha256": string; "label": string; "purposes": Array<"geometry" | "materials" | "lighting" | "goalFit">; "notes"?: string; };
|
|
40
40
|
export type ReferenceImages = Array<SceneSpecSchema.ReferenceImage>;
|
|
41
|
-
export type Document = { "schemaVersion": "deepblend.scene/v1"; "project": SceneSpecSchema.Project; "assets"?: Array<SceneSpecSchema.Asset>; "armatures"?: Array<SceneSpecSchema.Armature>; "simulation"?: { "gravity"?: number; "bake"?: boolean; }; "materials"?: Array<SceneSpecSchema.Material>; "entities": Array<SceneSpecSchema.Entity>; "lights"?: Array<SceneSpecSchema.Light>; "cameras": Array<SceneSpecSchema.Camera>; "shots"?: Array<SceneSpecSchema.Shot>; "animationTracks"?: Array<SceneSpecSchema.AnimationTrack>; "renderProfiles": SceneSpecSchema.RenderProfiles; "world"?: SceneSpecSchema.World; };
|
|
41
|
+
export type Document = { "schemaVersion": "deepblend.scene/v1"; "project": SceneSpecSchema.Project; "halfLaps"?: Array<{ "lowerEntityId": SceneSpecSchema.Id; "upperEntityId": SceneSpecSchema.Id; }>; "assets"?: Array<SceneSpecSchema.Asset>; "armatures"?: Array<SceneSpecSchema.Armature>; "simulation"?: { "gravity"?: number; "bake"?: boolean; }; "materials"?: Array<SceneSpecSchema.Material>; "entities": Array<SceneSpecSchema.Entity>; "lights"?: Array<SceneSpecSchema.Light>; "cameras": Array<SceneSpecSchema.Camera>; "shots"?: Array<SceneSpecSchema.Shot>; "animationTracks"?: Array<SceneSpecSchema.AnimationTrack>; "renderProfiles": SceneSpecSchema.RenderProfiles; "world"?: SceneSpecSchema.World; };
|
|
42
42
|
}
|
|
43
43
|
export type SceneSpec = SceneSpecSchema.Document;
|
|
44
44
|
|
|
45
|
-
/** Source SHA-256:
|
|
45
|
+
/** Source SHA-256: 65d39eeb5a9825ac1b846063db6159b45164a0223e9a613b223b0757e3583f82 */
|
|
46
46
|
export namespace ScenePatchSchema {
|
|
47
47
|
export type Id = string;
|
|
48
48
|
export type License = { "source"?: string; "commercialUse"?: boolean; "attribution"?: string; };
|
|
@@ -60,7 +60,7 @@ export namespace ScenePatchSchema {
|
|
|
60
60
|
export type Camera = { "id": ScenePatchSchema.Id; "role"?: "active-camera" | "three-quarter" | "top" | "detail"; "lens"?: ScenePatchSchema.PositiveNumber; "sensorWidth"?: ScenePatchSchema.PositiveNumber; "clipping"?: [ScenePatchSchema.PositiveNumber, ScenePatchSchema.PositiveNumber]; "transform"?: { "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }; "targetEntityId"?: string; "targetPoint"?: ScenePatchSchema.Vec3; "fStop"?: ScenePatchSchema.PositiveNumber; "sensorHeight"?: ScenePatchSchema.PositiveNumber; "sensorFit"?: "AUTO" | "HORIZONTAL" | "VERTICAL"; "shift"?: [number, number]; "focusDistance"?: ScenePatchSchema.PositiveNumber; };
|
|
61
61
|
export type AnimationTrack = { "id": ScenePatchSchema.Id; "targetKind"?: "entity" | "camera" | "material"; "targetEntityId": string; "property": "location.x" | "location.y" | "location.z" | "rotationEuler.x" | "rotationEuler.y" | "rotationEuler.z" | "scale.x" | "scale.y" | "scale.z" | "emissionStrength" | "roughness" | "metallic" | "ior" | "alpha" | "coatWeight" | "transmissionWeight" | "baseColor.r" | "baseColor.g" | "baseColor.b" | "emissionColor.r" | "emissionColor.g" | "emissionColor.b" | "anisotropic" | "anisotropicRotation"; "keyframes": Array<{ "frame": number; "value": number; "interpolation"?: "constant" | "linear" | "bezier" | "ease_in" | "ease_out" | "ease_in_out"; }>; };
|
|
62
62
|
export type RenderProfile = { "engine"?: "eevee" | "cycles" | "workbench"; "resolution"?: [number, number]; "samples"?: number; "filmTransparent"?: boolean; "colorManagement"?: { "viewTransform"?: "Standard" | "AgX" | "Filmic" | "False Color" | "Raw"; "look"?: string; "exposure"?: number; }; "maxSamplesBudget"?: number; "raytracing"?: boolean; };
|
|
63
|
-
export type Operation = ({ "op": "entity.transform.update"; "entityId": ScenePatchSchema.Id; "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }) | ({ "op": "entity.visibility.set"; "entityId": ScenePatchSchema.Id; "visible": boolean; }) | ({ "op": "entity.tags.set"; "entityId": ScenePatchSchema.Id; "tags": Array<string>; }) | ({ "op": "entity.add"; "entity": ScenePatchSchema.Entity; }) | ({ "op": "entity.remove"; "entityId": ScenePatchSchema.Id; }) | ({ "op": "entity.material.set"; "entityId": ScenePatchSchema.Id; "materialId": string | null; }) | ({ "op": "material.texture.set"; "materialId": ScenePatchSchema.Id; "texture": (ScenePatchSchema.ProceduralTexture) | (null); }) | ({ "op": "material.add"; "material": { "id": ScenePatchSchema.Id; "shader": "principled" | "emission" | "glass"; "parameters"?: ScenePatchSchema.MaterialParameters; "texture"?: ScenePatchSchema.ProceduralTexture; "images"?: ScenePatchSchema.MaterialImages; "tangent"?: ScenePatchSchema.MaterialTangent; }; }) | ({ "op": "material.parameter.update"; "materialId": ScenePatchSchema.Id; "parameter": "baseColor" | "metallic" | "roughness" | "ior" | "alpha" | "emissionColor" | "emissionStrength" | "coatWeight" | "transmissionWeight" | "anisotropic" | "anisotropicRotation"; "value": (number) | (ScenePatchSchema.UnitColor); }) | ({ "op": "light.add"; "light": ScenePatchSchema.Light; }) | ({ "op": "light.update"; "lightId": ScenePatchSchema.Id; "transform"?: { "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }; "energy"?: ScenePatchSchema.NonNegativeNumber; "color"?: ScenePatchSchema.UnitColor; "size"?: ScenePatchSchema.PositiveNumber; "spotSize"?: number; "spotBlend"?: number; "angle"?: number; }) | ({ "op": "light.remove"; "lightId": ScenePatchSchema.Id; }) | ({ "op": "camera.add"; "camera": ScenePatchSchema.Camera; }) | ({ "op": "camera.update"; "cameraId": ScenePatchSchema.Id; "role"?: "active-camera" | "three-quarter" | "top" | "detail"; "lens"?: ScenePatchSchema.PositiveNumber; "sensorWidth"?: ScenePatchSchema.PositiveNumber; "clipping"?: [ScenePatchSchema.PositiveNumber, ScenePatchSchema.PositiveNumber]; "transform"?: { "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }; "targetEntityId"?: string; "targetPoint"?: ScenePatchSchema.Vec3; "fStop"?: ScenePatchSchema.PositiveNumber; "clearTarget"?: true; "sensorHeight"?: ScenePatchSchema.PositiveNumber; "sensorFit"?: "AUTO" | "HORIZONTAL" | "VERTICAL"; "shift"?: [number, number]; "focusDistance"?: ScenePatchSchema.PositiveNumber; }) | ({ "op": "camera.remove"; "cameraId": ScenePatchSchema.Id; }) | ({ "op": "animation.track.set"; "track": ScenePatchSchema.AnimationTrack; }) | ({ "op": "animation.track.remove"; "trackId": ScenePatchSchema.Id; }) | ({ "op": "shot.set"; "shot": { "id": ScenePatchSchema.Id; "cameraId": string; "frameRange"?: [number, number]; "description"?: string; }; }) | ({ "op": "shot.remove"; "shotId": ScenePatchSchema.Id; }) | ({ "op": "project.frameRange.set"; "frameStart": number; "frameEnd": number; "fps"?: number; }) | ({ "op": "render.profile.set"; "profileName": "preview" | "final"; "profile": ScenePatchSchema.RenderProfile; }) | ({ "op": "world.set"; "world": ScenePatchSchema.World; }) | ({ "op": "asset.add"; "asset": { "id": ScenePatchSchema.Id; "type": "glb" | "gltf" | "fbx" | "obj" | "usd" | "blend" | "png" | "jpg" | "jpeg" | "hdr" | "exr"; "path": string; "sha256"?: string; "license"?: ScenePatchSchema.License; }; }) | ({ "op": "asset.remove"; "assetId": ScenePatchSchema.Id; }) | ({ "op": "entity.generator.set"; "entityId": ScenePatchSchema.Id; "generator": ScenePatchSchema.Generator; }) | ({ "op": "entity.modifiers.set"; "entityId": ScenePatchSchema.Id; "modifiers": Array<ScenePatchSchema.ModelModifier>; }) | ({ "op": "material.images.set"; "materialId": ScenePatchSchema.Id; "images": (ScenePatchSchema.MaterialImages) | (null); }) | ({ "op": "entity.materialBindings.set"; "entityId": ScenePatchSchema.Id; "materialBindings": ScenePatchSchema.MaterialBindings; }) | ({ "op": "material.tangent.set"; "materialId": ScenePatchSchema.Id; "tangent": (ScenePatchSchema.MaterialTangent) | (null); }) | ({ "op": "project.brief.set"; "goal": string; "referenceImages": ScenePatchSchema.ReferenceImages; }) | ({ "op": "project.reviewSubject.set"; "entityId": (ScenePatchSchema.Id) | (null); }) | ({ "op": "entity.uv.project"; "entityId": ScenePatchSchema.Id; "quarterTurns"?: number; "scale"?: number; }) | ({ "op": "project.aspectRatio.set"; "aspectRatio": string; });
|
|
63
|
+
export type Operation = ({ "op": "entity.transform.update"; "entityId": ScenePatchSchema.Id; "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }) | ({ "op": "entity.visibility.set"; "entityId": ScenePatchSchema.Id; "visible": boolean; }) | ({ "op": "entity.tags.set"; "entityId": ScenePatchSchema.Id; "tags": Array<string>; }) | ({ "op": "entity.add"; "entity": ScenePatchSchema.Entity; }) | ({ "op": "entity.remove"; "entityId": ScenePatchSchema.Id; }) | ({ "op": "entity.material.set"; "entityId": ScenePatchSchema.Id; "materialId": string | null; }) | ({ "op": "material.texture.set"; "materialId": ScenePatchSchema.Id; "texture": (ScenePatchSchema.ProceduralTexture) | (null); }) | ({ "op": "material.add"; "material": { "id": ScenePatchSchema.Id; "shader": "principled" | "emission" | "glass"; "parameters"?: ScenePatchSchema.MaterialParameters; "texture"?: ScenePatchSchema.ProceduralTexture; "images"?: ScenePatchSchema.MaterialImages; "tangent"?: ScenePatchSchema.MaterialTangent; }; }) | ({ "op": "material.parameter.update"; "materialId": ScenePatchSchema.Id; "parameter": "baseColor" | "metallic" | "roughness" | "ior" | "alpha" | "emissionColor" | "emissionStrength" | "coatWeight" | "transmissionWeight" | "anisotropic" | "anisotropicRotation"; "value": (number) | (ScenePatchSchema.UnitColor); }) | ({ "op": "light.add"; "light": ScenePatchSchema.Light; }) | ({ "op": "light.update"; "lightId": ScenePatchSchema.Id; "transform"?: { "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }; "energy"?: ScenePatchSchema.NonNegativeNumber; "color"?: ScenePatchSchema.UnitColor; "size"?: ScenePatchSchema.PositiveNumber; "spotSize"?: number; "spotBlend"?: number; "angle"?: number; }) | ({ "op": "light.remove"; "lightId": ScenePatchSchema.Id; }) | ({ "op": "camera.add"; "camera": ScenePatchSchema.Camera; }) | ({ "op": "camera.update"; "cameraId": ScenePatchSchema.Id; "role"?: "active-camera" | "three-quarter" | "top" | "detail"; "lens"?: ScenePatchSchema.PositiveNumber; "sensorWidth"?: ScenePatchSchema.PositiveNumber; "clipping"?: [ScenePatchSchema.PositiveNumber, ScenePatchSchema.PositiveNumber]; "transform"?: { "location"?: ScenePatchSchema.Vec3; "rotationEuler"?: ScenePatchSchema.Vec3; "scale"?: ScenePatchSchema.Vec3; }; "targetEntityId"?: string; "targetPoint"?: ScenePatchSchema.Vec3; "fStop"?: ScenePatchSchema.PositiveNumber; "clearTarget"?: true; "sensorHeight"?: ScenePatchSchema.PositiveNumber; "sensorFit"?: "AUTO" | "HORIZONTAL" | "VERTICAL"; "shift"?: [number, number]; "focusDistance"?: ScenePatchSchema.PositiveNumber; }) | ({ "op": "camera.remove"; "cameraId": ScenePatchSchema.Id; }) | ({ "op": "animation.track.set"; "track": ScenePatchSchema.AnimationTrack; }) | ({ "op": "animation.track.remove"; "trackId": ScenePatchSchema.Id; }) | ({ "op": "shot.set"; "shot": { "id": ScenePatchSchema.Id; "cameraId": string; "frameRange"?: [number, number]; "description"?: string; }; }) | ({ "op": "shot.remove"; "shotId": ScenePatchSchema.Id; }) | ({ "op": "project.frameRange.set"; "frameStart": number; "frameEnd": number; "fps"?: number; }) | ({ "op": "render.profile.set"; "profileName": "preview" | "final"; "profile": ScenePatchSchema.RenderProfile; }) | ({ "op": "world.set"; "world": ScenePatchSchema.World; }) | ({ "op": "asset.add"; "asset": { "id": ScenePatchSchema.Id; "type": "glb" | "gltf" | "fbx" | "obj" | "usd" | "blend" | "png" | "jpg" | "jpeg" | "hdr" | "exr"; "path": string; "sha256"?: string; "license"?: ScenePatchSchema.License; }; }) | ({ "op": "asset.remove"; "assetId": ScenePatchSchema.Id; }) | ({ "op": "entity.generator.set"; "entityId": ScenePatchSchema.Id; "generator": ScenePatchSchema.Generator; }) | ({ "op": "entity.modifiers.set"; "entityId": ScenePatchSchema.Id; "modifiers": Array<ScenePatchSchema.ModelModifier>; }) | ({ "op": "material.images.set"; "materialId": ScenePatchSchema.Id; "images": (ScenePatchSchema.MaterialImages) | (null); }) | ({ "op": "entity.materialBindings.set"; "entityId": ScenePatchSchema.Id; "materialBindings": ScenePatchSchema.MaterialBindings; }) | ({ "op": "material.tangent.set"; "materialId": ScenePatchSchema.Id; "tangent": (ScenePatchSchema.MaterialTangent) | (null); }) | ({ "op": "project.brief.set"; "goal": string; "referenceImages": ScenePatchSchema.ReferenceImages; }) | ({ "op": "project.reviewSubject.set"; "entityId": (ScenePatchSchema.Id) | (null); }) | ({ "op": "entity.uv.project"; "entityId": ScenePatchSchema.Id; "quarterTurns"?: number; "scale"?: number; }) | ({ "op": "project.aspectRatio.set"; "aspectRatio": string; }) | ({ "op": "joint.halfLap.set"; "lowerEntityId": ScenePatchSchema.Id; "upperEntityId": ScenePatchSchema.Id; "enabled"?: boolean; });
|
|
64
64
|
export type ModelModifier = ({ "type": "solidify"; "thickness": number; "offset"?: number; }) | ({ "type": "mirror"; "axis": "x" | "y" | "z"; "merge"?: boolean; }) | ({ "type": "array"; "count": number; "offset": ScenePatchSchema.Vec3; }) | ({ "type": "boolean"; "operation": "union" | "difference" | "intersect"; "targetEntityId": ScenePatchSchema.Id; }) | ({ "type": "bevel"; "width": number; "segments"?: number; "angle"?: number; "miterInner"?: "arc" | "sharp"; }) | ({ "type": "subdivision"; "levels": number; "scheme"?: "catmull-clark" | "simple"; "boundaryMode"?: "all" | "preserve-corners"; }) | ({ "type": "surface_scatter"; "targetEntityIds": Array<ScenePatchSchema.Id>; "count": number; "seed"?: number; "anchorVertexIndices": Array<number>; "embedDepthMm"?: number; "scaleRange"?: [number, number]; "upwardBias"?: number; });
|
|
65
65
|
export type ImageBinding = { "assetId": ScenePatchSchema.Id; "scale"?: ScenePatchSchema.Vec3; "offset"?: ScenePatchSchema.Vec3; "uvMap"?: string; "channel"?: "r" | "g" | "b" | "a"; "strength"?: number; };
|
|
66
66
|
export type MaterialImages = { "baseColor"?: ScenePatchSchema.ImageBinding; "roughness"?: ScenePatchSchema.ImageBinding; "metallic"?: ScenePatchSchema.ImageBinding; "normal"?: ScenePatchSchema.ImageBinding; "alpha"?: ScenePatchSchema.ImageBinding; "emissionColor"?: ScenePatchSchema.ImageBinding; };
|
|
@@ -73,12 +73,12 @@ export namespace ScenePatchSchema {
|
|
|
73
73
|
}
|
|
74
74
|
export type ScenePatch = ScenePatchSchema.Document;
|
|
75
75
|
|
|
76
|
-
/** Source SHA-256:
|
|
76
|
+
/** Source SHA-256: 988fcb1915761425546909153eb5839fe3f57182a57fefbdfa65746685f32d16 */
|
|
77
77
|
export namespace RecipeSchema {
|
|
78
78
|
export type Binding = ({ "kind": "material"; "materialId": string; "property": "baseColor" | "roughness"; }) | ({ "kind": "render-profile"; "profile": "preview" | "final"; "property": "exposure"; }) | ({ "kind": "entity"; "entityId": string; "property": "dimensions" | "location"; "axis": "x" | "y" | "z"; "multiplier": number; "offsetAnimation"?: boolean; "inputFloor"?: number; }) | ({ "kind": "camera"; "cameraId": string; "property": "location" | "targetPoint"; "axis": "x" | "y" | "z"; "multiplier": number; }) | ({ "kind": "generator"; "entityId": string; "property": "height" | "radius" | "wallThickness" | "handleLower" | "handleUpper" | "handleRadius" | "rootRadius" | "rootLength"; "multiplier": number; }) | ({ "kind": "lathe-shell"; "entityId": string; "linerEntityId": string; "outerPointCount": number; "linerStart": number; "linerPointCount": number; "rimHeight": number; "neckAnchorHeight": number; "multiplier": number; }) | ({ "kind": "curve-point"; "entityId": string; "pointIndex": number; "axis": "x" | "y" | "z"; "multiplier": number; "inputFloor"?: number; });
|
|
79
79
|
export type ColorParameter = { "id": string; "title": string; "description"?: string; "bindings": Array<RecipeSchema.Binding>; "type": "color"; "default": [number, number, number]; };
|
|
80
80
|
export type NumberParameter = { "id": string; "title": string; "description"?: string; "bindings": Array<RecipeSchema.Binding>; "type": "number"; "default": number; "minimum": number; "maximum": number; };
|
|
81
|
-
export type Document = { "schemaVersion": "deepblend.recipe/v1"; "id": string; "version": string; "title": string; "description": string; "author": { "name": string; "url"?: string; }; "license": string; "source": { "url": string; "note"?: string; }; "compatibility": { "sceneSchemaVersion": "deepblend.scene/v1"; "capabilities": Array<"geometry.primitive" | "geometry.primitive.dimensions" | "geometry.lathe" | "geometry.curve" | "geometry.handled_cup" | "geometry.handled_cup.tension" | "geometry.handled_cup.tension.extended" | "geometry.modifiers" | "material.principled" | "material.glass" | "material.emission" | "material.procedural" | "material.procedural.uv" | "material.anisotropy" | "animation.transform" | "animation.material" | "recipe.geometry-bindings" | "recipe.generator-bindings" | "recipe.lathe-shell-bindings" | "recipe.curve-point-bindings" | "recipe.threshold-bindings" | "geometry.procedural.mesh" | "geometry.modifier.subdivision" | "geometry.modifier.surface_scatter">; }; "input": { "path": "scene-spec.json"; "sha256": string; }; "preview": { "path": "preview.png"; "sha256": string; "mediaType": "image/png"; "alt": string; }; "parameters": Array<(RecipeSchema.ColorParameter) | (RecipeSchema.NumberParameter)>; };
|
|
81
|
+
export type Document = { "schemaVersion": "deepblend.recipe/v1"; "id": string; "version": string; "title": string; "description": string; "author": { "name": string; "url"?: string; }; "license": string; "source": { "url": string; "note"?: string; }; "compatibility": { "sceneSchemaVersion": "deepblend.scene/v1"; "capabilities": Array<"geometry.primitive" | "geometry.primitive.dimensions" | "geometry.lathe" | "geometry.curve" | "geometry.handled_cup" | "geometry.handled_cup.tension" | "geometry.handled_cup.tension.extended" | "geometry.modifiers" | "material.principled" | "material.glass" | "material.emission" | "material.procedural" | "material.procedural.uv" | "material.anisotropy" | "animation.transform" | "animation.material" | "recipe.geometry-bindings" | "recipe.generator-bindings" | "recipe.lathe-shell-bindings" | "recipe.curve-point-bindings" | "recipe.threshold-bindings" | "geometry.procedural.mesh" | "geometry.modifier.subdivision" | "geometry.modifier.surface_scatter" | "geometry.joinery.half_lap">; }; "input": { "path": "scene-spec.json"; "sha256": string; }; "preview": { "path": "preview.png"; "sha256": string; "mediaType": "image/png"; "alt": string; }; "parameters": Array<(RecipeSchema.ColorParameter) | (RecipeSchema.NumberParameter)>; };
|
|
82
82
|
}
|
|
83
83
|
export type RecipeManifest = RecipeSchema.Document;
|
|
84
84
|
export type Entity = SceneSpecSchema.Entity;
|
|
@@ -97,7 +97,7 @@
|
|
|
97
97
|
"capabilities": {
|
|
98
98
|
"type": "array",
|
|
99
99
|
"minItems": 1,
|
|
100
|
-
"maxItems":
|
|
100
|
+
"maxItems": 25,
|
|
101
101
|
"items": {
|
|
102
102
|
"enum": [
|
|
103
103
|
"geometry.primitive",
|
|
@@ -123,7 +123,8 @@
|
|
|
123
123
|
"recipe.threshold-bindings",
|
|
124
124
|
"geometry.procedural.mesh",
|
|
125
125
|
"geometry.modifier.subdivision",
|
|
126
|
-
"geometry.modifier.surface_scatter"
|
|
126
|
+
"geometry.modifier.surface_scatter",
|
|
127
|
+
"geometry.joinery.half_lap"
|
|
127
128
|
]
|
|
128
129
|
}
|
|
129
130
|
}
|
|
@@ -1864,6 +1864,31 @@
|
|
|
1864
1864
|
"op": { "const": "project.aspectRatio.set" },
|
|
1865
1865
|
"aspectRatio": { "type": "string", "pattern": "^[0-9]+:[0-9]+$" }
|
|
1866
1866
|
}
|
|
1867
|
+
},
|
|
1868
|
+
{
|
|
1869
|
+
"type": "object",
|
|
1870
|
+
"additionalProperties": false,
|
|
1871
|
+
"required": [
|
|
1872
|
+
"op",
|
|
1873
|
+
"lowerEntityId",
|
|
1874
|
+
"upperEntityId"
|
|
1875
|
+
],
|
|
1876
|
+
"properties": {
|
|
1877
|
+
"op": {
|
|
1878
|
+
"const": "joint.halfLap.set"
|
|
1879
|
+
},
|
|
1880
|
+
"lowerEntityId": {
|
|
1881
|
+
"$ref": "#/$defs/id"
|
|
1882
|
+
},
|
|
1883
|
+
"upperEntityId": {
|
|
1884
|
+
"$ref": "#/$defs/id"
|
|
1885
|
+
},
|
|
1886
|
+
"enabled": {
|
|
1887
|
+
"type": "boolean",
|
|
1888
|
+
"default": true,
|
|
1889
|
+
"description": "False removes the joint and restores the compiled timber groups."
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1867
1892
|
}
|
|
1868
1893
|
]
|
|
1869
1894
|
},
|
|
@@ -20,6 +20,27 @@
|
|
|
20
20
|
"project": {
|
|
21
21
|
"$ref": "#/$defs/project"
|
|
22
22
|
},
|
|
23
|
+
"halfLaps": {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"maxItems": 32,
|
|
26
|
+
"description": "Complementary half-depth joints between static rectangular timber groups.",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"additionalProperties": false,
|
|
30
|
+
"required": [
|
|
31
|
+
"lowerEntityId",
|
|
32
|
+
"upperEntityId"
|
|
33
|
+
],
|
|
34
|
+
"properties": {
|
|
35
|
+
"lowerEntityId": {
|
|
36
|
+
"$ref": "#/$defs/id"
|
|
37
|
+
},
|
|
38
|
+
"upperEntityId": {
|
|
39
|
+
"$ref": "#/$defs/id"
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
23
44
|
"assets": {
|
|
24
45
|
"type": "array",
|
|
25
46
|
"items": {
|
package/lib/sdk.d.ts
CHANGED
|
@@ -66,6 +66,7 @@ export function specChangeAudit(hashes?: { specHashBefore?: string | null; specH
|
|
|
66
66
|
export function reviewInputsDigest(spec: SceneSpec): string;
|
|
67
67
|
export interface SceneSummary {
|
|
68
68
|
revision: string | null; revisionNumber: number | null; digest: string; schemaVersion: SceneSpec['schemaVersion'];
|
|
69
|
+
halfLaps?: NonNullable<SceneSpec['halfLaps']>;
|
|
69
70
|
project: {
|
|
70
71
|
id: string; title: string; goal: string | null; referenceImages: ReferenceImage[]; reviewSubjectId: string | null;
|
|
71
72
|
fps: number; frameStart: number; frameEnd: number; aspectRatio: string; units: 'metric' | 'imperial'; activeCamera: string | null;
|
package/lib/ui-api.js
CHANGED
|
@@ -84,6 +84,7 @@ export const UI_ROUTES = Object.freeze([
|
|
|
84
84
|
{ id: 'project.review', method: 'POST', path: '/deepblend/projects/:projectId/review', write: true, summary: 'Explicitly render and consult the visual reviewer for one revision.' },
|
|
85
85
|
{ id: 'project.autofix', method: 'POST', path: '/deepblend/projects/:projectId/autofix', write: true, summary: 'Explicitly run a bounded visual correction loop for one revision.' },
|
|
86
86
|
{ id: 'project.patch', method: 'POST', path: '/deepblend/projects/:projectId/patch', write: true, summary: 'Apply a ScenePatch as one atomic revision.' },
|
|
87
|
+
{ id: 'project.halfLap.preview', method: 'POST', path: '/deepblend/projects/:projectId/half-lap-preview', write: true, summary: 'Render both slot faces of a draft timber joint without saving a revision.' },
|
|
87
88
|
{ id: 'project.recipeParameters', method: 'GET', path: '/deepblend/projects/:projectId/recipe-parameters', write: false, summary: 'Read saved assembly controls at one revision.' },
|
|
88
89
|
{ id: 'project.recipeParameters.update', method: 'POST', path: '/deepblend/projects/:projectId/recipe-parameters', write: true, summary: 'Save bounded assembly dimensions as an atomic revision.' },
|
|
89
90
|
{ id: 'project.surfacePlacement', method: 'POST', path: '/deepblend/projects/:projectId/surface-placement', write: true, summary: 'Measure and save an explicit entity or complete supported lamp placement.' },
|
|
@@ -293,9 +294,13 @@ const DIFF_COLLECTIONS = Object.freeze([
|
|
|
293
294
|
export function buildRevisionDiff(from, to, context = {}) {
|
|
294
295
|
/** @type {Record<string, unknown>} */
|
|
295
296
|
const collections = {}
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
297
|
+
const comparable = DIFF_COLLECTIONS.map(({ key, idField }) => ({ key, identify: item => item[idField] }))
|
|
298
|
+
if (from?.halfLaps?.length || to?.halfLaps?.length) {
|
|
299
|
+
comparable.push({ key: 'halfLaps', identify: joint => [joint.lowerEntityId, joint.upperEntityId].sort().join(' / ') })
|
|
300
|
+
}
|
|
301
|
+
for (const { key, identify } of comparable) {
|
|
302
|
+
const before = new Map((from?.[key] ?? []).map(item => [identify(item), item]))
|
|
303
|
+
const after = new Map((to?.[key] ?? []).map(item => [identify(item), item]))
|
|
299
304
|
const added = [...after.keys()].filter(id => !before.has(id)).sort()
|
|
300
305
|
const removed = [...before.keys()].filter(id => !after.has(id)).sort()
|
|
301
306
|
const changed = []
|
|
@@ -421,6 +426,7 @@ export function buildSceneTree(spec, context = {}) {
|
|
|
421
426
|
},
|
|
422
427
|
renderProfiles: clone(spec?.renderProfiles ?? null),
|
|
423
428
|
world: clone(spec?.world ?? null),
|
|
429
|
+
...(spec?.halfLaps?.length ? { halfLaps: clone(spec.halfLaps) } : {}),
|
|
424
430
|
reviewSubject: clone(resolveSubject(spec)),
|
|
425
431
|
assetParts: clone(assetParts),
|
|
426
432
|
counts: {
|
package/package.json
CHANGED