@deepblend/dsh-blender-contracts 0.27.0 → 0.28.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.
@@ -0,0 +1,6 @@
1
+ /** Bounded finishing belongs to the joint, after its array/mirror control meshes. */
2
+ export const HALF_LAP_EDGE_FINISH_FEATURE = 'geometry.joinery.half_lap.edge_finish'
3
+ export const HALF_LAP_EDGE_MAX = 0.005
4
+ export const halfLapKey = ids => [...ids].sort().join(':')
5
+ export const findHalfLap = (spec, ids) => spec.halfLaps?.find(pair =>
6
+ halfLapKey([pair.lowerEntityId, pair.upperEntityId]) === halfLapKey(ids))
package/lib/index.js CHANGED
@@ -703,6 +703,7 @@ export {
703
703
  MESH_GEOMETRY_FEATURE,
704
704
  SUBDIVISION_FEATURE,
705
705
  SURFACE_SCATTER_FEATURE,
706
+ HALF_LAP_EDGE_FINISH_FEATURE,
706
707
  requiredSceneFeatures,
707
708
  entityBoundingRadius,
708
709
  sceneProjection,
@@ -7,10 +7,11 @@ import { latheShellTargets } from './lathe-shell.js'
7
7
  import { canonicalStringify, sha256Canonical } from './canonical.js'
8
8
  import { instantiateRecipeLock, RecipeError } from './recipe.js'
9
9
  import { validateSceneSpec } from './scene-spec.js'
10
+ import { findHalfLap, halfLapKey } from './half-lap.js'
10
11
 
11
12
  const axisOf = binding => ['x', 'y', 'z'].indexOf(binding.axis)
12
- const structural = parameter => parameter.bindings.some(binding => ['entity', 'generator', 'lathe-shell', 'curve-point', 'array'].includes(binding.kind))
13
- && parameter.bindings.every(binding => ['entity', 'camera', 'generator', 'lathe-shell', 'curve-point', 'array'].includes(binding.kind))
13
+ const structural = parameter => parameter.bindings.some(binding => ['entity', 'generator', 'lathe-shell', 'curve-point', 'array', 'half-lap'].includes(binding.kind))
14
+ && parameter.bindings.every(binding => ['entity', 'camera', 'generator', 'lathe-shell', 'curve-point', 'array', 'half-lap'].includes(binding.kind))
14
15
  const entity = (spec, id) => spec.entities.find(item => item.id === id)
15
16
  const vector = (target, property) => property === 'dimensions' ? target?.generator?.dimensions
16
17
  : property === 'targetPoint' ? target?.targetPoint : target?.transform?.location
@@ -62,6 +63,13 @@ export function planRecipeGeometryEdit(lock, currentSpec, parameterState, change
62
63
  }
63
64
  const conflicts = []
64
65
  for (const parameter of parameters) for (const binding of targets(parameter)) {
66
+ if (binding.kind === 'half-lap') {
67
+ const oldPair = findHalfLap(before.spec, binding.entityIds), currentPair = findHalfLap(currentSpec, binding.entityIds)
68
+ const expected = oldPair?.edgeWidth ?? 0, actual = currentPair?.edgeWidth ?? 0
69
+ if (!currentPair || !close(actual, expected)) conflicts.push({ parameterId: parameter.id,
70
+ entityIds: binding.entityIds, property: 'edgeWidth', expected, actual: currentPair ? actual : null })
71
+ continue
72
+ }
65
73
  if (!['entity', 'generator', 'curve-point', 'array'].includes(binding.kind)) continue
66
74
  const oldEntity = entity(before.spec, binding.entityId), currentEntity = entity(currentSpec, binding.entityId)
67
75
  const expected = boundValue(oldEntity, binding)
@@ -105,9 +113,15 @@ export function planRecipeGeometryEdit(lock, currentSpec, parameterState, change
105
113
 
106
114
  const changed = parameters.filter(parameter => before.values[parameter.id] !== after.values[parameter.id]
107
115
  || assembly && !parameterState?.assemblyRepair && Object.keys(changes).includes(parameter.id))
108
- const generators = new Map(), modifierEdits = new Map(), locations = new Map(), cameras = new Map(), tracks = new Map(), animationOffsets = new Map()
116
+ const generators = new Map(), modifierEdits = new Map(), jointEdits = new Map(), locations = new Map(), cameras = new Map(), tracks = new Map(), animationOffsets = new Map()
109
117
  const protectedCameras = new Set()
110
118
  for (const parameter of changed) for (const binding of targets(parameter)) {
119
+ if (binding.kind === 'half-lap') {
120
+ const actual = findHalfLap(currentSpec, binding.entityIds), target = findHalfLap(after.spec, binding.entityIds)
121
+ jointEdits.set(halfLapKey(binding.entityIds), { op: 'joint.halfLap.set',
122
+ lowerEntityId: actual.lowerEntityId, upperEntityId: actual.upperEntityId, edgeWidth: target.edgeWidth ?? 0 })
123
+ continue
124
+ }
111
125
  const axis = axisOf(binding)
112
126
  if (binding.kind === 'camera') {
113
127
  const actual = currentSpec.cameras?.find(item => item.id === binding.cameraId)
@@ -165,6 +179,7 @@ export function planRecipeGeometryEdit(lock, currentSpec, parameterState, change
165
179
  ...[...generators].map(([entityId, generator]) => ({ op: 'entity.generator.set', entityId, generator })),
166
180
  ...[...modifierEdits].map(([entityId, modifiers]) => ({ op: 'entity.modifiers.set', entityId, modifiers })),
167
181
  ...[...locations].map(([entityId, location]) => ({ op: 'entity.transform.update', entityId, location })),
182
+ ...jointEdits.values(),
168
183
  ...cameras.values(),
169
184
  ...[...tracks.values()].map(track => ({ op: 'animation.track.set', track })),
170
185
  ]
package/lib/recipe.js CHANGED
@@ -5,12 +5,13 @@ import { compileSchema } from './json-schema.js'
5
5
  import { decodePng } from './png.js'
6
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
+ import { findHalfLap, halfLapKey, HALF_LAP_EDGE_FINISH_FEATURE, HALF_LAP_EDGE_MAX } from './half-lap.js'
8
9
  import recipeSchema from './schemas/recipe.schema.json' with { type: 'json' }
9
10
 
10
11
  export const RECIPE_SCHEMA_VERSION = 'deepblend.recipe/v1'
11
12
  export const RECIPE_CAPABILITIES = Object.freeze([
12
13
  '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, HALF_LAP_FEATURE,
14
+ MESH_GEOMETRY_FEATURE, SUBDIVISION_FEATURE, SURFACE_SCATTER_FEATURE, HALF_LAP_FEATURE, HALF_LAP_EDGE_FINISH_FEATURE,
14
15
  'material.principled', 'material.glass', 'material.emission', 'material.procedural', 'material.procedural.uv', 'material.anisotropy',
15
16
  'animation.transform', 'animation.material',
16
17
  'recipe.geometry-bindings',
@@ -18,6 +19,7 @@ export const RECIPE_CAPABILITIES = Object.freeze([
18
19
  'recipe.lathe-shell-bindings',
19
20
  'recipe.curve-point-bindings',
20
21
  'recipe.array-bindings',
22
+ 'recipe.half-lap-bindings',
21
23
  'recipe.threshold-bindings',
22
24
  ])
23
25
  export const RECIPE_LIMITS = Object.freeze({ sceneBytes: 2 * 1024 * 1024, previewBytes: 4 * 1024 * 1024, previewPixels: 4 * 1024 * 1024 })
@@ -113,12 +115,16 @@ export function validateRecipeManifest(manifest, options = {}) {
113
115
  const valueIssue = parameterValueIssue(parameter, parameter.default, `${path}.default`)
114
116
  if (valueIssue) errors.push(valueIssue)
115
117
  for (const binding of parameter.bindings) {
118
+ if (binding.kind === 'half-lap' && binding.entityIds[0] === binding.entityIds[1]) {
119
+ errors.push(issue('RECIPE_BINDING_INVALID', path, 'A half-lap binding needs two distinct timber IDs'))
120
+ }
116
121
  const slots = binding.kind === 'lathe-shell' ? latheShellTargets(binding) : [binding]
117
122
  for (const slot of slots) {
118
123
  const target = slot.kind === 'material' ? `material:${slot.materialId}:${slot.property}`
119
124
  : slot.kind === 'curve-point' ? `curve-point:${slot.entityId}:${slot.pointIndex}.${slot.axis}`
120
125
  : slot.kind === 'generator' ? `generator:${slot.entityId}:${slot.property}`
121
126
  : slot.kind === 'array' ? `array:${slot.entityId}:${slot.modifierIndex}.${slot.axis}`
127
+ : slot.kind === 'half-lap' ? `half-lap:${halfLapKey(slot.entityIds)}:${slot.property}`
122
128
  : ['entity', 'camera'].includes(slot.kind) ? `${slot.kind}:${slot.entityId ?? slot.cameraId}:${slot.property}.${slot.axis}` : `render-profile:${slot.profile}:exposure`
123
129
  const prior = targets.get(target)
124
130
  // Camera framing may add independent width/depth/height deltas. Repeating a
@@ -130,13 +136,14 @@ export function validateRecipeManifest(manifest, options = {}) {
130
136
  const color = binding.kind === 'material' && binding.property === 'baseColor'
131
137
  if ((parameter.type === 'color') !== color) errors.push(issue('RECIPE_BINDING_INVALID', path, 'Parameter type does not match the allowlisted property'))
132
138
  if (parameter.type === 'number') {
133
- if (['entity', 'camera', 'generator', 'lathe-shell', 'curve-point', 'array'].includes(binding.kind)) {
139
+ if (['entity', 'camera', 'generator', 'lathe-shell', 'curve-point', 'array', 'half-lap'].includes(binding.kind)) {
134
140
  if (!Number.isFinite(binding.multiplier) || binding.multiplier === 0) errors.push(issue('RECIPE_BINDING_INVALID', path, 'Entity binding multiplier must be finite and nonzero'))
135
141
  if (!declared.has('recipe.geometry-bindings')) errors.push(issue('RECIPE_CAPABILITY_UNDECLARED', path, 'Entity bindings require recipe.geometry-bindings'))
136
142
  if (binding.kind === 'generator' && !declared.has('recipe.generator-bindings')) errors.push(issue('RECIPE_CAPABILITY_UNDECLARED', path, 'Generator bindings require recipe.generator-bindings'))
137
143
  if (binding.kind === 'lathe-shell' && !declared.has('recipe.lathe-shell-bindings')) errors.push(issue('RECIPE_CAPABILITY_UNDECLARED', path, 'Lathe shell bindings require recipe.lathe-shell-bindings'))
138
144
  if (binding.kind === 'curve-point' && !declared.has('recipe.curve-point-bindings')) errors.push(issue('RECIPE_CAPABILITY_UNDECLARED', path, 'Curve points require recipe.curve-point-bindings'))
139
145
  if (binding.kind === 'array' && !declared.has('recipe.array-bindings')) errors.push(issue('RECIPE_CAPABILITY_UNDECLARED', path, 'Array offsets require recipe.array-bindings'))
146
+ if (binding.kind === 'half-lap' && (!declared.has('recipe.half-lap-bindings') || !declared.has(HALF_LAP_EDGE_FINISH_FEATURE))) errors.push(issue('RECIPE_CAPABILITY_UNDECLARED', path, 'Half-lap widths require recipe.half-lap-bindings and the native edge-finishing capability'))
140
147
  if (binding.inputFloor !== undefined && (!declared.has('recipe.threshold-bindings') || binding.inputFloor < parameter.minimum || binding.inputFloor > parameter.maximum)) errors.push(issue('RECIPE_BINDING_INVALID', path, 'A threshold must be declared and inside the parameter range'))
141
148
  if (binding.property !== 'location' && binding.offsetAnimation !== undefined) errors.push(issue('RECIPE_BINDING_INVALID', path, 'Animation offsets are only valid on location bindings'))
142
149
  continue
@@ -215,6 +222,13 @@ function bindingsAgainstScene(manifest, spec) {
215
222
  (track.property === binding.property || track.property.startsWith(`${binding.property}.`)))) {
216
223
  errors.push(issue('RECIPE_BINDING_INVALID', path, 'A parameter must not compete with animation on the same material property'))
217
224
  }
225
+ } else if (binding.kind === 'half-lap') {
226
+ const pair = findHalfLap(spec, binding.entityIds)
227
+ const current = pair?.edgeWidth ?? 0
228
+ const ends = [parameter.minimum, parameter.maximum].map(value => current + bindingDelta(value, parameter, binding))
229
+ if (!pair || ends.some(value => !Number.isFinite(value) || value < 0 || value > HALF_LAP_EDGE_MAX)) {
230
+ errors.push(issue('RECIPE_BINDING_INVALID', path, 'Half-lap bindings require an existing pair and widths in [0, 0.005] metres throughout the range'))
231
+ }
218
232
  } else if (binding.kind === 'lathe-shell') {
219
233
  try {
220
234
  const original = deformLatheShell(spec, binding, 0)
@@ -373,6 +387,11 @@ function resolveRecipe(manifest, checked, values) {
373
387
  const material = spec.materials.find(item => item.id === binding.materialId)
374
388
  material.parameters[binding.property] = parameter.type === 'color'
375
389
  ? [...value, material.parameters.baseColor[3] ?? 1] : value
390
+ } else if (binding.kind === 'half-lap') {
391
+ const pair = findHalfLap(spec, binding.entityIds)
392
+ const width = (pair.edgeWidth ?? 0) + bindingDelta(value, parameter, binding)
393
+ if (width > 0) pair.edgeWidth = width
394
+ else delete pair.edgeWidth
376
395
  } else if (binding.kind === 'lathe-shell') {
377
396
  const profiles = deformLatheShell(checked.sceneSpec, binding, bindingDelta(value, parameter, binding))
378
397
  spec.entities.find(entity => entity.id === binding.entityId).generator.profile = profiles.shell
@@ -978,10 +978,13 @@ export function applyPatchToSpec(spec, patch) {
978
978
  fail('PATCH_TARGET_IN_USE', 'a timber group already belongs to a different half lap; remove that joint first')
979
979
  }
980
980
  }
981
- const changed = enabled ? found?.lowerEntityId !== lowerEntityId : found !== undefined
981
+ const width = operation.edgeWidth ?? found?.edgeWidth ?? 0
982
+ const replacement = { lowerEntityId, upperEntityId, ...(width > 0 ? { edgeWidth: width } : {}) }
983
+ const changed = enabled ? !found || found.lowerEntityId !== lowerEntityId
984
+ || found.upperEntityId !== upperEntityId || (found.edgeWidth ?? 0) !== width : found !== undefined
982
985
  if (changed) {
983
986
  const remaining = joints.filter(joint => joint !== found)
984
- if (enabled) remaining.push({ lowerEntityId, upperEntityId })
987
+ if (enabled) remaining.push(replacement)
985
988
  if (remaining.length) next.halfLaps = remaining.sort((a, b) => a.lowerEntityId.localeCompare(b.lowerEntityId))
986
989
  else delete next.halfLaps
987
990
  }
package/lib/scene-spec.js CHANGED
@@ -25,6 +25,8 @@ import { compileSchema, formatIssues } from './json-schema.js'
25
25
  import { referenceImageIssues } from './reference-images.js'
26
26
  import { HANDLED_CUP_FIELDS, handledCupIssues, resolveHandledCup } from './handled-cup.js'
27
27
  import { MESH_FIELDS, meshGeneratorIssues } from './mesh-geometry.js'
28
+ import { HALF_LAP_EDGE_FINISH_FEATURE } from './half-lap.js'
29
+ export { HALF_LAP_EDGE_FINISH_FEATURE } from './half-lap.js'
28
30
  import sceneSpecSchema from './schemas/scene-spec.schema.json' with { type: 'json' }
29
31
 
30
32
  /** The one schema version this module understands. */
@@ -44,6 +46,7 @@ export function requiredSceneFeatures(spec) {
44
46
  if (entities.some(entity => entity.modifiers?.some(modifier => modifier.type === 'subdivision'))) features.push(SUBDIVISION_FEATURE)
45
47
  if (entities.some(entity => entity.modifiers?.some(modifier => modifier.type === 'surface_scatter'))) features.push(SURFACE_SCATTER_FEATURE)
46
48
  if (spec.halfLaps?.length) features.push(HALF_LAP_FEATURE)
49
+ if (spec.halfLaps?.some(pair => pair.edgeWidth > 0)) features.push(HALF_LAP_EDGE_FINISH_FEATURE)
47
50
  return features
48
51
  }
49
52
 
@@ -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: 26178d840f13b9f4d65f071e8edea665635aed11a0a8b52c136d0e34827340f7 */
4
+ /** Source SHA-256: 3b43331abcf19ffd22b022480c180029f845058318ee5c4c618f54aef6c41732 */
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; "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; };
41
+ export type Document = { "schemaVersion": "deepblend.scene/v1"; "project": SceneSpecSchema.Project; "halfLaps"?: Array<{ "lowerEntityId": SceneSpecSchema.Id; "upperEntityId": SceneSpecSchema.Id; "edgeWidth"?: number; }>; "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: 65d39eeb5a9825ac1b846063db6159b45164a0223e9a613b223b0757e3583f82 */
45
+ /** Source SHA-256: 783f452e704fd892515686581f7007a207624ba722d6b6fddcd8be187f1fb2f6 */
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; }) | ({ "op": "joint.halfLap.set"; "lowerEntityId": ScenePatchSchema.Id; "upperEntityId": ScenePatchSchema.Id; "enabled"?: 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; }) | ({ "op": "joint.halfLap.set"; "lowerEntityId": ScenePatchSchema.Id; "upperEntityId": ScenePatchSchema.Id; "enabled"?: boolean; "edgeWidth"?: number; });
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: 9406af739a53068ed013fb29dc399d9794cb452d84c37a7d0402a2520649b4ac */
76
+ /** Source SHA-256: 6e085819d078fb275446d34b37f4f89d5a5ece2a436ca259c156330511278088 */
77
77
  export namespace RecipeSchema {
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; }) | ({ "kind": "array"; "entityId": string; "modifierIndex": number; "property": "offset"; "axis": "x" | "y" | "z"; "multiplier": number; });
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; }) | ({ "kind": "array"; "entityId": string; "modifierIndex": number; "property": "offset"; "axis": "x" | "y" | "z"; "multiplier": number; }) | ({ "kind": "half-lap"; "entityIds": [string, string]; "property": "edgeWidth"; "multiplier": 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" | "geometry.joinery.half_lap" | "recipe.array-bindings">; }; "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" | "recipe.array-bindings" | "geometry.joinery.half_lap.edge_finish" | "recipe.half-lap-bindings">; }; "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": 26,
100
+ "maxItems": 28,
101
101
  "items": {
102
102
  "enum": [
103
103
  "geometry.primitive",
@@ -125,7 +125,9 @@
125
125
  "geometry.modifier.subdivision",
126
126
  "geometry.modifier.surface_scatter",
127
127
  "geometry.joinery.half_lap",
128
- "recipe.array-bindings"
128
+ "recipe.array-bindings",
129
+ "geometry.joinery.half_lap.edge_finish",
130
+ "recipe.half-lap-bindings"
129
131
  ]
130
132
  }
131
133
  }
@@ -506,6 +508,39 @@
506
508
  "maximum": 1000
507
509
  }
508
510
  }
511
+ },
512
+ {
513
+ "type": "object",
514
+ "additionalProperties": false,
515
+ "required": [
516
+ "kind",
517
+ "entityIds",
518
+ "property",
519
+ "multiplier"
520
+ ],
521
+ "properties": {
522
+ "kind": {
523
+ "const": "half-lap"
524
+ },
525
+ "entityIds": {
526
+ "type": "array",
527
+ "minItems": 2,
528
+ "maxItems": 2,
529
+ "items": {
530
+ "type": "string",
531
+ "pattern": "^[a-zA-Z][a-zA-Z0-9._-]{0,63}$"
532
+ }
533
+ },
534
+ "property": {
535
+ "const": "edgeWidth"
536
+ },
537
+ "multiplier": {
538
+ "type": "number",
539
+ "minimum": -1000,
540
+ "maximum": 1000
541
+ }
542
+ },
543
+ "description": "Apply a bounded scalar delta to the edge width of an authored half-lap pair. Pair identity is independent of lower/upper roles."
509
544
  }
510
545
  ]
511
546
  },
@@ -1859,10 +1859,18 @@
1859
1859
  {
1860
1860
  "type": "object",
1861
1861
  "additionalProperties": false,
1862
- "required": ["op", "aspectRatio"],
1862
+ "required": [
1863
+ "op",
1864
+ "aspectRatio"
1865
+ ],
1863
1866
  "properties": {
1864
- "op": { "const": "project.aspectRatio.set" },
1865
- "aspectRatio": { "type": "string", "pattern": "^[0-9]+:[0-9]+$" }
1867
+ "op": {
1868
+ "const": "project.aspectRatio.set"
1869
+ },
1870
+ "aspectRatio": {
1871
+ "type": "string",
1872
+ "pattern": "^[0-9]+:[0-9]+$"
1873
+ }
1866
1874
  }
1867
1875
  },
1868
1876
  {
@@ -1887,6 +1895,12 @@
1887
1895
  "type": "boolean",
1888
1896
  "default": true,
1889
1897
  "description": "False removes the joint and restores the compiled timber groups."
1898
+ },
1899
+ "edgeWidth": {
1900
+ "type": "number",
1901
+ "minimum": 0,
1902
+ "maximum": 0.005,
1903
+ "description": "World-space convex-edge bevel offset in metres. Zero removes finishing; omission preserves an existing width when changing the two groups or their roles."
1890
1904
  }
1891
1905
  }
1892
1906
  }
@@ -37,6 +37,12 @@
37
37
  },
38
38
  "upperEntityId": {
39
39
  "$ref": "#/$defs/id"
40
+ },
41
+ "edgeWidth": {
42
+ "type": "number",
43
+ "exclusiveMinimum": 0,
44
+ "maximum": 0.005,
45
+ "description": "World-space convex-edge bevel offset in metres, applied after the complementary cuts. Omitted preserves sharp edges. Concave recess edges are not rounded."
40
46
  }
41
47
  }
42
48
  }
package/lib/sdk.d.ts CHANGED
@@ -47,6 +47,7 @@ export const BOX_DIMENSIONS_FEATURE: 'geometry.primitive.dimensions';
47
47
  export const MESH_GEOMETRY_FEATURE: 'geometry.procedural.mesh';
48
48
  export const SUBDIVISION_FEATURE: 'geometry.modifier.subdivision';
49
49
  export const SURFACE_SCATTER_FEATURE: 'geometry.modifier.surface_scatter';
50
+ export const HALF_LAP_EDGE_FINISH_FEATURE: 'geometry.joinery.half_lap.edge_finish';
50
51
  export function requiredSceneFeatures(spec: SceneSpec): string[];
51
52
  export function compileSceneSpec(spec: SceneSpec): {
52
53
  spec: SceneSpec; notices: SceneSpecIssue[];
package/lib/sdk.js CHANGED
@@ -16,7 +16,7 @@ export { specChangeAudit } from './spec-change-audit.js'
16
16
  export {
17
17
  validateSceneSpec, compileSceneSpec, sceneSpecCanonicalText, sceneSpecDigest, specHash,
18
18
  reviewInputsDigest, summarizeSceneSpec,
19
- BOX_DIMENSIONS_FEATURE, MESH_GEOMETRY_FEATURE, SUBDIVISION_FEATURE, SURFACE_SCATTER_FEATURE, requiredSceneFeatures,
19
+ BOX_DIMENSIONS_FEATURE, MESH_GEOMETRY_FEATURE, SUBDIVISION_FEATURE, SURFACE_SCATTER_FEATURE, HALF_LAP_EDGE_FINISH_FEATURE, requiredSceneFeatures,
20
20
  } from './scene-spec.js'
21
21
  export { SCENE_OPERATION_NAMES, validateScenePatch, applyPatchToSpec, buildOperationManifest } from './scene-patch.js'
22
22
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepblend/dsh-blender-contracts",
3
- "version": "0.27.0",
3
+ "version": "0.28.0",
4
4
  "type": "module",
5
5
  "description": "DeepBlend Studio Service Definition, protocol contracts, and stable error codes.",
6
6
  "main": "lib/index.js",