@deepblend/dsh-blender-contracts 0.26.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.
- package/lib/half-lap.js +6 -0
- package/lib/index.js +1 -0
- package/lib/recipe-parameters.js +40 -11
- package/lib/recipe.js +37 -8
- package/lib/scene-patch.js +5 -2
- package/lib/scene-spec.js +3 -0
- package/lib/schema-types.d.ts +7 -7
- package/lib/schemas/recipe.schema.json +80 -2
- package/lib/schemas/scene-patch.schema.json +17 -3
- package/lib/schemas/scene-spec.schema.json +6 -0
- package/lib/sdk.d.ts +1 -0
- package/lib/sdk.js +1 -1
- package/package.json +1 -1
package/lib/half-lap.js
ADDED
|
@@ -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
package/lib/recipe-parameters.js
CHANGED
|
@@ -7,13 +7,22 @@ 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'].includes(binding.kind))
|
|
13
|
-
&& parameter.bindings.every(binding => ['entity', 'camera', 'generator', 'lathe-shell', 'curve-point'].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
|
|
18
|
+
const boundValue = (target, binding) => {
|
|
19
|
+
if (binding.kind === 'array') return target?.modifiers?.[binding.modifierIndex]?.offset?.[axisOf(binding)]
|
|
20
|
+
if (binding.kind === 'curve-point') return target?.generator?.path?.[binding.pointIndex]?.[axisOf(binding)]
|
|
21
|
+
if (binding.kind === 'generator') return target?.generator?.[binding.property]
|
|
22
|
+
return vector(target, binding.property)?.[axisOf(binding)]
|
|
23
|
+
}
|
|
24
|
+
const arrayLayout = target => (target?.modifiers ?? []).flatMap((modifier, index) =>
|
|
25
|
+
modifier.type === 'array' ? [{ index, ...modifier }] : [])
|
|
17
26
|
const close = (a, b) => Array.isArray(a) && Array.isArray(b)
|
|
18
27
|
? a.length === b.length && a.every((value, index) => close(value, b[index]))
|
|
19
28
|
: Number.isFinite(a) && Number.isFinite(b)
|
|
@@ -54,14 +63,23 @@ export function planRecipeGeometryEdit(lock, currentSpec, parameterState, change
|
|
|
54
63
|
}
|
|
55
64
|
const conflicts = []
|
|
56
65
|
for (const parameter of parameters) for (const binding of targets(parameter)) {
|
|
57
|
-
if (
|
|
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
|
+
}
|
|
73
|
+
if (!['entity', 'generator', 'curve-point', 'array'].includes(binding.kind)) continue
|
|
58
74
|
const oldEntity = entity(before.spec, binding.entityId), currentEntity = entity(currentSpec, binding.entityId)
|
|
59
|
-
const expected =
|
|
60
|
-
|
|
61
|
-
const actual = binding.kind === 'curve-point' ? currentEntity?.generator?.path?.[binding.pointIndex]?.[axisOf(binding)] : binding.kind === 'generator' ? currentEntity?.generator?.[binding.property]
|
|
62
|
-
: vector(currentEntity, binding.property)?.[axisOf(binding)]
|
|
75
|
+
const expected = boundValue(oldEntity, binding)
|
|
76
|
+
const actual = boundValue(currentEntity, binding)
|
|
63
77
|
if (!close(actual, expected)) conflicts.push({ parameterId: parameter.id, entityId: binding.entityId,
|
|
64
78
|
property: binding.kind === 'curve-point' ? `path.${binding.pointIndex}` : binding.property, axis: binding.axis, expected, actual })
|
|
79
|
+
if (binding.kind === 'array' && canonicalStringify(arrayLayout(currentEntity)) !== canonicalStringify(arrayLayout(oldEntity))) {
|
|
80
|
+
conflicts.push({ parameterId: parameter.id, entityId: binding.entityId, property: 'array-layout',
|
|
81
|
+
expected: arrayLayout(oldEntity), actual: arrayLayout(currentEntity) })
|
|
82
|
+
}
|
|
65
83
|
if (['generator', 'curve-point'].includes(binding.kind) && currentEntity?.generator?.shape !== oldEntity?.generator?.shape) {
|
|
66
84
|
conflicts.push({ parameterId: parameter.id, entityId: binding.entityId, property: 'shape',
|
|
67
85
|
expected: oldEntity?.generator?.shape, actual: currentEntity?.generator?.shape })
|
|
@@ -76,8 +94,8 @@ export function planRecipeGeometryEdit(lock, currentSpec, parameterState, change
|
|
|
76
94
|
conflicts.push({ parameterId: parameter.id, entityId: binding.entityId,
|
|
77
95
|
property: 'shell-alignment', expected: oldEntity?.transform, actual: currentEntity?.transform })
|
|
78
96
|
}
|
|
79
|
-
if (binding.property === 'dimensions' || ['generator', 'curve-point'].includes(binding.kind)) {
|
|
80
|
-
if (binding.property === 'dimensions' && (currentEntity?.generator?.shape !== oldEntity?.generator?.shape
|
|
97
|
+
if (binding.property === 'dimensions' || ['generator', 'curve-point', 'array'].includes(binding.kind)) {
|
|
98
|
+
if ((binding.property === 'dimensions' || binding.kind === 'array') && (currentEntity?.generator?.shape !== oldEntity?.generator?.shape
|
|
81
99
|
|| !close(currentEntity?.transform?.rotationEuler ?? [0, 0, 0], oldEntity?.transform?.rotationEuler ?? [0, 0, 0]))) {
|
|
82
100
|
conflicts.push({ parameterId: parameter.id, entityId: binding.entityId,
|
|
83
101
|
property: 'dimension-alignment', expected: oldEntity?.transform?.rotationEuler, actual: currentEntity?.transform?.rotationEuler })
|
|
@@ -95,9 +113,15 @@ export function planRecipeGeometryEdit(lock, currentSpec, parameterState, change
|
|
|
95
113
|
|
|
96
114
|
const changed = parameters.filter(parameter => before.values[parameter.id] !== after.values[parameter.id]
|
|
97
115
|
|| assembly && !parameterState?.assemblyRepair && Object.keys(changes).includes(parameter.id))
|
|
98
|
-
const generators = 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()
|
|
99
117
|
const protectedCameras = new Set()
|
|
100
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
|
+
}
|
|
101
125
|
const axis = axisOf(binding)
|
|
102
126
|
if (binding.kind === 'camera') {
|
|
103
127
|
const actual = currentSpec.cameras?.find(item => item.id === binding.cameraId)
|
|
@@ -114,7 +138,10 @@ export function planRecipeGeometryEdit(lock, currentSpec, parameterState, change
|
|
|
114
138
|
continue
|
|
115
139
|
}
|
|
116
140
|
const actual = entity(currentSpec, binding.entityId), target = entity(after.spec, binding.entityId)
|
|
117
|
-
if (binding.kind === '
|
|
141
|
+
if (binding.kind === 'array') {
|
|
142
|
+
if (!modifierEdits.has(actual.id)) modifierEdits.set(actual.id, structuredClone(actual.modifiers))
|
|
143
|
+
modifierEdits.get(actual.id)[binding.modifierIndex].offset[axis] = target.modifiers[binding.modifierIndex].offset[axis]
|
|
144
|
+
} else if (binding.kind === 'curve-point') {
|
|
118
145
|
if (close(actual.generator.path[binding.pointIndex][axis], target.generator.path[binding.pointIndex][axis])) continue
|
|
119
146
|
if (!generators.has(actual.id)) generators.set(actual.id, structuredClone(actual.generator))
|
|
120
147
|
generators.get(actual.id).path[binding.pointIndex][axis] = target.generator.path[binding.pointIndex][axis]
|
|
@@ -150,7 +177,9 @@ export function planRecipeGeometryEdit(lock, currentSpec, parameterState, change
|
|
|
150
177
|
}
|
|
151
178
|
const operations = [
|
|
152
179
|
...[...generators].map(([entityId, generator]) => ({ op: 'entity.generator.set', entityId, generator })),
|
|
180
|
+
...[...modifierEdits].map(([entityId, modifiers]) => ({ op: 'entity.modifiers.set', entityId, modifiers })),
|
|
153
181
|
...[...locations].map(([entityId, location]) => ({ op: 'entity.transform.update', entityId, location })),
|
|
182
|
+
...jointEdits.values(),
|
|
154
183
|
...cameras.values(),
|
|
155
184
|
...[...tracks.values()].map(track => ({ op: 'animation.track.set', track })),
|
|
156
185
|
]
|
package/lib/recipe.js
CHANGED
|
@@ -5,18 +5,21 @@ 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',
|
|
17
18
|
'recipe.generator-bindings',
|
|
18
19
|
'recipe.lathe-shell-bindings',
|
|
19
20
|
'recipe.curve-point-bindings',
|
|
21
|
+
'recipe.array-bindings',
|
|
22
|
+
'recipe.half-lap-bindings',
|
|
20
23
|
'recipe.threshold-bindings',
|
|
21
24
|
])
|
|
22
25
|
export const RECIPE_LIMITS = Object.freeze({ sceneBytes: 2 * 1024 * 1024, previewBytes: 4 * 1024 * 1024, previewPixels: 4 * 1024 * 1024 })
|
|
@@ -31,8 +34,13 @@ const bindingAxis = binding => ['x', 'y', 'z'].indexOf(binding.axis)
|
|
|
31
34
|
const bindingTarget = (spec, binding) => binding.kind === 'camera' ? spec.cameras?.find(item => item.id === binding.cameraId) : spec.entities.find(item => item.id === binding.entityId)
|
|
32
35
|
const bindingDelta = (value, parameter, binding) => ((binding.inputFloor === undefined ? value : Math.max(value, binding.inputFloor))
|
|
33
36
|
- (binding.inputFloor === undefined ? parameter.default : Math.max(parameter.default, binding.inputFloor))) * binding.multiplier
|
|
34
|
-
const bindingVector = (target, binding) =>
|
|
35
|
-
|
|
37
|
+
const bindingVector = (target, binding) => {
|
|
38
|
+
if (binding.kind === 'array') return target?.modifiers?.[binding.modifierIndex]?.offset
|
|
39
|
+
if (binding.kind === 'curve-point') return target?.generator?.path?.[binding.pointIndex]
|
|
40
|
+
if (binding.property === 'dimensions') return target?.generator?.dimensions
|
|
41
|
+
if (binding.property === 'targetPoint') return target?.targetPoint
|
|
42
|
+
return target?.transform?.location
|
|
43
|
+
}
|
|
36
44
|
const bindingTracks = (spec, binding) => (spec.animationTracks ?? []).filter(track => (track.targetKind ?? 'entity') === binding.kind
|
|
37
45
|
&& track.targetEntityId === (binding.entityId ?? binding.cameraId) && track.property === `location.${binding.axis}`)
|
|
38
46
|
|
|
@@ -107,11 +115,16 @@ export function validateRecipeManifest(manifest, options = {}) {
|
|
|
107
115
|
const valueIssue = parameterValueIssue(parameter, parameter.default, `${path}.default`)
|
|
108
116
|
if (valueIssue) errors.push(valueIssue)
|
|
109
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
|
+
}
|
|
110
121
|
const slots = binding.kind === 'lathe-shell' ? latheShellTargets(binding) : [binding]
|
|
111
122
|
for (const slot of slots) {
|
|
112
123
|
const target = slot.kind === 'material' ? `material:${slot.materialId}:${slot.property}`
|
|
113
124
|
: slot.kind === 'curve-point' ? `curve-point:${slot.entityId}:${slot.pointIndex}.${slot.axis}`
|
|
114
125
|
: slot.kind === 'generator' ? `generator:${slot.entityId}:${slot.property}`
|
|
126
|
+
: slot.kind === 'array' ? `array:${slot.entityId}:${slot.modifierIndex}.${slot.axis}`
|
|
127
|
+
: slot.kind === 'half-lap' ? `half-lap:${halfLapKey(slot.entityIds)}:${slot.property}`
|
|
115
128
|
: ['entity', 'camera'].includes(slot.kind) ? `${slot.kind}:${slot.entityId ?? slot.cameraId}:${slot.property}.${slot.axis}` : `render-profile:${slot.profile}:exposure`
|
|
116
129
|
const prior = targets.get(target)
|
|
117
130
|
// Camera framing may add independent width/depth/height deltas. Repeating a
|
|
@@ -123,12 +136,14 @@ export function validateRecipeManifest(manifest, options = {}) {
|
|
|
123
136
|
const color = binding.kind === 'material' && binding.property === 'baseColor'
|
|
124
137
|
if ((parameter.type === 'color') !== color) errors.push(issue('RECIPE_BINDING_INVALID', path, 'Parameter type does not match the allowlisted property'))
|
|
125
138
|
if (parameter.type === 'number') {
|
|
126
|
-
if (['entity', 'camera', 'generator', 'lathe-shell', 'curve-point'].includes(binding.kind)) {
|
|
139
|
+
if (['entity', 'camera', 'generator', 'lathe-shell', 'curve-point', 'array', 'half-lap'].includes(binding.kind)) {
|
|
127
140
|
if (!Number.isFinite(binding.multiplier) || binding.multiplier === 0) errors.push(issue('RECIPE_BINDING_INVALID', path, 'Entity binding multiplier must be finite and nonzero'))
|
|
128
141
|
if (!declared.has('recipe.geometry-bindings')) errors.push(issue('RECIPE_CAPABILITY_UNDECLARED', path, 'Entity bindings require recipe.geometry-bindings'))
|
|
129
142
|
if (binding.kind === 'generator' && !declared.has('recipe.generator-bindings')) errors.push(issue('RECIPE_CAPABILITY_UNDECLARED', path, 'Generator bindings require recipe.generator-bindings'))
|
|
130
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'))
|
|
131
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'))
|
|
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'))
|
|
132
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'))
|
|
133
148
|
if (binding.property !== 'location' && binding.offsetAnimation !== undefined) errors.push(issue('RECIPE_BINDING_INVALID', path, 'Animation offsets are only valid on location bindings'))
|
|
134
149
|
continue
|
|
@@ -207,6 +222,13 @@ function bindingsAgainstScene(manifest, spec) {
|
|
|
207
222
|
(track.property === binding.property || track.property.startsWith(`${binding.property}.`)))) {
|
|
208
223
|
errors.push(issue('RECIPE_BINDING_INVALID', path, 'A parameter must not compete with animation on the same material property'))
|
|
209
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
|
+
}
|
|
210
232
|
} else if (binding.kind === 'lathe-shell') {
|
|
211
233
|
try {
|
|
212
234
|
const original = deformLatheShell(spec, binding, 0)
|
|
@@ -223,12 +245,14 @@ function bindingsAgainstScene(manifest, spec) {
|
|
|
223
245
|
}
|
|
224
246
|
const ends = [parameter.minimum, parameter.maximum].map(value => current + bindingDelta(value, parameter, binding))
|
|
225
247
|
if (ends.some(value => !Number.isFinite(value) || value <= 0)) errors.push(issue('RECIPE_BINDING_INVALID', path, 'Generator binding range must remain positive and finite'))
|
|
226
|
-
} else if (['entity', 'camera', 'curve-point'].includes(binding.kind)) {
|
|
248
|
+
} else if (['entity', 'camera', 'curve-point', 'array'].includes(binding.kind)) {
|
|
227
249
|
const entity = bindingTarget(spec, binding)
|
|
228
250
|
const vector = bindingVector(entity, binding), axis = bindingAxis(binding)
|
|
229
|
-
if (!entity || (binding.kind === 'curve-point' && entity.generator?.shape !== 'curve')
|
|
251
|
+
if (!entity || (binding.kind === 'curve-point' && entity.generator?.shape !== 'curve')
|
|
252
|
+
|| (binding.kind === 'array' && entity.modifiers?.[binding.modifierIndex]?.type !== 'array')
|
|
253
|
+
|| (binding.property === 'dimensions' && (!['cube', 'rounded_box'].includes(entity.generator?.shape) || entity.generator.size !== undefined))
|
|
230
254
|
|| !Array.isArray(vector) || vector.length !== 3 || !Number.isFinite(vector[axis])) {
|
|
231
|
-
errors.push(issue('RECIPE_BINDING_INVALID', path, 'Structural binding requires an explicit supported dimension, position or aim point'))
|
|
255
|
+
errors.push(issue('RECIPE_BINDING_INVALID', path, 'Structural binding requires an explicit supported dimension, position, array offset or aim point'))
|
|
232
256
|
continue
|
|
233
257
|
}
|
|
234
258
|
const ends = [parameter.minimum, parameter.maximum].map(value => vector[axis] + bindingDelta(value, parameter, binding))
|
|
@@ -363,13 +387,18 @@ function resolveRecipe(manifest, checked, values) {
|
|
|
363
387
|
const material = spec.materials.find(item => item.id === binding.materialId)
|
|
364
388
|
material.parameters[binding.property] = parameter.type === 'color'
|
|
365
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
|
|
366
395
|
} else if (binding.kind === 'lathe-shell') {
|
|
367
396
|
const profiles = deformLatheShell(checked.sceneSpec, binding, bindingDelta(value, parameter, binding))
|
|
368
397
|
spec.entities.find(entity => entity.id === binding.entityId).generator.profile = profiles.shell
|
|
369
398
|
spec.entities.find(entity => entity.id === binding.linerEntityId).generator.profile = profiles.liner
|
|
370
399
|
} else if (binding.kind === 'generator') {
|
|
371
400
|
bindingTarget(spec, binding).generator[binding.property] += (resolvedValues[parameter.id] - parameter.default) * binding.multiplier
|
|
372
|
-
} else if (['entity', 'camera', 'curve-point'].includes(binding.kind)) {
|
|
401
|
+
} else if (['entity', 'camera', 'curve-point', 'array'].includes(binding.kind)) {
|
|
373
402
|
const vector = bindingVector(bindingTarget(spec, binding), binding)
|
|
374
403
|
// Preserve the input's exact default bytes and avoid cumulative edits.
|
|
375
404
|
if (value !== parameter.default) {
|
package/lib/scene-patch.js
CHANGED
|
@@ -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
|
|
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(
|
|
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
|
|
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: 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:
|
|
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:
|
|
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; });
|
|
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">; }; "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":
|
|
100
|
+
"maxItems": 28,
|
|
101
101
|
"items": {
|
|
102
102
|
"enum": [
|
|
103
103
|
"geometry.primitive",
|
|
@@ -124,7 +124,10 @@
|
|
|
124
124
|
"geometry.procedural.mesh",
|
|
125
125
|
"geometry.modifier.subdivision",
|
|
126
126
|
"geometry.modifier.surface_scatter",
|
|
127
|
-
"geometry.joinery.half_lap"
|
|
127
|
+
"geometry.joinery.half_lap",
|
|
128
|
+
"recipe.array-bindings",
|
|
129
|
+
"geometry.joinery.half_lap.edge_finish",
|
|
130
|
+
"recipe.half-lap-bindings"
|
|
128
131
|
]
|
|
129
132
|
}
|
|
130
133
|
}
|
|
@@ -463,6 +466,81 @@
|
|
|
463
466
|
"maximum": 1000000
|
|
464
467
|
}
|
|
465
468
|
}
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
"type": "object",
|
|
472
|
+
"additionalProperties": false,
|
|
473
|
+
"required": [
|
|
474
|
+
"kind",
|
|
475
|
+
"entityId",
|
|
476
|
+
"modifierIndex",
|
|
477
|
+
"property",
|
|
478
|
+
"axis",
|
|
479
|
+
"multiplier"
|
|
480
|
+
],
|
|
481
|
+
"description": "Apply a bounded parameter delta to one offset axis of an authored array modifier.",
|
|
482
|
+
"properties": {
|
|
483
|
+
"kind": {
|
|
484
|
+
"const": "array"
|
|
485
|
+
},
|
|
486
|
+
"entityId": {
|
|
487
|
+
"type": "string",
|
|
488
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9._-]{0,63}$"
|
|
489
|
+
},
|
|
490
|
+
"modifierIndex": {
|
|
491
|
+
"type": "integer",
|
|
492
|
+
"minimum": 0,
|
|
493
|
+
"maximum": 7
|
|
494
|
+
},
|
|
495
|
+
"property": {
|
|
496
|
+
"const": "offset"
|
|
497
|
+
},
|
|
498
|
+
"axis": {
|
|
499
|
+
"enum": [
|
|
500
|
+
"x",
|
|
501
|
+
"y",
|
|
502
|
+
"z"
|
|
503
|
+
]
|
|
504
|
+
},
|
|
505
|
+
"multiplier": {
|
|
506
|
+
"type": "number",
|
|
507
|
+
"minimum": -1000,
|
|
508
|
+
"maximum": 1000
|
|
509
|
+
}
|
|
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."
|
|
466
544
|
}
|
|
467
545
|
]
|
|
468
546
|
},
|
|
@@ -1859,10 +1859,18 @@
|
|
|
1859
1859
|
{
|
|
1860
1860
|
"type": "object",
|
|
1861
1861
|
"additionalProperties": false,
|
|
1862
|
-
"required": [
|
|
1862
|
+
"required": [
|
|
1863
|
+
"op",
|
|
1864
|
+
"aspectRatio"
|
|
1865
|
+
],
|
|
1863
1866
|
"properties": {
|
|
1864
|
-
"op": {
|
|
1865
|
-
|
|
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