@fmsim/machine 2.0.0-beta.3 → 2.0.0-beta.6
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/dist/carrier.js +2 -2
- package/dist/carrier.js.map +1 -1
- package/dist/factories/agv-3d.js +33 -6
- package/dist/factories/agv-3d.js.map +1 -1
- package/dist/factories/machine-3d.js +395 -56
- package/dist/factories/machine-3d.js.map +1 -1
- package/dist/factories/oht-3d.js +34 -8
- package/dist/factories/oht-3d.js.map +1 -1
- package/dist/factories/shuttle-3d.js +32 -6
- package/dist/factories/shuttle-3d.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +3 -3
- package/src/carrier.ts +2 -2
- package/src/factories/agv-3d.ts +32 -6
- package/src/factories/machine-3d.ts +446 -40
- package/src/factories/oht-3d.ts +32 -8
- package/src/factories/shuttle-3d.ts +30 -6
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@fmsim/machine",
|
|
3
3
|
"description": "Layout View를 구성하는 설비(machine)들과 유닛을 구현한 모듈입니다.",
|
|
4
4
|
"author": "heartyoh",
|
|
5
|
-
"version": "2.0.0-beta.
|
|
5
|
+
"version": "2.0.0-beta.6",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"module": "dist/index.js",
|
|
8
8
|
"things-scene": true,
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"migration": "things-factory-migration"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@fmsim/api": "^2.0.0-beta.
|
|
28
|
+
"@fmsim/api": "^2.0.0-beta.6",
|
|
29
29
|
"@hatiolab/things-scene": "^10.0.0-beta.1"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
@@ -54,5 +54,5 @@
|
|
|
54
54
|
"prettier --write"
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
|
-
"gitHead": "
|
|
57
|
+
"gitHead": "879225fef10fca7f9084e4c27d23744337eaa06b"
|
|
58
58
|
}
|
package/src/carrier.ts
CHANGED
|
@@ -134,11 +134,11 @@ export default class Carrier extends MCSStatusMixin(ParentObjectMixin(Shape)) {
|
|
|
134
134
|
// 문자열 형태의 설정들을 미리 파싱
|
|
135
135
|
const parsedTheme = {}
|
|
136
136
|
for (const [status, config] of Object.entries(theme)) {
|
|
137
|
-
if (typeof config === 'string') {
|
|
137
|
+
if (typeof config === 'string' && config.trim()) {
|
|
138
138
|
try {
|
|
139
139
|
parsedTheme[status] = JSON5.parse(config)
|
|
140
140
|
} catch (e) {
|
|
141
|
-
console.error('JSON5 parse error:', e)
|
|
141
|
+
console.error('JSON5 parse error:', e, 'input:', JSON.stringify(config), 'status:', status, 'theme:', carrierAnimationName)
|
|
142
142
|
parsedTheme[status] = config
|
|
143
143
|
}
|
|
144
144
|
} else {
|
package/src/factories/agv-3d.ts
CHANGED
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
|
|
16
16
|
import * as THREE from 'three'
|
|
17
17
|
import { RoundedBoxGeometry } from 'three/examples/jsm/geometries/RoundedBoxGeometry.js'
|
|
18
|
-
import { RealObjectGroup, registerRealObjectFactory } from '@hatiolab/things-scene'
|
|
18
|
+
import { RealObjectGroup, registerRealObjectFactory, disposeObject3D } from '@hatiolab/things-scene'
|
|
19
19
|
import type { Component } from '@hatiolab/things-scene'
|
|
20
20
|
import { TRANSPORT_SURFACE_HEIGHT } from './machine-3d.js'
|
|
21
21
|
|
|
@@ -24,6 +24,7 @@ const PLATFORM_COLOR = 0x333333
|
|
|
24
24
|
const DEFAULT_BODY_COLOR = 0x6688cc
|
|
25
25
|
|
|
26
26
|
export class AGV3D extends RealObjectGroup {
|
|
27
|
+
private _ownMeshes: THREE.Mesh[] = []
|
|
27
28
|
get effectiveDepth(): number {
|
|
28
29
|
const { depth } = this.component.state
|
|
29
30
|
return depth || TRANSPORT_SURFACE_HEIGHT
|
|
@@ -88,7 +89,6 @@ export class AGV3D extends RealObjectGroup {
|
|
|
88
89
|
bumper.position.y = bumperH / 2
|
|
89
90
|
bumper.castShadow = true
|
|
90
91
|
bumper.receiveShadow = true
|
|
91
|
-
this.object3d.add(bumper)
|
|
92
92
|
|
|
93
93
|
// ── 본체 (둥근 모서리, statusColor 적용) ──
|
|
94
94
|
const bodyColor = this.resolveColor()
|
|
@@ -102,7 +102,6 @@ export class AGV3D extends RealObjectGroup {
|
|
|
102
102
|
body.position.y = bumperH + bodyH / 2
|
|
103
103
|
body.castShadow = true
|
|
104
104
|
body.receiveShadow = true
|
|
105
|
-
this.object3d.add(body)
|
|
106
105
|
|
|
107
106
|
// ── 상단 플랫폼 (본체보다 안쪽, 어두운색) ──
|
|
108
107
|
const platInset = Math.min(w, h) * 0.04
|
|
@@ -117,14 +116,41 @@ export class AGV3D extends RealObjectGroup {
|
|
|
117
116
|
plat.position.y = bumperH + bodyH + gapH + platH / 2
|
|
118
117
|
plat.castShadow = true
|
|
119
118
|
plat.receiveShadow = true
|
|
120
|
-
|
|
119
|
+
|
|
120
|
+
this._ownMeshes = [bumper, body, plat]
|
|
121
|
+
for (const m of this._ownMeshes) this.object3d.add(m)
|
|
121
122
|
}
|
|
122
123
|
|
|
123
124
|
updateDimension() {}
|
|
124
|
-
|
|
125
|
+
|
|
126
|
+
update() {
|
|
127
|
+
// 자신의 mesh만 제거 (Carrier 등 자식 컴포넌트 3D 보존)
|
|
128
|
+
for (const m of this._ownMeshes) {
|
|
129
|
+
this.object3d.remove(m)
|
|
130
|
+
disposeObject3D(m)
|
|
131
|
+
}
|
|
132
|
+
this._ownMeshes = []
|
|
133
|
+
|
|
134
|
+
this.build()
|
|
135
|
+
this.updateTransform()
|
|
136
|
+
this.updateAlpha()
|
|
137
|
+
this.updateHidden()
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
updateAlpha() {
|
|
141
|
+
const { alpha = 1 } = this.component.state
|
|
142
|
+
for (const m of this._ownMeshes) {
|
|
143
|
+
const materials = Array.isArray(m.material) ? m.material : [m.material]
|
|
144
|
+
for (const mat of materials) {
|
|
145
|
+
;(mat as THREE.MeshStandardMaterial).opacity = alpha
|
|
146
|
+
;(mat as THREE.MeshStandardMaterial).transparent = alpha < 1
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
125
150
|
|
|
126
151
|
onchange(after: Record<string, unknown>, before: Record<string, unknown>) {
|
|
127
|
-
if ('width' in after || 'height' in after || 'depth' in after ||
|
|
152
|
+
if ('width' in after || 'height' in after || 'depth' in after ||
|
|
153
|
+
'fillStyle' in after || 'strokeStyle' in after || 'id' in after) {
|
|
128
154
|
this.update()
|
|
129
155
|
return
|
|
130
156
|
}
|