@deepblend/dsh-blender-bundle 0.24.0 → 0.25.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/client.js +200 -6
- package/package.json +7 -7
package/lib/client.js
CHANGED
|
@@ -540,6 +540,24 @@ window.__ModuleLoader__.load({
|
|
|
540
540
|
'editor.uv.scale': '纹理重复',
|
|
541
541
|
'editor.uv.scaleInvalid': '请输入 0.0001 到 10000 之间的重复次数。',
|
|
542
542
|
'editor.uv.scaleHelp': '最长局部网格边界跨度内的重复次数。只改变纹理坐标,保存后查看实际预览。',
|
|
543
|
+
'editor.halfLap.title': '半搭接',
|
|
544
|
+
'editor.halfLap.partner': '搭接对象',
|
|
545
|
+
'editor.halfLap.none': '无搭接',
|
|
546
|
+
'editor.halfLap.role': '当前木条组',
|
|
547
|
+
'editor.halfLap.lower': '保留下半部',
|
|
548
|
+
'editor.halfLap.upper': '保留上半部',
|
|
549
|
+
'editor.halfLap.help': '两组木条须正交,顶面和底面分别等高。',
|
|
550
|
+
'editor.halfLap.invalid': '半搭接需要静态长方体网格。请移除不支持的修饰器,或将搭接对象设为「无搭接」。',
|
|
551
|
+
'editor.halfLap.inspect': '预览槽口',
|
|
552
|
+
'editor.halfLap.inspecting': '正在渲染槽口…',
|
|
553
|
+
'editor.halfLap.inspectError': '槽口预览失败。{message}',
|
|
554
|
+
'editor.halfLap.partial': '分开查看同一处端部搭接的两侧。搭接草稿尚未保存。',
|
|
555
|
+
'editor.halfLap.full': '分开查看同一处搭接的两侧。搭接草稿尚未保存。',
|
|
556
|
+
'editor.halfLap.count': '{count} 处交叉,其中 {partial} 处未跨满木条宽度',
|
|
557
|
+
'editor.halfLap.lowerPart': '下半部 · {name}',
|
|
558
|
+
'editor.halfLap.upperPart': '上半部 · {name}',
|
|
559
|
+
'editor.halfLap.lowerFace': '从上面查看下半部木条的槽口',
|
|
560
|
+
'editor.halfLap.upperFace': '从下面查看上半部木条的槽口',
|
|
543
561
|
'editor.subdivision': '曲面细分',
|
|
544
562
|
'editor.surfaceScatter': '封闭表面布置',
|
|
545
563
|
'editor.scatterTargets': '依附物体(逗号分隔)',
|
|
@@ -1438,6 +1456,24 @@ window.__ModuleLoader__.load({
|
|
|
1438
1456
|
'editor.uv.scale': 'Texture repetitions',
|
|
1439
1457
|
'editor.uv.scaleInvalid': 'Enter repetitions from 0.0001 to 10000.',
|
|
1440
1458
|
'editor.uv.scaleHelp': 'Repetitions across the longest local mesh extent. Only texture coordinates change; check the saved preview.',
|
|
1459
|
+
'editor.halfLap.title': 'Half lap',
|
|
1460
|
+
'editor.halfLap.partner': 'Join with',
|
|
1461
|
+
'editor.halfLap.none': 'No joint',
|
|
1462
|
+
'editor.halfLap.role': 'Selected timber group',
|
|
1463
|
+
'editor.halfLap.lower': 'Keep the lower half',
|
|
1464
|
+
'editor.halfLap.upper': 'Keep the upper half',
|
|
1465
|
+
'editor.halfLap.help': 'The groups must cross at right angles and share top and bottom heights.',
|
|
1466
|
+
'editor.halfLap.invalid': 'Half laps need static box meshes. Remove unsupported modifiers or set Join with to “No joint.”',
|
|
1467
|
+
'editor.halfLap.inspect': 'Preview recesses',
|
|
1468
|
+
'editor.halfLap.inspecting': 'Rendering recesses…',
|
|
1469
|
+
'editor.halfLap.inspectError': 'Could not render the recess preview. {message}',
|
|
1470
|
+
'editor.halfLap.partial': 'Two isolated faces of the same end lap. The draft is unsaved.',
|
|
1471
|
+
'editor.halfLap.full': 'Two isolated faces of the same joint. The draft is unsaved.',
|
|
1472
|
+
'editor.halfLap.count': 'Crossings: {count}. Partial-width crossings: {partial}.',
|
|
1473
|
+
'editor.halfLap.lowerPart': 'Lower half · {name}',
|
|
1474
|
+
'editor.halfLap.upperPart': 'Upper half · {name}',
|
|
1475
|
+
'editor.halfLap.lowerFace': 'Recess in the lower timber, seen from above',
|
|
1476
|
+
'editor.halfLap.upperFace': 'Recess in the upper timber, seen from below',
|
|
1441
1477
|
'editor.subdivision': 'Surface subdivision',
|
|
1442
1478
|
'editor.surfaceScatter': 'Closed surface placement',
|
|
1443
1479
|
'editor.scatterTargets': 'Support objects (comma separated)',
|
|
@@ -2730,6 +2766,29 @@ window.__ModuleLoader__.load({
|
|
|
2730
2766
|
&& (track.property === property || (property === 'baseColor' && track.property?.startsWith('baseColor.'))))
|
|
2731
2767
|
}
|
|
2732
2768
|
|
|
2769
|
+
function editorHalfLapPartner(pair, entityId) {
|
|
2770
|
+
if (pair?.lowerEntityId === entityId) return pair.upperEntityId
|
|
2771
|
+
if (pair?.upperEntityId === entityId) return pair.lowerEntityId
|
|
2772
|
+
return ''
|
|
2773
|
+
}
|
|
2774
|
+
|
|
2775
|
+
function editorTimberCandidate(entity, tracks) {
|
|
2776
|
+
const mesh = entity?.generator
|
|
2777
|
+
return entity?.kind === 'generator' && mesh?.shape === 'mesh' && mesh.vertices?.length === 8 && mesh.faces?.length === 6
|
|
2778
|
+
&& !(entity.modifiers || []).some(modifier => !['array', 'mirror'].includes(modifier.type))
|
|
2779
|
+
&& !(entity.transform?.scale || []).some(value => value <= 0)
|
|
2780
|
+
&& !tracks.some(track => track.targetKind === 'entity' && track.targetId === entity.id
|
|
2781
|
+
&& ['location', 'rotationEuler', 'scale'].includes(track.property?.split('.')[0]))
|
|
2782
|
+
}
|
|
2783
|
+
|
|
2784
|
+
function editorHalfLapPartners(draft) {
|
|
2785
|
+
const saved = editorHalfLapPartner(draft.originalHalfLap, draft.entityId)
|
|
2786
|
+
const canJoin = editorTimberCandidate(draft.entity, draft.tracks) && (saved || (draft.halfLaps?.length ?? 0) < 32)
|
|
2787
|
+
const used = new Set((draft.halfLaps || []).flatMap(pair => [pair.lowerEntityId, pair.upperEntityId]))
|
|
2788
|
+
return draft.entities.filter(entity => entity.id === saved || (canJoin && entity.id !== draft.entityId
|
|
2789
|
+
&& !used.has(entity.id) && editorTimberCandidate(entity, draft.tracks)))
|
|
2790
|
+
}
|
|
2791
|
+
|
|
2733
2792
|
function createEditorDraft(scene, projectId, entityId) {
|
|
2734
2793
|
const entity = scene.nodes.entities.find(item => item.id === entityId)
|
|
2735
2794
|
if (!entity) return null
|
|
@@ -2738,11 +2797,14 @@ window.__ModuleLoader__.load({
|
|
|
2738
2797
|
original.modifiers ||= []
|
|
2739
2798
|
original.materialBindings ||= []
|
|
2740
2799
|
const material = scene.nodes.materials.find(item => item.id === entity.materialId)
|
|
2800
|
+
const halfLaps = editorClone(scene.halfLaps || [])
|
|
2801
|
+
const originalHalfLap = halfLaps.find(pair => editorHalfLapPartner(pair, entityId)) || null
|
|
2741
2802
|
let cloneId
|
|
2742
2803
|
do { cloneId = `ui-material-${Date.now().toString(36)}-${++editorSequence}` }
|
|
2743
2804
|
while (scene.nodes.materials.some(item => item.id === cloneId))
|
|
2744
2805
|
return { projectId, entityId, baseRevision: scene.revision, original, entity: editorClone(original),
|
|
2745
2806
|
uvProjection: null,
|
|
2807
|
+
halfLaps, originalHalfLap, halfLap: editorClone(originalHalfLap),
|
|
2746
2808
|
materials: editorClone(scene.nodes.materials), entities: editorClone(scene.nodes.entities),
|
|
2747
2809
|
tracks: editorClone(scene.nodes.animationTracks || []), cloneId,
|
|
2748
2810
|
material: { id: material?.id || '', definition: editorClone(material?.definition || null),
|
|
@@ -2804,6 +2866,12 @@ window.__ModuleLoader__.load({
|
|
|
2804
2866
|
scalar(draft.uvProjection.quarterTurns, t('editor.uv.direction'), 0, 3, true)
|
|
2805
2867
|
scalar(draft.uvProjection.scale, t('editor.uv.scale'), 0.0001, 10000)
|
|
2806
2868
|
}
|
|
2869
|
+
if (draft.halfLap) {
|
|
2870
|
+
const partner = editorHalfLapPartner(draft.halfLap, draft.entityId)
|
|
2871
|
+
if (!editorTimberCandidate(draft.entity, draft.tracks) || !editorHalfLapPartners(draft).some(entity => entity.id === partner)) {
|
|
2872
|
+
errors.push(t('editor.halfLap.invalid'))
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2807
2875
|
if (generator) {
|
|
2808
2876
|
if (generator.dimensions !== undefined) {
|
|
2809
2877
|
if (!['cube', 'rounded_box'].includes(generator.shape) || generator.size !== undefined
|
|
@@ -2929,6 +2997,13 @@ window.__ModuleLoader__.load({
|
|
|
2929
2997
|
if (!editorEqual(entity.generator, original.generator)) operations.push({ op: 'entity.generator.set', entityId: draft.entityId, generator: editorClone(entity.generator) })
|
|
2930
2998
|
if (draft.uvProjection != null) operations.push({ op: 'entity.uv.project', entityId: draft.entityId, ...editorClone(draft.uvProjection) })
|
|
2931
2999
|
if (!editorEqual(entity.modifiers, original.modifiers)) operations.push({ op: 'entity.modifiers.set', entityId: draft.entityId, modifiers: editorClone(entity.modifiers) })
|
|
3000
|
+
const { halfLap, originalHalfLap } = draft
|
|
3001
|
+
if (halfLap?.lowerEntityId !== originalHalfLap?.lowerEntityId || halfLap?.upperEntityId !== originalHalfLap?.upperEntityId) {
|
|
3002
|
+
if (originalHalfLap && editorHalfLapPartner(originalHalfLap, draft.entityId) !== editorHalfLapPartner(halfLap, draft.entityId)) {
|
|
3003
|
+
operations.push({ op: 'joint.halfLap.set', ...originalHalfLap, enabled: false })
|
|
3004
|
+
}
|
|
3005
|
+
if (halfLap) operations.push({ op: 'joint.halfLap.set', ...halfLap })
|
|
3006
|
+
}
|
|
2932
3007
|
const material = draft.material.definition, baseMaterial = editorMaterialOriginal(draft)
|
|
2933
3008
|
const changedProperties = material && baseMaterial ? ['baseColor', 'roughness'].filter(key => !editorEqual(material.parameters?.[key], baseMaterial.parameters?.[key])) : []
|
|
2934
3009
|
const textureChanged = material && baseMaterial && !editorEqual(material.texture, baseMaterial.texture)
|
|
@@ -2964,6 +3039,29 @@ window.__ModuleLoader__.load({
|
|
|
2964
3039
|
return state.editorDrafts?.[editorKey(state.activeProjectId, state.editorEntityId)] || null
|
|
2965
3040
|
}
|
|
2966
3041
|
|
|
3042
|
+
function halfLapPreviewIntent(state, draft = editorDraftFor(state), patch) {
|
|
3043
|
+
const scene = state.selected?.scene
|
|
3044
|
+
if (!state.halfLapPreviewSupported || state.view !== 'scene' || !draft?.halfLap || !scene || draft.baseRevision !== scene.revision
|
|
3045
|
+
|| !/^[a-f0-9]{64}$/.test(scene.digest ?? '') || !/^[a-f0-9]{64}$/.test(state.storeIdentity ?? '')) return null
|
|
3046
|
+
try { patch ??= buildEditorPatch(draft) } catch { return null }
|
|
3047
|
+
const change = patch.operations.find(operation => operation.op === 'joint.halfLap.set' && operation.enabled !== false)
|
|
3048
|
+
if (!change) return null
|
|
3049
|
+
const key = JSON.stringify([state.storeIdentity, scene.digest, draft.entityId, patch])
|
|
3050
|
+
return { key, patch, expectedDigest: scene.digest, expectedStoreIdentity: state.storeIdentity, joint: draft.halfLap }
|
|
3051
|
+
}
|
|
3052
|
+
|
|
3053
|
+
function verifiedHalfLapPreview(preview, intent) {
|
|
3054
|
+
const isImage = image => image?.width === 480 && image.height === 320 && /^[a-f0-9]{64}$/.test(image.sha256 ?? '')
|
|
3055
|
+
&& typeof image.pngBase64 === 'string' && image.pngBase64.length <= 699052 && /^iVBORw0KGgo[A-Za-z0-9+/]+=*$/.test(image.pngBase64)
|
|
3056
|
+
return preview?.schemaVersion === 'deepblend.half-lap-inspection/v1' && preview.projectId === intent.patch.projectId
|
|
3057
|
+
&& preview.baseRevision === intent.patch.baseRevision && preview.baseDigest === intent.expectedDigest
|
|
3058
|
+
&& preview.storeIdentity === intent.expectedStoreIdentity && /^[a-f0-9]{64}$/.test(preview.candidateSpecHash ?? '')
|
|
3059
|
+
&& preview.joint?.lowerEntityId === intent.joint.lowerEntityId && preview.joint?.upperEntityId === intent.joint.upperEntityId
|
|
3060
|
+
&& Number.isSafeInteger(preview.crossings) && preview.crossings > 0 && Number.isSafeInteger(preview.partialCrossings)
|
|
3061
|
+
&& preview.partialCrossings >= 0 && preview.partialCrossings <= preview.crossings
|
|
3062
|
+
&& preview.sample === (preview.partialCrossings ? 'partial' : 'full') && isImage(preview.lower) && isImage(preview.upper)
|
|
3063
|
+
}
|
|
3064
|
+
|
|
2967
3065
|
function createPhotographyDraft(scene, projectId, previous = {}, projectsRoot = null) {
|
|
2968
3066
|
const cameras = (scene.nodes.cameras || []).map(item => editorClone(item.definition)).filter(Boolean)
|
|
2969
3067
|
const lights = (scene.nodes.lights || []).map(item => editorClone(item.definition)).filter(Boolean)
|
|
@@ -3766,6 +3864,8 @@ window.__ModuleLoader__.load({
|
|
|
3766
3864
|
photographyReuse: {},
|
|
3767
3865
|
editorEntityId: null,
|
|
3768
3866
|
editorDrafts: {},
|
|
3867
|
+
halfLapPreviewSupported: false,
|
|
3868
|
+
halfLapPreview: null,
|
|
3769
3869
|
geometryMeasurements: {},
|
|
3770
3870
|
editorLastEdits: {},
|
|
3771
3871
|
editorComparison: null,
|
|
@@ -3854,6 +3954,7 @@ window.__ModuleLoader__.load({
|
|
|
3854
3954
|
const cameraFitControllers = new Map()
|
|
3855
3955
|
const cameraFitStorage = settings.cameraFitStorage ?? preferenceStorage
|
|
3856
3956
|
const motionControllers = new Map()
|
|
3957
|
+
let halfLapPreviewController
|
|
3857
3958
|
let imageProbeController = null
|
|
3858
3959
|
const motionStorage = settings.motionStorage ?? preferenceStorage
|
|
3859
3960
|
const motionWork = (key, changes) => set({ motionWork: { ...data.motionWork, [key]: { ...data.motionWork[key], ...changes } } })
|
|
@@ -3937,7 +4038,13 @@ window.__ModuleLoader__.load({
|
|
|
3937
4038
|
if (['projectsRoot', 'storeIdentity', 'activeProjectId'].some(key => Object.hasOwn(patch, key) && patch[key] !== data[key])) retireSnapshotContext()
|
|
3938
4039
|
if (['projectsRoot', 'storeIdentity', 'activeProjectId', 'currentRevision'].some(key => Object.hasOwn(patch, key) && patch[key] !== data[key])
|
|
3939
4040
|
|| Object.hasOwn(patch, 'view') && patch.view !== 'preview') patch = { ...patch, lighttableSelection: null }
|
|
3940
|
-
|
|
4041
|
+
const next = { ...data, ...patch }
|
|
4042
|
+
if (next.halfLapPreview && halfLapPreviewIntent(next)?.key !== next.halfLapPreview.key) {
|
|
4043
|
+
halfLapPreviewController?.abort()
|
|
4044
|
+
halfLapPreviewController = undefined
|
|
4045
|
+
next.halfLapPreview = null
|
|
4046
|
+
}
|
|
4047
|
+
data = next; notify()
|
|
3941
4048
|
}
|
|
3942
4049
|
/** Change one nested table. @param {'forms'|'busy'|'notices'} table @param {string} key @param {any} value */
|
|
3943
4050
|
const setIn = (table, key, value) => { data = { ...data, [table]: { ...data[table], [key]: value } }; notify() }
|
|
@@ -4030,6 +4137,7 @@ window.__ModuleLoader__.load({
|
|
|
4030
4137
|
deliveryAspectPresetSupported: payload.deliveryAspectPresetSupported === true,
|
|
4031
4138
|
stillImageDeliverySupported: payload.stillImageDeliverySupported === true,
|
|
4032
4139
|
motionPreviewSupported: payload.motionPreviewSupported === true,
|
|
4140
|
+
halfLapPreviewSupported: payload.halfLapPreviewSupported === true,
|
|
4033
4141
|
imageInputProbeSupported: payload.imageInputProbeSupported === true,
|
|
4034
4142
|
selectedReviewViewsSupported: payload.selectedReviewViewsSupported === true,
|
|
4035
4143
|
creationRequestProtocol: payload.creationRequestProtocol ?? null,
|
|
@@ -5387,6 +5495,45 @@ window.__ModuleLoader__.load({
|
|
|
5387
5495
|
const draft = createEditorDraft(scene, current.projectId, current.entityId)
|
|
5388
5496
|
set({ editorDrafts: { ...data.editorDrafts, [editorKey(current.projectId, current.entityId)]: draft }, notices: { ...data.notices, scene: null } })
|
|
5389
5497
|
},
|
|
5498
|
+
setEditorHalfLap: (partner, role) => {
|
|
5499
|
+
const current = editorDraftFor(data)
|
|
5500
|
+
if (!current || data.busy.editor || current.baseRevision !== data.selected?.scene?.revision) return
|
|
5501
|
+
if (partner && !editorHalfLapPartners(current).some(entity => entity.id === partner)) return
|
|
5502
|
+
const { entityId } = current
|
|
5503
|
+
const halfLap = !partner ? null : role === 'upper'
|
|
5504
|
+
? { lowerEntityId: partner, upperEntityId: entityId }
|
|
5505
|
+
: { lowerEntityId: entityId, upperEntityId: partner }
|
|
5506
|
+
set({ editorDrafts: { ...data.editorDrafts, [editorKey(current.projectId, entityId)]: { ...current, halfLap } } })
|
|
5507
|
+
},
|
|
5508
|
+
cancelHalfLapPreview: () => {
|
|
5509
|
+
halfLapPreviewController?.abort()
|
|
5510
|
+
halfLapPreviewController = undefined
|
|
5511
|
+
set({ halfLapPreview: null })
|
|
5512
|
+
},
|
|
5513
|
+
previewHalfLap: async () => {
|
|
5514
|
+
const intent = halfLapPreviewIntent(data)
|
|
5515
|
+
if (!intent || data.busy.editor || halfLapPreviewController) return
|
|
5516
|
+
const controller = new AbortController()
|
|
5517
|
+
halfLapPreviewController = controller
|
|
5518
|
+
const { key, patch, expectedDigest, expectedStoreIdentity } = intent
|
|
5519
|
+
const active = () => running && halfLapPreviewController === controller && !controller.signal.aborted
|
|
5520
|
+
set({ halfLapPreview: { key, busy: true } })
|
|
5521
|
+
try {
|
|
5522
|
+
const response = await fetchImpl(projectRoute(patch.projectId, '/half-lap-preview'), {
|
|
5523
|
+
method: 'POST', headers: { 'content-type': 'application/json', accept: 'application/json' }, signal: controller.signal,
|
|
5524
|
+
body: JSON.stringify({ patch, expectedDigest, expectedStoreIdentity }),
|
|
5525
|
+
})
|
|
5526
|
+
const payload = await response.json()
|
|
5527
|
+
if (!active()) return
|
|
5528
|
+
if (!response.ok || !payload.ok) throw new Error(payload.error?.message || response.status)
|
|
5529
|
+
if (!verifiedHalfLapPreview(payload.preview, intent)) throw new Error(t('inspection.mismatch'))
|
|
5530
|
+
set({ halfLapPreview: { key, result: payload.preview } })
|
|
5531
|
+
} catch (error) {
|
|
5532
|
+
if (active()) set({ halfLapPreview: { key, error: error.message || String(error) } })
|
|
5533
|
+
} finally {
|
|
5534
|
+
if (halfLapPreviewController === controller) halfLapPreviewController = undefined
|
|
5535
|
+
}
|
|
5536
|
+
},
|
|
5390
5537
|
updateEditor: (section, path, value) => {
|
|
5391
5538
|
const current = editorDraftFor(data)
|
|
5392
5539
|
if (!current || data.busy.editor || !['transform', 'generator', 'modifiers', 'material', 'uvProjection'].includes(section)) return
|
|
@@ -5450,10 +5597,13 @@ window.__ModuleLoader__.load({
|
|
|
5450
5597
|
try { patch = buildEditorPatch(draft) } catch (error) {
|
|
5451
5598
|
setIn('notices', 'scene', { ok: false, message: error.message }); return
|
|
5452
5599
|
}
|
|
5453
|
-
if (!patch.operations.length) return
|
|
5600
|
+
if (!patch.operations.length || data.halfLapPreview?.busy) return
|
|
5601
|
+
const inspection = data.halfLapPreview?.result
|
|
5602
|
+
const inspected = inspection && halfLapPreviewIntent(data, draft, patch)?.key === data.halfLapPreview.key
|
|
5603
|
+
const request = inspected ? { patch, expectedSpecHash: inspection.candidateSpecHash, expectedStoreIdentity: inspection.storeIdentity } : { patch }
|
|
5454
5604
|
const beforePreviews = editorClone(data.previews?.revisions?.find(item => item.revision === draft.baseRevision)?.previews || [])
|
|
5455
5605
|
setIn('busy', 'editor', true)
|
|
5456
|
-
const outcome = await postJson(fetchImpl, projectRoute(draft.projectId, '/patch'),
|
|
5606
|
+
const outcome = await postJson(fetchImpl, projectRoute(draft.projectId, '/patch'), request)
|
|
5457
5607
|
setIn('busy', 'editor', false)
|
|
5458
5608
|
if (outcome.ok) {
|
|
5459
5609
|
const revision = outcome.payload.revision.revision
|
|
@@ -5810,6 +5960,8 @@ window.__ModuleLoader__.load({
|
|
|
5810
5960
|
for (const controller of photographyControllers.values()) controller.abort()
|
|
5811
5961
|
for (const controller of motionControllers.values()) controller.abort()
|
|
5812
5962
|
motionControllers.clear()
|
|
5963
|
+
halfLapPreviewController?.abort()
|
|
5964
|
+
halfLapPreviewController = undefined
|
|
5813
5965
|
photographyControllers.clear()
|
|
5814
5966
|
for (const controller of placementControllers.values()) controller.abort()
|
|
5815
5967
|
placementControllers.clear()
|
|
@@ -6281,6 +6433,16 @@ window.__ModuleLoader__.load({
|
|
|
6281
6433
|
const vector = (title, prefix, value, update, factor = 1000, locks = []) => el('div', null, el('strong', null, title),
|
|
6282
6434
|
EDITOR_AXES.map((axis, index) => numeric(axis.toUpperCase(), `${prefix}-${axis}`, value?.[index], next => update(index, next), { factor, disabled: locks[index] })))
|
|
6283
6435
|
const geometry = draft.entity.generator
|
|
6436
|
+
const halfLapPartners = editorHalfLapPartners(draft)
|
|
6437
|
+
const halfLapPartner = editorHalfLapPartner(draft.halfLap, draft.entityId)
|
|
6438
|
+
const halfLapRole = draft.halfLap?.upperEntityId === draft.entityId ? 'upper' : 'lower'
|
|
6439
|
+
const halfLapOptions = halfLapPartners.map(entity => [entity.id, entity.id])
|
|
6440
|
+
if (halfLapPartner && !halfLapPartners.some(entity => entity.id === halfLapPartner)) halfLapOptions.push([halfLapPartner, halfLapPartner])
|
|
6441
|
+
const slotIntent = halfLapPreviewIntent(state, draft)
|
|
6442
|
+
const slotWork = slotIntent && state.halfLapPreview?.key === slotIntent.key ? state.halfLapPreview : null
|
|
6443
|
+
const slotResult = slotWork?.result
|
|
6444
|
+
const apply = Button({ action: 'editor-apply', tone: 'primary',
|
|
6445
|
+
disabled: disabled || !dirty || errors.length > 0 || slotWork?.busy === true, onClick: actions.applyEditor, children: t('editor.apply') })
|
|
6284
6446
|
const geometryField = key => {
|
|
6285
6447
|
const bounds = generatorIntegerBounds(geometry, key)
|
|
6286
6448
|
if (key === 'rootTension') return numeric(labels[key], `editor-generator-${key}`, geometry[key],
|
|
@@ -6366,7 +6528,15 @@ window.__ModuleLoader__.load({
|
|
|
6366
6528
|
invalid: draft.uvProjection.scale < 0.0001 || draft.uvProjection.scale > 10000,
|
|
6367
6529
|
error: t('editor.uv.scaleInvalid') }),
|
|
6368
6530
|
el('p', { className: 'db-muted', key: 'uv-scale-help' }, t('editor.uv.scaleHelp')),
|
|
6369
|
-
] : null)
|
|
6531
|
+
] : null),
|
|
6532
|
+
halfLapOptions.length ? el('fieldset', { key: 'half-lap', 'data-half-lap-editor': true, disabled, style: { border: 0, padding: 0, margin: '16px 0' } },
|
|
6533
|
+
el('legend', null, t('editor.halfLap.title')),
|
|
6534
|
+
el('p', { className: 'db-muted' }, t('editor.halfLap.help')),
|
|
6535
|
+
choose(t('editor.halfLap.partner'), 'editor-half-lap-partner', halfLapPartner,
|
|
6536
|
+
[['', t('editor.halfLap.none')], ...halfLapOptions], partner => actions.setEditorHalfLap(partner, halfLapRole)),
|
|
6537
|
+
halfLapPartner ? choose(t('editor.halfLap.role'), 'editor-half-lap-role', halfLapRole,
|
|
6538
|
+
[['lower', t('editor.halfLap.lower')], ['upper', t('editor.halfLap.upper')]], role => actions.setEditorHalfLap(halfLapPartner, role)) : null,
|
|
6539
|
+
slotIntent ? HalfLapPreview({ slotWork, apply, disabled, actions }) : null) : null] : null,
|
|
6370
6540
|
el('p', { className: 'db-muted', key: 'local-size' }, t('editor.localDimensions', { scale: (draft.entity.transform.scale || [1, 1, 1]).join(' × ') })),
|
|
6371
6541
|
geometry.shape === 'rounded_box' ? el('p', { className: 'db-muted', key: 'rounded' }, t('editor.roundedRequired')) : null,
|
|
6372
6542
|
geometry.shape === 'handled_cup' ? el('p', { className: 'db-muted', key: 'cup-help' }, t('editor.cupHelp')) : null,
|
|
@@ -6476,13 +6646,37 @@ window.__ModuleLoader__.load({
|
|
|
6476
6646
|
el('div', { className: 'db-inline' }, Object.entries(modifierNames).map(([type, name]) => Button({ action: `editor-modifier-add-${type}`, disabled: disabled || !canModify || draft.entity.modifiers.length >= 8,
|
|
6477
6647
|
children: t('editor.add', { name }), onClick: () => actions.editEditorList('modifiers', 0, 'add', type) })))) : null,
|
|
6478
6648
|
errors.length ? el('div', { className: 'db-error', 'data-editor-errors': true }, errors.join(' ')) : null,
|
|
6479
|
-
el('div', { className: 'db-inline db-editor-actions' },
|
|
6649
|
+
el('div', { className: 'db-inline db-editor-actions' }, slotResult ? null : apply,
|
|
6480
6650
|
Button({ action: 'editor-reset', disabled: state.busy.editor, onClick: actions.resetEditor, children: t('editor.reset') }),
|
|
6481
6651
|
Button({ action: 'editor-review-subject', disabled: disabled || draft.entity.visible === false || draft.entity.kind === 'empty'
|
|
6482
6652
|
|| state.briefWork[state.activeProjectId]?.saving || state.visualRuns[state.activeProjectId]?.busy,
|
|
6483
6653
|
onClick: () => actions.setReviewSubject(draft.entityId), children: t('brief.subjectShortcut') }), restore))
|
|
6484
6654
|
}
|
|
6485
6655
|
|
|
6656
|
+
function HalfLapPreview({ slotWork, apply, disabled, actions }) {
|
|
6657
|
+
const result = slotWork?.result
|
|
6658
|
+
const picture = (role, caption, label) => el('figure', { style: { margin: '12px 0' } },
|
|
6659
|
+
el('figcaption', { className: 'db-muted', style: { overflowWrap: 'anywhere' } }, caption),
|
|
6660
|
+
el('img', { src: `data:image/png;base64,${result[role].pngBase64}`, alt: label, width: 480, height: 320,
|
|
6661
|
+
'data-half-lap-slot': role, style: { display: 'block', width: '100%', height: 'auto', marginTop: '4px' } }))
|
|
6662
|
+
return el('div', { 'data-half-lap-inspection': result ? 'ready' : slotWork?.busy ? 'loading' : slotWork?.error ? 'error' : 'idle',
|
|
6663
|
+
'aria-busy': slotWork?.busy === true, style: { marginTop: '12px' } },
|
|
6664
|
+
result ? [
|
|
6665
|
+
el('p', { key: 'draft', className: 'db-muted', role: 'status' }, result.sample === 'partial' ? t('editor.halfLap.partial') : t('editor.halfLap.full')),
|
|
6666
|
+
el('p', { key: 'count', className: 'db-muted' }, t('editor.halfLap.count', { count: result.crossings, partial: result.partialCrossings })),
|
|
6667
|
+
el('div', { key: 'faces' },
|
|
6668
|
+
picture('lower', t('editor.halfLap.lowerPart', { name: result.joint.lowerEntityId }), t('editor.halfLap.lowerFace')),
|
|
6669
|
+
picture('upper', t('editor.halfLap.upperPart', { name: result.joint.upperEntityId }), t('editor.halfLap.upperFace'))),
|
|
6670
|
+
apply,
|
|
6671
|
+
] : [
|
|
6672
|
+
el('div', { key: 'actions', className: 'db-inline' },
|
|
6673
|
+
Button({ action: 'half-lap-preview', disabled: disabled || slotWork?.busy === true,
|
|
6674
|
+
children: slotWork?.busy ? t('editor.halfLap.inspecting') : t('editor.halfLap.inspect'), onClick: actions.previewHalfLap }),
|
|
6675
|
+
slotWork?.busy ? Button({ action: 'half-lap-preview-cancel', children: t('geometry.cancel'), onClick: actions.cancelHalfLapPreview }) : null),
|
|
6676
|
+
slotWork?.error ? el('p', { key: 'error', className: 'db-error', role: 'alert' }, t('editor.halfLap.inspectError', { message: slotWork.error })) : null,
|
|
6677
|
+
])
|
|
6678
|
+
}
|
|
6679
|
+
|
|
6486
6680
|
/** 场景树: the Scene Tree of the revision in view. */
|
|
6487
6681
|
function AssetsView({ state, actions }) {
|
|
6488
6682
|
const projectId = state.activeProjectId, library = state.assetLibraries?.[projectId], work = state.assetWork?.[projectId] || {}
|
|
@@ -7281,7 +7475,7 @@ window.__ModuleLoader__.load({
|
|
|
7281
7475
|
Object.entries(state.diff.collections)
|
|
7282
7476
|
.filter(([, entry]) => entry.added.length + entry.removed.length + entry.changed.length > 0)
|
|
7283
7477
|
.map(([kind, entry]) => el('div', { key: kind },
|
|
7284
|
-
el('strong', null, kind),
|
|
7478
|
+
el('strong', null, kind === 'halfLaps' ? t('editor.halfLap.title') : kind),
|
|
7285
7479
|
entry.added.length > 0 ? el('div', { className: 'db-muted db-mono' }, `+ ${entry.added.join(', ')}`) : null,
|
|
7286
7480
|
entry.removed.length > 0 ? el('div', { className: 'db-muted db-mono' }, `- ${entry.removed.join(', ')}`) : null,
|
|
7287
7481
|
entry.changed.map(change => el('div', { key: change.id, className: 'db-muted db-mono' },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepblend/dsh-blender-bundle",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.0",
|
|
4
4
|
"description": "Create Blender product scenes in DSH with editable recipes, model imports, previews and PNG/MP4 delivery; includes workbench and agent configuration.",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"bin": {
|
|
@@ -44,12 +44,12 @@
|
|
|
44
44
|
}
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@deepblend/dsh-blender-contracts": "0.
|
|
48
|
-
"@deepblend/dsh-blender-host": "0.
|
|
49
|
-
"@deepblend/dsh-blender-preset": "0.
|
|
50
|
-
"@deepblend/dsh-blender-provider-local": "0.
|
|
51
|
-
"@deepblend/dsh-blender-tool": "0.
|
|
52
|
-
"@deepblend/dsh-blender-ui": "0.
|
|
47
|
+
"@deepblend/dsh-blender-contracts": "0.25.0",
|
|
48
|
+
"@deepblend/dsh-blender-host": "0.25.0",
|
|
49
|
+
"@deepblend/dsh-blender-preset": "0.25.0",
|
|
50
|
+
"@deepblend/dsh-blender-provider-local": "0.25.0",
|
|
51
|
+
"@deepblend/dsh-blender-tool": "0.25.0",
|
|
52
|
+
"@deepblend/dsh-blender-ui": "0.25.0"
|
|
53
53
|
},
|
|
54
54
|
"type": "module",
|
|
55
55
|
"license": "MIT",
|