@deepblend/dsh-blender-contracts 0.6.4 → 0.8.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/lathe-shell.js +65 -0
- package/lib/recipe-parameters.js +32 -12
- package/lib/recipe.js +40 -9
- package/lib/scene-patch.js +17 -0
- package/lib/schema-types.d.ts +3 -3
- package/lib/schemas/recipe.schema.json +100 -2
- package/package.json +1 -1
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/** Bounded paired lathe profiles: expand the rim while keeping the neck fixed. */
|
|
2
|
+
import { canonicalStringify } from './canonical.js'
|
|
3
|
+
|
|
4
|
+
const add = (a, b) => [a[0] + b[0], a[1] + b[1]]
|
|
5
|
+
const sub = (a, b) => [a[0] - b[0], a[1] - b[1]]
|
|
6
|
+
const tangent = (points, index) => {
|
|
7
|
+
const delta = sub(points[Math.min(points.length - 1, index + 1)], points[Math.max(0, index - 1)])
|
|
8
|
+
const length = Math.hypot(...delta)
|
|
9
|
+
if (!Number.isFinite(length) || length === 0) throw new TypeError('Paired profiles require distinct neighbouring points')
|
|
10
|
+
return delta.map(value => value / length)
|
|
11
|
+
}
|
|
12
|
+
const rotate = (delta, before, after) => {
|
|
13
|
+
const cosine = before[0] * after[0] + before[1] * after[1]
|
|
14
|
+
const sine = before[0] * after[1] - before[1] * after[0]
|
|
15
|
+
return [delta[0] * cosine - delta[1] * sine, delta[0] * sine + delta[1] * cosine]
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function latheShellTargets(binding) {
|
|
19
|
+
return [binding.entityId, binding.linerEntityId].map(entityId => ({
|
|
20
|
+
kind: 'generator', property: 'profile', entityId, latheShell: true,
|
|
21
|
+
}))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** The manifest supplies bounded correspondence, never executable expressions. */
|
|
25
|
+
export function deformLatheShell(spec, binding, delta) {
|
|
26
|
+
const shell = spec.entities.find(entity => entity.id === binding.entityId)
|
|
27
|
+
const liner = spec.entities.find(entity => entity.id === binding.linerEntityId)
|
|
28
|
+
const count = binding.outerPointCount, start = binding.linerStart, liningCount = binding.linerPointCount
|
|
29
|
+
const fail = message => { throw new TypeError(message) }
|
|
30
|
+
if (!shell || !liner || shell === liner) fail('A shell binding requires distinct existing shell and liner entities')
|
|
31
|
+
for (const entity of [shell, liner]) {
|
|
32
|
+
if (entity.type !== 'generator' || entity.generator?.shape !== 'lathe' || entity.generator.closedProfile !== true) fail('Shell and liner must be closed lathe profiles')
|
|
33
|
+
if ((entity.transform?.scale ?? [1, 1, 1]).some(value => value !== 1)) fail('Shell profiles require unit scale')
|
|
34
|
+
}
|
|
35
|
+
if (canonicalStringify(shell.transform) !== canonicalStringify(liner.transform)) fail('Shell and liner must share their authored transform')
|
|
36
|
+
const profile = shell.generator.profile, lining = liner.generator.profile
|
|
37
|
+
if (profile.length < 2 * count + 3 || lining.length !== 2 * liningCount || start + liningCount > count || start < 1) fail('Profile correspondence does not fit the shell and liner boundaries')
|
|
38
|
+
const outer = profile.slice(0, count), inner = profile.slice(count, 2 * count).toReversed()
|
|
39
|
+
const liningOuter = lining.slice(0, liningCount), liningInner = lining.slice(liningCount).toReversed()
|
|
40
|
+
if (outer[0][1] !== binding.rimHeight || outer.at(-1)[1] < binding.neckAnchorHeight || binding.neckAnchorHeight <= binding.rimHeight) fail('The authored rim and neck heights must bound the expansion')
|
|
41
|
+
outer.forEach((point, index) => {
|
|
42
|
+
tangent(outer, index); tangent(inner, index)
|
|
43
|
+
if (index && (point[1] <= outer[index - 1][1] || point[0] > outer[index - 1][0])) fail('Outer shell must rise monotonically toward its neck')
|
|
44
|
+
if (inner[index][0] >= point[0]) fail('Inner boundary must sit inside the outer shell')
|
|
45
|
+
})
|
|
46
|
+
liningOuter.forEach((point, index) => {
|
|
47
|
+
tangent(liningOuter, index)
|
|
48
|
+
if (point[0] >= inner[index + start][0] || liningInner[index][0] >= point[0]) fail('Liner correspondence must preserve a positive gap and lining thickness')
|
|
49
|
+
})
|
|
50
|
+
if (!Number.isFinite(delta)) fail('Shell expansion must be finite')
|
|
51
|
+
if (delta === 0) return { shell: structuredClone(profile), liner: structuredClone(lining) }
|
|
52
|
+
const movedOuter = outer.map(([radius, height]) => {
|
|
53
|
+
const t = Math.max(0, Math.min(1, (binding.neckAnchorHeight - height) / (binding.neckAnchorHeight - binding.rimHeight)))
|
|
54
|
+
return [radius + delta * t * t * (3 - 2 * t), height]
|
|
55
|
+
})
|
|
56
|
+
const movedInner = inner.map((point, index) => add(movedOuter[index], rotate(sub(point, outer[index]), tangent(outer, index), tangent(movedOuter, index))))
|
|
57
|
+
const movedLining = liningOuter.map((point, index) => add(movedInner[index + start], rotate(sub(point, inner[index + start]), tangent(inner, index + start), tangent(movedInner, index + start))))
|
|
58
|
+
const movedLiningInner = liningInner.map((point, index) => add(movedLining[index], rotate(sub(point, liningOuter[index]), tangent(liningOuter, index), tangent(movedLining, index))))
|
|
59
|
+
const result = {
|
|
60
|
+
shell: [...movedOuter, ...movedInner.toReversed(), ...profile.slice(2 * count).map(([radius, height]) => [radius + delta, height])],
|
|
61
|
+
liner: [...movedLining, ...movedLiningInner.toReversed()],
|
|
62
|
+
}
|
|
63
|
+
for (const points of Object.values(result)) if (points.some(point => point[0] <= 0 || point.some(value => !Number.isFinite(value)))) fail('The entire expansion must retain finite positive radii')
|
|
64
|
+
return result
|
|
65
|
+
}
|
package/lib/recipe-parameters.js
CHANGED
|
@@ -1,17 +1,22 @@
|
|
|
1
1
|
/** Plan existing-assembly edits as ordinary, bounded ScenePatch operations. */
|
|
2
|
+
import { latheShellTargets } from './lathe-shell.js'
|
|
2
3
|
import { canonicalStringify, sha256Canonical } from './canonical.js'
|
|
3
4
|
import { instantiateRecipeLock, RecipeError } from './recipe.js'
|
|
4
5
|
import { validateSceneSpec } from './scene-spec.js'
|
|
5
6
|
|
|
6
7
|
const axisOf = binding => ['x', 'y', 'z'].indexOf(binding.axis)
|
|
7
|
-
const structural = parameter => parameter.bindings.some(binding =>
|
|
8
|
-
&& parameter.bindings.every(binding => ['entity', 'camera'].includes(binding.kind))
|
|
8
|
+
const structural = parameter => parameter.bindings.some(binding => ['entity', 'generator', 'lathe-shell'].includes(binding.kind))
|
|
9
|
+
&& parameter.bindings.every(binding => ['entity', 'camera', 'generator', 'lathe-shell'].includes(binding.kind))
|
|
9
10
|
const entity = (spec, id) => spec.entities.find(item => item.id === id)
|
|
10
11
|
const vector = (target, property) => property === 'dimensions' ? target?.generator?.dimensions
|
|
11
12
|
: property === 'targetPoint' ? target?.targetPoint : target?.transform?.location
|
|
12
|
-
const close = (a, b) =>
|
|
13
|
+
const close = (a, b) => Array.isArray(a) && Array.isArray(b)
|
|
14
|
+
? a.length === b.length && a.every((value, index) => close(value, b[index]))
|
|
15
|
+
: Number.isFinite(a) && Number.isFinite(b)
|
|
13
16
|
&& Math.abs(a - b) <= 1e-9 * Math.max(1, Math.abs(b))
|
|
14
17
|
|
|
18
|
+
const targets = parameter => parameter.bindings.flatMap(binding => binding.kind === 'lathe-shell' ? latheShellTargets(binding) : [binding])
|
|
19
|
+
|
|
15
20
|
export function recipeGeometryParameters(manifest) {
|
|
16
21
|
return manifest.parameters.filter(structural)
|
|
17
22
|
}
|
|
@@ -37,15 +42,27 @@ export function planRecipeGeometryEdit(lock, currentSpec, parameterState, change
|
|
|
37
42
|
}
|
|
38
43
|
}
|
|
39
44
|
const conflicts = []
|
|
40
|
-
for (const parameter of parameters) for (const binding of parameter
|
|
41
|
-
if (binding.kind
|
|
42
|
-
const
|
|
43
|
-
const
|
|
45
|
+
for (const parameter of parameters) for (const binding of targets(parameter)) {
|
|
46
|
+
if (!['entity', 'generator'].includes(binding.kind)) continue
|
|
47
|
+
const oldEntity = entity(before.spec, binding.entityId), currentEntity = entity(currentSpec, binding.entityId)
|
|
48
|
+
const expected = binding.kind === 'generator' ? oldEntity?.generator?.[binding.property]
|
|
49
|
+
: vector(oldEntity, binding.property)?.[axisOf(binding)]
|
|
50
|
+
const actual = binding.kind === 'generator' ? currentEntity?.generator?.[binding.property]
|
|
51
|
+
: vector(currentEntity, binding.property)?.[axisOf(binding)]
|
|
44
52
|
if (!close(actual, expected)) conflicts.push({ parameterId: parameter.id, entityId: binding.entityId,
|
|
45
53
|
property: binding.property, axis: binding.axis, expected, actual })
|
|
46
|
-
if (binding.
|
|
47
|
-
|
|
48
|
-
|
|
54
|
+
if (binding.kind === 'generator' && currentEntity?.generator?.shape !== oldEntity?.generator?.shape) {
|
|
55
|
+
conflicts.push({ parameterId: parameter.id, entityId: binding.entityId, property: 'shape',
|
|
56
|
+
expected: oldEntity?.generator?.shape, actual: currentEntity?.generator?.shape })
|
|
57
|
+
}
|
|
58
|
+
if (binding.latheShell && (canonicalStringify(currentEntity?.transform) !== canonicalStringify(oldEntity?.transform)
|
|
59
|
+
|| currentEntity?.generator?.closedProfile !== oldEntity?.generator?.closedProfile)) {
|
|
60
|
+
conflicts.push({ parameterId: parameter.id, entityId: binding.entityId,
|
|
61
|
+
property: 'shell-alignment', expected: oldEntity?.transform, actual: currentEntity?.transform })
|
|
62
|
+
}
|
|
63
|
+
if (binding.property === 'dimensions' || binding.kind === 'generator') {
|
|
64
|
+
const oldScale = oldEntity?.transform?.scale ?? [1, 1, 1]
|
|
65
|
+
const scale = currentEntity?.transform?.scale ?? [1, 1, 1]
|
|
49
66
|
if (!scale?.every((value, axis) => close(value, oldScale[axis]))) {
|
|
50
67
|
conflicts.push({ parameterId: parameter.id, entityId: binding.entityId,
|
|
51
68
|
property: 'scale', expected: oldScale, actual: scale })
|
|
@@ -58,7 +75,7 @@ export function planRecipeGeometryEdit(lock, currentSpec, parameterState, change
|
|
|
58
75
|
const changed = parameters.filter(parameter => before.values[parameter.id] !== after.values[parameter.id])
|
|
59
76
|
const generators = new Map(), locations = new Map(), cameras = new Map(), tracks = new Map(), animationOffsets = new Map()
|
|
60
77
|
const protectedCameras = new Set()
|
|
61
|
-
for (const parameter of changed) for (const binding of parameter
|
|
78
|
+
for (const parameter of changed) for (const binding of targets(parameter)) {
|
|
62
79
|
const axis = axisOf(binding)
|
|
63
80
|
if (binding.kind === 'camera') {
|
|
64
81
|
const actual = currentSpec.cameras?.find(item => item.id === binding.cameraId)
|
|
@@ -75,7 +92,10 @@ export function planRecipeGeometryEdit(lock, currentSpec, parameterState, change
|
|
|
75
92
|
continue
|
|
76
93
|
}
|
|
77
94
|
const actual = entity(currentSpec, binding.entityId), target = entity(after.spec, binding.entityId)
|
|
78
|
-
if (binding.
|
|
95
|
+
if (binding.kind === 'generator') {
|
|
96
|
+
if (!generators.has(actual.id)) generators.set(actual.id, structuredClone(actual.generator))
|
|
97
|
+
generators.get(actual.id)[binding.property] = target.generator[binding.property]
|
|
98
|
+
} else if (binding.property === 'dimensions') {
|
|
79
99
|
if (!generators.has(actual.id)) generators.set(actual.id, structuredClone(actual.generator))
|
|
80
100
|
generators.get(actual.id).dimensions[axis] = target.generator.dimensions[axis]
|
|
81
101
|
} else {
|
package/lib/recipe.js
CHANGED
|
@@ -4,6 +4,7 @@ import { sha256, sha256Canonical } from './canonical.js'
|
|
|
4
4
|
import { compileSchema } from './json-schema.js'
|
|
5
5
|
import { decodePng } from './png.js'
|
|
6
6
|
import { validateSceneSpec, compileSceneSpec, BOX_DIMENSIONS_FEATURE, requiredSceneFeatures } from './scene-spec.js'
|
|
7
|
+
import { deformLatheShell, latheShellTargets } from './lathe-shell.js'
|
|
7
8
|
import recipeSchema from './schemas/recipe.schema.json' with { type: 'json' }
|
|
8
9
|
|
|
9
10
|
export const RECIPE_SCHEMA_VERSION = 'deepblend.recipe/v1'
|
|
@@ -12,6 +13,8 @@ export const RECIPE_CAPABILITIES = Object.freeze([
|
|
|
12
13
|
'material.principled', 'material.glass', 'material.emission', 'material.procedural', 'material.procedural.uv', 'material.anisotropy',
|
|
13
14
|
'animation.transform', 'animation.material',
|
|
14
15
|
'recipe.geometry-bindings',
|
|
16
|
+
'recipe.generator-bindings',
|
|
17
|
+
'recipe.lathe-shell-bindings',
|
|
15
18
|
])
|
|
16
19
|
export const RECIPE_LIMITS = Object.freeze({ sceneBytes: 2 * 1024 * 1024, previewBytes: 4 * 1024 * 1024, previewPixels: 4 * 1024 * 1024 })
|
|
17
20
|
const structural = compileSchema(recipeSchema, { id: 'recipe.schema.json' })
|
|
@@ -99,20 +102,26 @@ export function validateRecipeManifest(manifest, options = {}) {
|
|
|
99
102
|
const valueIssue = parameterValueIssue(parameter, parameter.default, `${path}.default`)
|
|
100
103
|
if (valueIssue) errors.push(valueIssue)
|
|
101
104
|
for (const binding of parameter.bindings) {
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
105
|
+
const slots = binding.kind === 'lathe-shell' ? latheShellTargets(binding) : [binding]
|
|
106
|
+
for (const slot of slots) {
|
|
107
|
+
const target = slot.kind === 'material' ? `material:${slot.materialId}:${slot.property}`
|
|
108
|
+
: slot.kind === 'generator' ? `generator:${slot.entityId}:${slot.property}`
|
|
109
|
+
: ['entity', 'camera'].includes(slot.kind) ? `${slot.kind}:${slot.entityId ?? slot.cameraId}:${slot.property}.${slot.axis}` : `render-profile:${slot.profile}:exposure`
|
|
110
|
+
const prior = targets.get(target)
|
|
111
|
+
// Camera framing may add independent width/depth/height deltas. Repeating a
|
|
112
|
+
// slot inside one parameter, or overwriting any other target, remains invalid.
|
|
113
|
+
if (prior && (binding.kind !== 'camera' || prior.has(parameter.id))) errors.push(issue('RECIPE_BINDING_INVALID', path, `Target ${target} is bound more than once`))
|
|
114
|
+
if (!prior) targets.set(target, new Set([parameter.id]))
|
|
115
|
+
else prior.add(parameter.id)
|
|
116
|
+
}
|
|
110
117
|
const color = binding.kind === 'material' && binding.property === 'baseColor'
|
|
111
118
|
if ((parameter.type === 'color') !== color) errors.push(issue('RECIPE_BINDING_INVALID', path, 'Parameter type does not match the allowlisted property'))
|
|
112
119
|
if (parameter.type === 'number') {
|
|
113
|
-
if (['entity', 'camera'].includes(binding.kind)) {
|
|
120
|
+
if (['entity', 'camera', 'generator', 'lathe-shell'].includes(binding.kind)) {
|
|
114
121
|
if (!Number.isFinite(binding.multiplier) || binding.multiplier === 0) errors.push(issue('RECIPE_BINDING_INVALID', path, 'Entity binding multiplier must be finite and nonzero'))
|
|
115
122
|
if (!declared.has('recipe.geometry-bindings')) errors.push(issue('RECIPE_CAPABILITY_UNDECLARED', path, 'Entity bindings require recipe.geometry-bindings'))
|
|
123
|
+
if (binding.kind === 'generator' && !declared.has('recipe.generator-bindings')) errors.push(issue('RECIPE_CAPABILITY_UNDECLARED', path, 'Generator bindings require recipe.generator-bindings'))
|
|
124
|
+
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'))
|
|
116
125
|
if (binding.property !== 'location' && binding.offsetAnimation !== undefined) errors.push(issue('RECIPE_BINDING_INVALID', path, 'Animation offsets are only valid on location bindings'))
|
|
117
126
|
continue
|
|
118
127
|
}
|
|
@@ -190,6 +199,22 @@ function bindingsAgainstScene(manifest, spec) {
|
|
|
190
199
|
(track.property === binding.property || track.property.startsWith(`${binding.property}.`)))) {
|
|
191
200
|
errors.push(issue('RECIPE_BINDING_INVALID', path, 'A parameter must not compete with animation on the same material property'))
|
|
192
201
|
}
|
|
202
|
+
} else if (binding.kind === 'lathe-shell') {
|
|
203
|
+
try {
|
|
204
|
+
const original = deformLatheShell(spec, binding, 0)
|
|
205
|
+
const radius = Math.max(...original.shell.map(point => point[0]))
|
|
206
|
+
if (Math.abs(parameter.default * binding.multiplier - radius) > 1e-9) throw new TypeError('Shell parameter default must match the authored outer radius')
|
|
207
|
+
for (const value of [parameter.minimum, parameter.maximum]) deformLatheShell(spec, binding, (value - parameter.default) * binding.multiplier)
|
|
208
|
+
} catch (error) { errors.push(issue('RECIPE_BINDING_INVALID', path, error.message)) }
|
|
209
|
+
} else if (binding.kind === 'generator') {
|
|
210
|
+
const entity = bindingTarget(spec, binding)
|
|
211
|
+
const current = entity?.generator?.[binding.property]
|
|
212
|
+
if (entity?.generator?.shape !== 'handled_cup' || !Number.isFinite(current) || current <= 0) {
|
|
213
|
+
errors.push(issue('RECIPE_BINDING_INVALID', path, 'Generator binding requires an explicit positive handled_cup scalar'))
|
|
214
|
+
continue
|
|
215
|
+
}
|
|
216
|
+
const ends = [parameter.minimum, parameter.maximum].map(value => current + (value - parameter.default) * binding.multiplier)
|
|
217
|
+
if (ends.some(value => !Number.isFinite(value) || value <= 0)) errors.push(issue('RECIPE_BINDING_INVALID', path, 'Generator binding range must remain positive and finite'))
|
|
193
218
|
} else if (['entity', 'camera'].includes(binding.kind)) {
|
|
194
219
|
const entity = bindingTarget(spec, binding)
|
|
195
220
|
const vector = bindingVector(entity, binding), axis = bindingAxis(binding)
|
|
@@ -330,6 +355,12 @@ function resolveRecipe(manifest, checked, values) {
|
|
|
330
355
|
const material = spec.materials.find(item => item.id === binding.materialId)
|
|
331
356
|
material.parameters[binding.property] = parameter.type === 'color'
|
|
332
357
|
? [...value, material.parameters.baseColor[3] ?? 1] : value
|
|
358
|
+
} else if (binding.kind === 'lathe-shell') {
|
|
359
|
+
const profiles = deformLatheShell(checked.sceneSpec, binding, (value - parameter.default) * binding.multiplier)
|
|
360
|
+
spec.entities.find(entity => entity.id === binding.entityId).generator.profile = profiles.shell
|
|
361
|
+
spec.entities.find(entity => entity.id === binding.linerEntityId).generator.profile = profiles.liner
|
|
362
|
+
} else if (binding.kind === 'generator') {
|
|
363
|
+
bindingTarget(spec, binding).generator[binding.property] += (resolvedValues[parameter.id] - parameter.default) * binding.multiplier
|
|
333
364
|
} else if (['entity', 'camera'].includes(binding.kind)) {
|
|
334
365
|
const vector = bindingVector(bindingTarget(spec, binding), binding)
|
|
335
366
|
// Preserve the input's exact default bytes and avoid cumulative edits.
|
package/lib/scene-patch.js
CHANGED
|
@@ -23,6 +23,13 @@ import scenePatchSchema from './schemas/scene-patch.schema.json' with { type: 'j
|
|
|
23
23
|
|
|
24
24
|
const validatePatchStructure = compileSchema(scenePatchSchema, { id: 'scene-patch.schema.json' })
|
|
25
25
|
|
|
26
|
+
// Keep union validation authoritative; explain rejected known operations using
|
|
27
|
+
// their exact schema branch so callers can repair fields without searching source.
|
|
28
|
+
const operationDiagnostics = new Map(scenePatchSchema.$defs.operation.oneOf.map(branch => [
|
|
29
|
+
branch.properties.op.const,
|
|
30
|
+
compileSchema({ ...branch, $defs: scenePatchSchema.$defs }, { id: 'scene-patch-operation' }),
|
|
31
|
+
]))
|
|
32
|
+
|
|
26
33
|
/** Operation names in the order they are documented, for stable tool output. */
|
|
27
34
|
export const SCENE_OPERATION_NAMES = Object.freeze([
|
|
28
35
|
'entity.transform.update',
|
|
@@ -87,6 +94,16 @@ export function validateScenePatch(patch) {
|
|
|
87
94
|
const errors = []
|
|
88
95
|
|
|
89
96
|
const structural = validatePatchStructure(patch)
|
|
97
|
+
for (const issue of [...structural]) {
|
|
98
|
+
const match = issue.keyword === 'oneOf' && /^operations\[(\d+)\]$/.exec(issue.path)
|
|
99
|
+
if (!match) continue
|
|
100
|
+
const operation = patch.operations[Number(match[1])]
|
|
101
|
+
const diagnose = operationDiagnostics.get(operation?.op)
|
|
102
|
+
if (!diagnose) continue
|
|
103
|
+
for (const detail of diagnose(operation)) {
|
|
104
|
+
structural.push({ ...detail, path: detail.path === '<root>' ? issue.path : `${issue.path}.${detail.path}` })
|
|
105
|
+
}
|
|
106
|
+
}
|
|
90
107
|
for (const issue of structural) {
|
|
91
108
|
errors.push({ code: 'PATCH_SCHEMA_INVALID', path: issue.path, message: `${issue.message} [${issue.keyword}]` })
|
|
92
109
|
}
|
package/lib/schema-types.d.ts
CHANGED
|
@@ -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: 1f21c1c38be96020d05dd25b7b861248bf5f0b2dbb7df199dc5bbfa5b4a4f9d6 */
|
|
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; }) | ({ "kind": "camera"; "cameraId": string; "property": "location" | "targetPoint"; "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; }) | ({ "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; });
|
|
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">; }; "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">; }; "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": 19,
|
|
101
101
|
"items": {
|
|
102
102
|
"enum": [
|
|
103
103
|
"geometry.primitive",
|
|
@@ -116,7 +116,9 @@
|
|
|
116
116
|
"material.anisotropy",
|
|
117
117
|
"animation.transform",
|
|
118
118
|
"animation.material",
|
|
119
|
-
"recipe.geometry-bindings"
|
|
119
|
+
"recipe.geometry-bindings",
|
|
120
|
+
"recipe.generator-bindings",
|
|
121
|
+
"recipe.lathe-shell-bindings"
|
|
120
122
|
]
|
|
121
123
|
}
|
|
122
124
|
}
|
|
@@ -312,6 +314,102 @@
|
|
|
312
314
|
}
|
|
313
315
|
},
|
|
314
316
|
"description": "Apply a bounded parameter delta to an explicit camera position or aim point; animated camera channels are refused."
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
"type": "object",
|
|
320
|
+
"additionalProperties": false,
|
|
321
|
+
"required": [
|
|
322
|
+
"kind",
|
|
323
|
+
"entityId",
|
|
324
|
+
"property",
|
|
325
|
+
"multiplier"
|
|
326
|
+
],
|
|
327
|
+
"properties": {
|
|
328
|
+
"kind": {
|
|
329
|
+
"const": "generator"
|
|
330
|
+
},
|
|
331
|
+
"entityId": {
|
|
332
|
+
"type": "string",
|
|
333
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9._-]{0,63}$"
|
|
334
|
+
},
|
|
335
|
+
"property": {
|
|
336
|
+
"enum": [
|
|
337
|
+
"height",
|
|
338
|
+
"radius",
|
|
339
|
+
"wallThickness",
|
|
340
|
+
"handleLower",
|
|
341
|
+
"handleUpper",
|
|
342
|
+
"handleRadius",
|
|
343
|
+
"rootRadius",
|
|
344
|
+
"rootLength"
|
|
345
|
+
]
|
|
346
|
+
},
|
|
347
|
+
"multiplier": {
|
|
348
|
+
"type": "number",
|
|
349
|
+
"minimum": -1000,
|
|
350
|
+
"maximum": 1000
|
|
351
|
+
}
|
|
352
|
+
},
|
|
353
|
+
"description": "Apply a bounded scalar delta to an explicit handled_cup generator dimension, preserving unbound generator properties."
|
|
354
|
+
},
|
|
355
|
+
{
|
|
356
|
+
"type": "object",
|
|
357
|
+
"additionalProperties": false,
|
|
358
|
+
"required": [
|
|
359
|
+
"kind",
|
|
360
|
+
"entityId",
|
|
361
|
+
"linerEntityId",
|
|
362
|
+
"outerPointCount",
|
|
363
|
+
"linerStart",
|
|
364
|
+
"linerPointCount",
|
|
365
|
+
"rimHeight",
|
|
366
|
+
"neckAnchorHeight",
|
|
367
|
+
"multiplier"
|
|
368
|
+
],
|
|
369
|
+
"properties": {
|
|
370
|
+
"kind": {
|
|
371
|
+
"const": "lathe-shell"
|
|
372
|
+
},
|
|
373
|
+
"entityId": {
|
|
374
|
+
"type": "string",
|
|
375
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9._-]{0,63}$"
|
|
376
|
+
},
|
|
377
|
+
"linerEntityId": {
|
|
378
|
+
"type": "string",
|
|
379
|
+
"pattern": "^[a-zA-Z][a-zA-Z0-9._-]{0,63}$"
|
|
380
|
+
},
|
|
381
|
+
"outerPointCount": {
|
|
382
|
+
"type": "integer",
|
|
383
|
+
"minimum": 3,
|
|
384
|
+
"maximum": 2048
|
|
385
|
+
},
|
|
386
|
+
"linerStart": {
|
|
387
|
+
"type": "integer",
|
|
388
|
+
"minimum": 1,
|
|
389
|
+
"maximum": 2047
|
|
390
|
+
},
|
|
391
|
+
"linerPointCount": {
|
|
392
|
+
"type": "integer",
|
|
393
|
+
"minimum": 3,
|
|
394
|
+
"maximum": 2048
|
|
395
|
+
},
|
|
396
|
+
"rimHeight": {
|
|
397
|
+
"type": "number",
|
|
398
|
+
"minimum": -1000,
|
|
399
|
+
"maximum": 1000
|
|
400
|
+
},
|
|
401
|
+
"neckAnchorHeight": {
|
|
402
|
+
"type": "number",
|
|
403
|
+
"minimum": -1000,
|
|
404
|
+
"maximum": 1000
|
|
405
|
+
},
|
|
406
|
+
"multiplier": {
|
|
407
|
+
"type": "number",
|
|
408
|
+
"exclusiveMinimum": 0,
|
|
409
|
+
"maximum": 1
|
|
410
|
+
}
|
|
411
|
+
},
|
|
412
|
+
"description": "Bounded paired shell and liner profile expansion with fixed neck. Correspondence is authored data, not code."
|
|
315
413
|
}
|
|
316
414
|
]
|
|
317
415
|
},
|