@vyr/remote 0.0.33 → 0.0.34
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/package.json +1 -1
- package/src/ChangeScriptable.ts +14 -7
- package/src/RemoteExecutor.ts +121 -243
- package/src/RemoteInvoker.ts +5 -1
- package/src/RemoteProcess.ts +8 -9
- package/src/job/Job.ts +0 -2
- package/src/job/asset/update.ts +1 -2
- package/src/job/invoke/event.ts +1 -15
- package/src/job/invoke/highlight.ts +30 -0
- package/src/job/invoke/index.ts +2 -0
- package/src/job/invoke/screenshot.ts +2 -0
- package/src/job/invoke/smart.ts +35 -0
- package/src/utils/index.ts +6 -16
- package/src/utils/screenshot.ts +1 -1
- package/src/job/scene/add.ts +0 -22
- package/src/job/scene/dragdrap.ts +0 -23
- package/src/job/scene/index.ts +0 -6
- package/src/job/scene/load.ts +0 -19
- package/src/job/scene/remove.ts +0 -19
- package/src/job/scene/unload.ts +0 -17
- package/src/job/scene/update.ts +0 -20
package/package.json
CHANGED
package/src/ChangeScriptable.ts
CHANGED
|
@@ -1,22 +1,29 @@
|
|
|
1
|
-
import
|
|
1
|
+
import z from "zod";
|
|
2
|
+
import { Descriptor, Graphics, Scriptable } from "@vyr/engine";
|
|
2
3
|
import { RemoteProcess } from "./RemoteProcess";
|
|
3
4
|
import { Job } from "./job";
|
|
4
5
|
|
|
5
|
-
class ChangeScriptable extends Scriptable
|
|
6
|
+
class ChangeScriptable extends Scriptable {
|
|
7
|
+
static id = RemoteProcess.transformEvent
|
|
8
|
+
static name = ''
|
|
9
|
+
static inputSchame = z.object({
|
|
10
|
+
type: z.enum(['mousedown', 'mouseup', 'contextmenu', 'change']),
|
|
11
|
+
target: z.string(),
|
|
12
|
+
})
|
|
6
13
|
|
|
7
|
-
execute(graphics: Graphics,
|
|
14
|
+
execute(graphics: Graphics, trigger: string, input: z.infer<ChangeScriptable['inputSchame']>) {
|
|
8
15
|
const process = RemoteProcess.get(graphics.engine)
|
|
9
16
|
if (process === null) return
|
|
10
17
|
|
|
11
|
-
if (
|
|
18
|
+
if (input.type === 'contextmenu') {
|
|
12
19
|
process.bridge.send(new Job.invoke.pick.Response({ descriptor: '' }))
|
|
13
20
|
} else {
|
|
14
|
-
const target = Descriptor.get(
|
|
21
|
+
const target = Descriptor.get(input.target) as Descriptor
|
|
15
22
|
if (target === null) return
|
|
16
|
-
const params = { eventType:
|
|
23
|
+
const params = { eventType: input.type, target: input.target, descriptor: target.clone(false) }
|
|
17
24
|
process.bridge.send(new Job.invoke.transform.Response(params))
|
|
18
25
|
}
|
|
19
26
|
}
|
|
20
27
|
}
|
|
21
28
|
|
|
22
|
-
export
|
|
29
|
+
export { ChangeScriptable }
|
package/src/RemoteExecutor.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AnimationUnitInterpreter, Asset, Compilation, Descriptor, DeserializationObject,
|
|
2
|
-
import { cleanPickupObject,
|
|
1
|
+
import { AnimationUnitInterpreter, Asset, Compilation, Descriptor, DeserializationObject, Graphics, HTMLActor, HTMLService, HTMLTransformController, observer, Service, Scene, Unit, isService, traceService, isHTML } from '@vyr/engine'
|
|
2
|
+
import { cleanPickupObject, pickupObject, getAnimationUnitByAsset, screenshot } from './utils'
|
|
3
3
|
import { Collection } from './Collection'
|
|
4
4
|
import { RemoteProcess } from './RemoteProcess'
|
|
5
5
|
import { Job } from './job'
|
|
@@ -13,135 +13,6 @@ class RemoteExecutor {
|
|
|
13
13
|
this.process = process
|
|
14
14
|
}
|
|
15
15
|
|
|
16
|
-
async loadByScene(task: InstanceType<typeof Job['scene']['load']['Task']>) {
|
|
17
|
-
let loadTask = Asset.getTask(task.params.url)
|
|
18
|
-
if (loadTask === null) {
|
|
19
|
-
const nextTask = Asset.getTask(this.process.scene)
|
|
20
|
-
nextTask?.cancel()
|
|
21
|
-
|
|
22
|
-
this.process.scene = task.params.url
|
|
23
|
-
await Asset.loadAll(task.params.url)
|
|
24
|
-
await Asset.compileDataset(task.params.url, this.process.engine)
|
|
25
|
-
|
|
26
|
-
//渲染新场景
|
|
27
|
-
const scheduler = Asset.get<ServiceSchedulerDescriptor>(task.params.url)
|
|
28
|
-
if (this.process.config.invoke) {
|
|
29
|
-
scheduler.traverse(sub => {
|
|
30
|
-
if (sub instanceof ServiceDescriptor) this.onAddService(sub)
|
|
31
|
-
})
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
this.sendAnimationUnitToRemote(0, getAnimationUnit(scheduler))
|
|
35
|
-
|
|
36
|
-
this.process.scheduler = scheduler
|
|
37
|
-
this.process.engine.switch(scheduler)
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
async unloadByScene(task: InstanceType<typeof Job['scene']['unload']['Task']>) {
|
|
41
|
-
const scheduler = Asset.get<ServiceSchedulerDescriptor>(this.process.scene)
|
|
42
|
-
if (scheduler !== null) {
|
|
43
|
-
scheduler.traverse(child => {
|
|
44
|
-
if (child instanceof ServiceDescriptor) this.onRemoveService(child)
|
|
45
|
-
})
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
const nextTask = Asset.getTask(this.process.scene)
|
|
49
|
-
nextTask?.cancel()
|
|
50
|
-
this.process.scene = ''
|
|
51
|
-
this.process.scheduler = new ServiceSchedulerDescriptor()
|
|
52
|
-
this.process.engine.switch(this.process.scheduler)
|
|
53
|
-
}
|
|
54
|
-
async addByScene(task: InstanceType<typeof Job['scene']['add']['Task']>) {
|
|
55
|
-
const target = Descriptor.get<Descriptor>(task.params.parent)
|
|
56
|
-
if (target === null) return
|
|
57
|
-
|
|
58
|
-
const subs: Descriptor[] = []
|
|
59
|
-
const tasks: Promise<void>[] = []
|
|
60
|
-
for (const node of task.params.node) {
|
|
61
|
-
const sub = Descriptor.create(node)
|
|
62
|
-
subs.push(sub)
|
|
63
|
-
|
|
64
|
-
const ports = Asset.graph.build(sub)
|
|
65
|
-
const dep = Asset.graph.getDependencidesByPorts(ports)
|
|
66
|
-
for (const url of dep.all) {
|
|
67
|
-
if (Asset.get(url) === null) tasks.push(Asset.loadAll(url, false))
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
if (this.process.config.invoke) {
|
|
71
|
-
sub.traverse(child => {
|
|
72
|
-
if (child instanceof ServiceDescriptor) this.onAddService(child)
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
await Promise.all(tasks)
|
|
78
|
-
|
|
79
|
-
if (task.params.next) {
|
|
80
|
-
for (const sub of subs) target.insertBefore(sub.uuid, task.params.next)
|
|
81
|
-
} else {
|
|
82
|
-
for (const sub of subs) target.add(sub)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
await Asset.loadAll(this.process.scene)
|
|
86
|
-
await Asset.compileDataset(this.process.scene, this.process.engine)
|
|
87
|
-
this.sendAnimationUnitToRemote(0, getAnimationUnit(this.process.scheduler))
|
|
88
|
-
}
|
|
89
|
-
async removeyScene(task: InstanceType<typeof Job['scene']['remove']['Task']>) {
|
|
90
|
-
for (const uuid of task.params.uuids) {
|
|
91
|
-
const target = Descriptor.get<Descriptor>(uuid)
|
|
92
|
-
if (target === null) continue
|
|
93
|
-
|
|
94
|
-
this.resetTransformByRemoveJob(target)
|
|
95
|
-
|
|
96
|
-
const acestor = target.traceAncestor()
|
|
97
|
-
if (acestor.parent) acestor.parent.remove(target)
|
|
98
|
-
|
|
99
|
-
if (this.process.config.invoke) {
|
|
100
|
-
target.traverse(child => {
|
|
101
|
-
if (child instanceof ServiceDescriptor) this.onRemoveService(child)
|
|
102
|
-
})
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
await Asset.loadAll(this.process.scene)
|
|
107
|
-
this.sendAnimationUnitToRemote(0, getAnimationUnit(this.process.scheduler))
|
|
108
|
-
}
|
|
109
|
-
async dragdrapyScene(task: InstanceType<typeof Job['scene']['dragdrap']['Task']>) {
|
|
110
|
-
const root = Asset.get<Descriptor>(this.process.scene)
|
|
111
|
-
if (root) {
|
|
112
|
-
|
|
113
|
-
const method = task.params.next ? 'insertBefore' : task.params.type
|
|
114
|
-
const target = task.params.next || task.params.targetData.data.uuid
|
|
115
|
-
|
|
116
|
-
for (const uuid of task.params.dragData.data.uuids) {
|
|
117
|
-
root[method](uuid, target)
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
async updateyScene(task: InstanceType<typeof Job['scene']['update']['Task']>) {
|
|
122
|
-
const target = Descriptor.get<Descriptor>(task.params.content.uuid)
|
|
123
|
-
if (target === null) return
|
|
124
|
-
|
|
125
|
-
const temp = target.clone(false)
|
|
126
|
-
temp.syncWith(task.params.content)
|
|
127
|
-
const ports = Asset.graph.build(temp)
|
|
128
|
-
const dep = Asset.graph.getDependencidesByPorts(ports)
|
|
129
|
-
const tasks: Promise<void>[] = []
|
|
130
|
-
for (const url of dep.all) {
|
|
131
|
-
if (Asset.get(url) === null) tasks.push(Asset.loadAll(url, false))
|
|
132
|
-
}
|
|
133
|
-
await Promise.all(tasks)
|
|
134
|
-
|
|
135
|
-
this.updateOtherUpdateJob(target, task.params.content)
|
|
136
|
-
target.syncWith(task.params.content)
|
|
137
|
-
await Asset.loadAll(this.process.scene)
|
|
138
|
-
await Asset.compileDataset(this.process.scene, this.process.engine)
|
|
139
|
-
|
|
140
|
-
this.sendAnimationUnitToRemote(0, getAnimationUnit(this.process.scheduler))
|
|
141
|
-
|
|
142
|
-
target.setNeedsUpdate()
|
|
143
|
-
}
|
|
144
|
-
|
|
145
16
|
async loadByAsset(task: InstanceType<typeof Job['asset']['load']['Task']>) {
|
|
146
17
|
let loadTask = Asset.getTask(task.params.url)
|
|
147
18
|
if (loadTask === null) {
|
|
@@ -150,47 +21,45 @@ class RemoteExecutor {
|
|
|
150
21
|
|
|
151
22
|
this.process.asset = task.params.url
|
|
152
23
|
await Asset.loadAll(task.params.url)
|
|
153
|
-
await Asset.compileDataset(task.params.url, this.process.engine)
|
|
154
24
|
|
|
155
|
-
|
|
25
|
+
let scene: Scene
|
|
156
26
|
const descriptor = Asset.get<Descriptor>(task.params.url)
|
|
157
|
-
if (descriptor instanceof
|
|
158
|
-
|
|
159
|
-
service.add(descriptor)
|
|
160
|
-
scheduler.add(service)
|
|
27
|
+
if (descriptor instanceof Scene) {
|
|
28
|
+
scene = descriptor
|
|
161
29
|
} else {
|
|
162
|
-
|
|
30
|
+
scene = new Scene()
|
|
31
|
+
this.onLoadAsset(task.params.url, descriptor, scene)
|
|
163
32
|
}
|
|
164
|
-
scheduler.traverse(sub => {
|
|
165
|
-
if (sub instanceof ServiceDescriptor) this.onAddService(sub)
|
|
166
|
-
})
|
|
167
33
|
|
|
168
|
-
|
|
34
|
+
if (this.process.config.invoke) {
|
|
35
|
+
scene.traverse(sub => {
|
|
36
|
+
if (isService(sub)) this.onAddService(sub)
|
|
37
|
+
})
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
Asset.set(this._defaultScheduleUrl, scene)
|
|
169
41
|
Asset.graph.create(task.params.url)
|
|
170
42
|
|
|
171
43
|
this.sendAnimationUnitToRemote(0, getAnimationUnitByAsset(task.params.url))
|
|
172
44
|
|
|
173
|
-
this.process.
|
|
174
|
-
this.process.engine.switch(
|
|
45
|
+
this.process.scene = scene
|
|
46
|
+
this.process.engine.switch(scene)
|
|
175
47
|
}
|
|
176
48
|
}
|
|
177
49
|
async unloadByAsset(task: InstanceType<typeof Job['asset']['unload']['Task']>) {
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
if (child instanceof ServiceDescriptor) this.onRemoveService(child)
|
|
184
|
-
})
|
|
185
|
-
}
|
|
50
|
+
const scene = Asset.get<Scene>(this.process.asset)
|
|
51
|
+
if (scene !== null && this.process.config.invoke) {
|
|
52
|
+
scene.traverse(child => {
|
|
53
|
+
if (isService(child)) this.onRemoveService(child)
|
|
54
|
+
})
|
|
186
55
|
}
|
|
187
56
|
|
|
188
57
|
const nextTask = Asset.getTask(this.process.asset)
|
|
189
58
|
nextTask?.cancel()
|
|
190
59
|
this.process.asset = ''
|
|
191
60
|
|
|
192
|
-
this.process.
|
|
193
|
-
this.process.engine.switch(this.process.
|
|
61
|
+
this.process.scene = new Scene()
|
|
62
|
+
this.process.engine.switch(this.process.scene)
|
|
194
63
|
}
|
|
195
64
|
async addByAsset(task: InstanceType<typeof Job['asset']['add']['Task']>) {
|
|
196
65
|
const parent = Descriptor.get<Descriptor>(task.params.parent)
|
|
@@ -209,9 +78,11 @@ class RemoteExecutor {
|
|
|
209
78
|
if (Asset.get(url) === null) tasks.push(Asset.loadAll(url, false))
|
|
210
79
|
}
|
|
211
80
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
81
|
+
if (this.process.config.invoke) {
|
|
82
|
+
sub.traverse(child => {
|
|
83
|
+
if (isService(child)) this.onAddService(child)
|
|
84
|
+
})
|
|
85
|
+
}
|
|
215
86
|
}
|
|
216
87
|
await Promise.all(tasks)
|
|
217
88
|
|
|
@@ -223,7 +94,6 @@ class RemoteExecutor {
|
|
|
223
94
|
|
|
224
95
|
await Asset.loadAll(task.params.url)
|
|
225
96
|
Asset.graph.update(this._defaultScheduleUrl)
|
|
226
|
-
await Asset.compileDataset(task.params.url, this.process.engine)
|
|
227
97
|
|
|
228
98
|
this.sendAnimationUnitToRemote(0, getAnimationUnitByAsset(task.params.url))
|
|
229
99
|
}
|
|
@@ -239,7 +109,7 @@ class RemoteExecutor {
|
|
|
239
109
|
|
|
240
110
|
if (this.process.config.invoke) {
|
|
241
111
|
target.traverse(child => {
|
|
242
|
-
if (child
|
|
112
|
+
if (isService(child)) this.onRemoveService(child)
|
|
243
113
|
})
|
|
244
114
|
}
|
|
245
115
|
}
|
|
@@ -260,11 +130,11 @@ class RemoteExecutor {
|
|
|
260
130
|
}
|
|
261
131
|
}
|
|
262
132
|
async updateyAsset(task: InstanceType<typeof Job['asset']['update']['Task']>) {
|
|
263
|
-
const target = Descriptor.get<Descriptor>(task.params.
|
|
133
|
+
const target = Descriptor.get<Descriptor>(task.params.node.uuid)
|
|
264
134
|
if (target === null) return
|
|
265
135
|
|
|
266
136
|
const temp = target.clone(false)
|
|
267
|
-
temp.syncWith(task.params.
|
|
137
|
+
temp.syncWith(task.params.node)
|
|
268
138
|
const ports = Asset.graph.build(temp)
|
|
269
139
|
const dep = Asset.graph.getDependencidesByPorts(ports)
|
|
270
140
|
const tasks: Promise<void>[] = []
|
|
@@ -273,11 +143,10 @@ class RemoteExecutor {
|
|
|
273
143
|
}
|
|
274
144
|
await Promise.all(tasks)
|
|
275
145
|
|
|
276
|
-
this.updateOtherUpdateJob(target, task.params.
|
|
277
|
-
target.syncWith(task.params.
|
|
146
|
+
this.updateOtherUpdateJob(target, task.params.node)
|
|
147
|
+
target.syncWith(task.params.node)
|
|
278
148
|
await Asset.loadAll(task.params.url)
|
|
279
149
|
Asset.graph.update(this._defaultScheduleUrl)
|
|
280
|
-
await Asset.compileDataset(this.process.scene, this.process.engine)
|
|
281
150
|
|
|
282
151
|
this.sendAnimationUnitToRemote(0, getAnimationUnitByAsset(task.params.url))
|
|
283
152
|
|
|
@@ -287,73 +156,115 @@ class RemoteExecutor {
|
|
|
287
156
|
clearHTMLTransform() {
|
|
288
157
|
const htmlTransforms = this.htmlTransformCollection.values()
|
|
289
158
|
for (const item of htmlTransforms) {
|
|
290
|
-
item.target = ''
|
|
291
159
|
item.mode = ''
|
|
160
|
+
item.target = ''
|
|
161
|
+
item.highlight = ''
|
|
292
162
|
item.enabled = false
|
|
293
163
|
item.setNeedsUpdate()
|
|
294
164
|
}
|
|
295
165
|
}
|
|
296
|
-
async transformByInvoke(task: InstanceType<typeof Job['invoke']['transform']['Task']>, service:
|
|
166
|
+
async transformByInvoke(task: InstanceType<typeof Job['invoke']['transform']['Task']>, service: Service | null = null) {
|
|
297
167
|
this.clearHTMLTransform()
|
|
298
168
|
|
|
299
169
|
const target = Descriptor.get<Descriptor>(task.params.target)
|
|
300
170
|
if (service === null) {
|
|
301
|
-
service =
|
|
171
|
+
service = traceService(target)
|
|
302
172
|
} else {
|
|
303
|
-
const isHTMLServiceDescriptor = service instanceof
|
|
173
|
+
const isHTMLServiceDescriptor = service instanceof HTMLService
|
|
304
174
|
if (isHTMLServiceDescriptor === false) return
|
|
305
175
|
}
|
|
306
176
|
if (service === null) return
|
|
307
177
|
|
|
308
178
|
const enabled = ['translate', 'rotate', 'scale'].includes(task.params.mode)
|
|
309
|
-
const htmlTransform = this.htmlTransformCollection.get<
|
|
179
|
+
const htmlTransform = this.htmlTransformCollection.get<HTMLTransformController>(service)
|
|
310
180
|
|
|
311
|
-
if (htmlTransform !== null && enabled === true && target
|
|
181
|
+
if (htmlTransform !== null && enabled === true && isHTML(target)) {
|
|
312
182
|
htmlTransform.target = task.params.target
|
|
313
183
|
htmlTransform.mode = task.params.mode
|
|
314
184
|
htmlTransform.enabled = true
|
|
315
185
|
}
|
|
316
186
|
}
|
|
187
|
+
async highlightByInvoke(task: InstanceType<typeof Job['invoke']['highlight']['Task']>, service: Service | null = null) {
|
|
188
|
+
this.clearHTMLTransform()
|
|
189
|
+
|
|
190
|
+
const target = Descriptor.get<Descriptor>(task.params.target)
|
|
191
|
+
if (service === null) {
|
|
192
|
+
service = traceService(target)
|
|
193
|
+
} else {
|
|
194
|
+
const isHTMLServiceDescriptor = service instanceof HTMLService
|
|
195
|
+
if (isHTMLServiceDescriptor === false) return
|
|
196
|
+
}
|
|
197
|
+
if (service === null) return
|
|
198
|
+
|
|
199
|
+
const htmlTransform = this.htmlTransformCollection.get<HTMLTransformController>(service)
|
|
200
|
+
if (htmlTransform === null) return
|
|
201
|
+
|
|
202
|
+
htmlTransform.highlight = target.uuid
|
|
203
|
+
htmlTransform.setNeedsUpdate()
|
|
204
|
+
}
|
|
317
205
|
async orbitByInvoke(task: InstanceType<typeof Job['invoke']['orbit']['Task']>) { }
|
|
318
206
|
async propertiesByInvoke(task: InstanceType<typeof Job['invoke']['properties']['Task']>) { }
|
|
319
207
|
async animationByInvoke(task: InstanceType<typeof Job['invoke']['animation']['Task']>) {
|
|
320
208
|
if (task.reset) AnimationUnitInterpreter.reset(task.params.currentTime)
|
|
321
209
|
AnimationUnitInterpreter.enabled = task.params.enabled
|
|
322
210
|
}
|
|
323
|
-
async
|
|
324
|
-
const base64 = await screenshot(document.body)
|
|
211
|
+
async screenshotByInvoke(task: InstanceType<typeof Job['invoke']['screenshot']['Task']>) {
|
|
212
|
+
const base64 = await screenshot(document.body, task.params)
|
|
325
213
|
const msg = new Job.invoke.screenshot.Response({ target: task.params.target, base64 })
|
|
326
214
|
this.process.bridge.send(msg)
|
|
327
215
|
}
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
216
|
+
async smartByInvoke(task: InstanceType<typeof Job['invoke']['smart']['Task']>) {
|
|
217
|
+
const msg = new Job.invoke.smart.Response({
|
|
218
|
+
dragdrap: task.params.dragdrap,
|
|
219
|
+
target: ''
|
|
220
|
+
})
|
|
221
|
+
const x = task.params.mouse.x
|
|
222
|
+
const y = task.params.mouse.y
|
|
223
|
+
const element = document.elementFromPoint(x, y)
|
|
224
|
+
|
|
225
|
+
if (element) {
|
|
226
|
+
const uuid = element.getAttribute(HTMLActor.uuidKey)
|
|
227
|
+
if (uuid) {
|
|
228
|
+
const scene = Descriptor.get(uuid)
|
|
229
|
+
if (scene instanceof Scene) {
|
|
230
|
+
msg.params.target = uuid
|
|
231
|
+
} else {
|
|
232
|
+
const graphics = this.process.engine.getGraphics(this.process.scene)
|
|
233
|
+
const result = graphics.pickup(x, y, element)
|
|
234
|
+
if (result.length > 0) {
|
|
235
|
+
const select = result[0]
|
|
236
|
+
msg.params.target = select.uuid
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
}
|
|
334
240
|
}
|
|
241
|
+
|
|
242
|
+
this.process.bridge.send(msg)
|
|
335
243
|
}
|
|
336
|
-
|
|
337
|
-
|
|
244
|
+
|
|
245
|
+
onLoadAsset(url: string, descriptor: Descriptor, scene: Scene) { }
|
|
246
|
+
|
|
247
|
+
onAddService(service: Service) {
|
|
248
|
+
if (service instanceof HTMLService) {
|
|
338
249
|
let htmlTransform = this.htmlTransformCollection.get(service)
|
|
339
250
|
if (htmlTransform === null) {
|
|
340
|
-
htmlTransform = new
|
|
251
|
+
htmlTransform = new HTMLTransformController({ enabled: false, selectable: false })
|
|
341
252
|
this.htmlTransformCollection.set(service, htmlTransform)
|
|
342
253
|
htmlTransform.event = RemoteProcess.transformEvent
|
|
343
254
|
}
|
|
344
|
-
service.add(htmlTransform as
|
|
255
|
+
service.add(htmlTransform as HTMLTransformController)
|
|
345
256
|
}
|
|
346
257
|
}
|
|
347
|
-
onRemoveService(service:
|
|
348
|
-
if (service instanceof
|
|
349
|
-
const htmlTransform = this.htmlTransformCollection.get<
|
|
258
|
+
onRemoveService(service: Service) {
|
|
259
|
+
if (service instanceof HTMLService) {
|
|
260
|
+
const htmlTransform = this.htmlTransformCollection.get<HTMLTransformController>(service)
|
|
350
261
|
if (htmlTransform !== null) {
|
|
351
262
|
this.htmlTransformCollection.delete(service)
|
|
352
263
|
service.remove(htmlTransform)
|
|
353
264
|
}
|
|
354
265
|
}
|
|
355
266
|
}
|
|
356
|
-
|
|
267
|
+
onUpdateScene(unit: Unit) {
|
|
357
268
|
const htmlTransform = Descriptor.get<Descriptor>(unit.uuid)
|
|
358
269
|
const service = this.htmlTransformCollection.getByMap(htmlTransform)
|
|
359
270
|
if (service !== null) {
|
|
@@ -362,11 +273,11 @@ class RemoteExecutor {
|
|
|
362
273
|
}
|
|
363
274
|
}
|
|
364
275
|
|
|
365
|
-
resetTransformByRemoveJob(target: Descriptor, service:
|
|
366
|
-
if (service === null) service =
|
|
276
|
+
resetTransformByRemoveJob(target: Descriptor, service: Service | null = null) {
|
|
277
|
+
if (service === null) service = traceService(target)
|
|
367
278
|
|
|
368
|
-
if (service instanceof
|
|
369
|
-
const htmlTransform = this.htmlTransformCollection.get<
|
|
279
|
+
if (service instanceof HTMLService) {
|
|
280
|
+
const htmlTransform = this.htmlTransformCollection.get<HTMLTransformController>(service)
|
|
370
281
|
if (htmlTransform === null) return
|
|
371
282
|
|
|
372
283
|
if (htmlTransform.target === target.uuid) {
|
|
@@ -376,17 +287,12 @@ class RemoteExecutor {
|
|
|
376
287
|
}
|
|
377
288
|
}
|
|
378
289
|
}
|
|
379
|
-
|
|
380
|
-
if (target.inherit === deserialization.inherit) return
|
|
381
|
-
observer.trigger('updateDeps', { self: target.uuid })
|
|
382
|
-
}
|
|
383
|
-
updateOtherUpdateJob(target: Descriptor, deserialization: DeserializationObject<Descriptor>, service: ServiceDescriptor | null = null) {
|
|
384
|
-
if (target instanceof StyleDescriptor) this._updateStyle(target, deserialization as any)
|
|
290
|
+
updateOtherUpdateJob(target: Descriptor, deserialization: DeserializationObject<Descriptor>, service: Service | null = null) {
|
|
385
291
|
if (service === null) {
|
|
386
|
-
service =
|
|
292
|
+
service = traceService(target)
|
|
387
293
|
}
|
|
388
294
|
if (service === null) return
|
|
389
|
-
const htmlTransform = this.htmlTransformCollection.get<
|
|
295
|
+
const htmlTransform = this.htmlTransformCollection.get<HTMLTransformController>(service)
|
|
390
296
|
if (htmlTransform === null) return
|
|
391
297
|
if (htmlTransform.target === target.uuid) {
|
|
392
298
|
this.process.engine.listen('afterRender', () => htmlTransform.setNeedsUpdate(), { once: true })
|
|
@@ -411,7 +317,7 @@ class RemoteExecutor {
|
|
|
411
317
|
if (this.__VYR_REMOTE_WRAPPER === true) {
|
|
412
318
|
//@ts-ignore
|
|
413
319
|
window['__VYR_RUNTIME.DISABLED_INPUT'] = true
|
|
414
|
-
executor.
|
|
320
|
+
executor.onUpdateScene(unit)
|
|
415
321
|
doUpdate.call(this, unit)
|
|
416
322
|
} else {
|
|
417
323
|
doUpdate.call(this, unit)
|
|
@@ -427,41 +333,22 @@ class RemoteExecutor {
|
|
|
427
333
|
e.stopPropagation()
|
|
428
334
|
}
|
|
429
335
|
}
|
|
430
|
-
protected onEvent(event:
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
type:
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
clientX: event.clientX,
|
|
443
|
-
clientY: event.clientY,
|
|
444
|
-
}
|
|
445
|
-
})
|
|
446
|
-
} else {
|
|
447
|
-
task = new Job.invoke.event.Response({
|
|
448
|
-
type: 'keyboard',
|
|
449
|
-
properties: {
|
|
450
|
-
type: event.type,
|
|
451
|
-
altKey: event.altKey,
|
|
452
|
-
ctrlKey: event.ctrlKey,
|
|
453
|
-
shiftKey: event.shiftKey,
|
|
454
|
-
code: event.code,
|
|
455
|
-
}
|
|
456
|
-
})
|
|
457
|
-
if (event.code === 'Tab') event.preventDefault()
|
|
458
|
-
}
|
|
336
|
+
protected onEvent(event: KeyboardEvent) {
|
|
337
|
+
const task = new Job.invoke.event.Response({
|
|
338
|
+
type: 'keyboard',
|
|
339
|
+
properties: {
|
|
340
|
+
type: event.type,
|
|
341
|
+
altKey: event.altKey,
|
|
342
|
+
ctrlKey: event.ctrlKey,
|
|
343
|
+
shiftKey: event.shiftKey,
|
|
344
|
+
code: event.code,
|
|
345
|
+
}
|
|
346
|
+
})
|
|
347
|
+
if (event.code === 'Tab') event.preventDefault()
|
|
459
348
|
this.process.bridge.send(task)
|
|
460
349
|
}
|
|
461
350
|
protected onMessage(args: any) {
|
|
462
|
-
|
|
463
|
-
//动态节点发生了循环引用,动态节点 arsg.uuid
|
|
464
|
-
}
|
|
351
|
+
|
|
465
352
|
}
|
|
466
353
|
|
|
467
354
|
sendAnimationUnitToRemote(delta: number, max?: number) {
|
|
@@ -478,32 +365,23 @@ class RemoteExecutor {
|
|
|
478
365
|
this.process.bridge.listen(Job.asset.remove.Method, this.removeyAsset.bind(this))
|
|
479
366
|
this.process.bridge.listen(Job.asset.dragdrap.Method, this.dragdrapyAsset.bind(this))
|
|
480
367
|
this.process.bridge.listen(Job.asset.update.Method, this.updateyAsset.bind(this))
|
|
481
|
-
|
|
482
|
-
this.process.bridge.listen(Job.scene.load.Method, this.loadByScene.bind(this))
|
|
483
|
-
this.process.bridge.listen(Job.scene.unload.Method, this.unloadByScene.bind(this))
|
|
484
|
-
this.process.bridge.listen(Job.scene.add.Method, this.addByScene.bind(this))
|
|
485
|
-
this.process.bridge.listen(Job.scene.remove.Method, this.removeyScene.bind(this))
|
|
486
|
-
this.process.bridge.listen(Job.scene.dragdrap.Method, this.dragdrapyScene.bind(this))
|
|
487
|
-
this.process.bridge.listen(Job.scene.update.Method, this.updateyScene.bind(this))
|
|
488
368
|
}
|
|
489
369
|
|
|
490
370
|
if (this.process.config.invoke) {
|
|
491
|
-
createControllerStyle()
|
|
492
371
|
pickupObject(this.process)
|
|
493
372
|
cleanPickupObject(this.process)
|
|
494
373
|
this.enhance(this.process)
|
|
495
374
|
|
|
496
375
|
this.process.bridge.listen(Job.invoke.transform.Method, this.transformByInvoke.bind(this))
|
|
376
|
+
this.process.bridge.listen(Job.invoke.highlight.Method, this.highlightByInvoke.bind(this))
|
|
497
377
|
this.process.bridge.listen(Job.invoke.orbit.Method, this.orbitByInvoke.bind(this))
|
|
498
378
|
this.process.bridge.listen(Job.invoke.properties.Method, this.propertiesByInvoke.bind(this))
|
|
499
379
|
this.process.bridge.listen(Job.invoke.animation.Method, this.animationByInvoke.bind(this))
|
|
500
|
-
this.process.bridge.listen(Job.invoke.screenshot.Method, this.
|
|
380
|
+
this.process.bridge.listen(Job.invoke.screenshot.Method, this.screenshotByInvoke.bind(this))
|
|
381
|
+
this.process.bridge.listen(Job.invoke.smart.Method, this.smartByInvoke.bind(this))
|
|
501
382
|
|
|
502
383
|
window.addEventListener('keydown', this.onEvent.bind(this))
|
|
503
384
|
window.addEventListener('keyup', this.onEvent.bind(this))
|
|
504
|
-
window.addEventListener('mousedown', this.onEvent.bind(this))
|
|
505
|
-
window.addEventListener('click', this.onEvent.bind(this))
|
|
506
|
-
window.addEventListener('mouseup', this.onEvent.bind(this))
|
|
507
385
|
|
|
508
386
|
//@ts-ignore
|
|
509
387
|
window['__VYR_RUNTIME.DISABLED_INPUT'] = true
|
package/src/RemoteInvoker.ts
CHANGED
|
@@ -42,7 +42,7 @@ class RemoteInvoker {
|
|
|
42
42
|
return config.env === 'window' ? this.createWindow(location) : this.createIframe(location)
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
-
|
|
45
|
+
readonly sanbox
|
|
46
46
|
readonly id
|
|
47
47
|
readonly bridge
|
|
48
48
|
|
|
@@ -54,6 +54,10 @@ class RemoteInvoker {
|
|
|
54
54
|
this.bridge = new Bridge({ id: config.id, useRemote: this.sanbox.useRemote })
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
+
setState(enable: boolean) {
|
|
58
|
+
this.sanbox.DOM.style.pointerEvents = enable ? 'all' : 'none'
|
|
59
|
+
}
|
|
60
|
+
|
|
57
61
|
mount(id: string) {
|
|
58
62
|
if (this.sanbox === null) return
|
|
59
63
|
const container = document.getElementById(id)
|
package/src/RemoteProcess.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Descriptor, Engine, Generate, Scene, Scriptable, isService } from '@vyr/engine'
|
|
2
2
|
import { Bridge, RemoteConfig } from './Bridge'
|
|
3
3
|
import { RemoteExecutor } from './RemoteExecutor'
|
|
4
4
|
import { Job } from './job'
|
|
@@ -20,7 +20,7 @@ class RemoteProcess {
|
|
|
20
20
|
}
|
|
21
21
|
static getServices(descriptor: Descriptor, services: Descriptor[] = []) {
|
|
22
22
|
descriptor.traverse(sub => {
|
|
23
|
-
if (sub
|
|
23
|
+
if (isService(sub)) services.push(sub)
|
|
24
24
|
})
|
|
25
25
|
return services
|
|
26
26
|
}
|
|
@@ -29,9 +29,8 @@ class RemoteProcess {
|
|
|
29
29
|
readonly config
|
|
30
30
|
readonly element
|
|
31
31
|
readonly engine
|
|
32
|
-
scene = ''
|
|
33
32
|
asset = ''
|
|
34
|
-
|
|
33
|
+
scene: Scene
|
|
35
34
|
bridge!: Bridge
|
|
36
35
|
|
|
37
36
|
constructor(element: string | HTMLElement, engine = new Engine()) {
|
|
@@ -39,7 +38,7 @@ class RemoteProcess {
|
|
|
39
38
|
this.element = element
|
|
40
39
|
this.engine = engine
|
|
41
40
|
this.config = this._initConfig()
|
|
42
|
-
this.
|
|
41
|
+
this.scene = new Scene()
|
|
43
42
|
}
|
|
44
43
|
|
|
45
44
|
private _initConfig() {
|
|
@@ -54,6 +53,9 @@ class RemoteProcess {
|
|
|
54
53
|
}
|
|
55
54
|
|
|
56
55
|
async listen() {
|
|
56
|
+
const { ChangeScriptable } = await import('./ChangeScriptable')
|
|
57
|
+
Scriptable.register(ChangeScriptable)
|
|
58
|
+
|
|
57
59
|
for (const setup of privateState.setupCollection) setup(this)
|
|
58
60
|
|
|
59
61
|
this.bridge = new Bridge({ id: this.config.id })
|
|
@@ -68,7 +70,7 @@ class RemoteProcess {
|
|
|
68
70
|
|
|
69
71
|
this.engine.run(this.element)
|
|
70
72
|
|
|
71
|
-
if (this.config.scene) executor.
|
|
73
|
+
if (this.config.scene) executor.loadByAsset(new Job.asset.load.Task({ url: this.config.scene }))
|
|
72
74
|
}
|
|
73
75
|
|
|
74
76
|
setExecutor(executor: RemoteExecutor) {
|
|
@@ -79,9 +81,6 @@ class RemoteProcess {
|
|
|
79
81
|
}
|
|
80
82
|
}
|
|
81
83
|
|
|
82
|
-
Asset.setProvider(RemoteProcess.transformEvent, () => import('./ChangeScriptable'))
|
|
83
|
-
Asset.load(RemoteProcess.transformEvent)
|
|
84
|
-
|
|
85
84
|
export {
|
|
86
85
|
RemoteProcess
|
|
87
86
|
}
|
package/src/job/Job.ts
CHANGED
|
@@ -2,13 +2,11 @@ import { IJob } from './IJob'
|
|
|
2
2
|
import * as bridge from './bridge'
|
|
3
3
|
import * as invoke from './invoke'
|
|
4
4
|
import * as asset from './asset'
|
|
5
|
-
import * as scene from './scene'
|
|
6
5
|
|
|
7
6
|
class Job extends IJob {
|
|
8
7
|
static readonly bridge = bridge
|
|
9
8
|
static readonly invoke = invoke
|
|
10
9
|
static readonly asset = asset
|
|
11
|
-
static readonly scene = scene
|
|
12
10
|
readonly method: string = 'remote.default'
|
|
13
11
|
readonly params = {}
|
|
14
12
|
}
|
package/src/job/asset/update.ts
CHANGED
package/src/job/invoke/event.ts
CHANGED
|
@@ -2,20 +2,6 @@ import { IJob } from "../IJob";
|
|
|
2
2
|
|
|
3
3
|
const Method = 'remote.invoke.event'
|
|
4
4
|
|
|
5
|
-
interface MouseParams {
|
|
6
|
-
type: 'mouse',
|
|
7
|
-
properties: {
|
|
8
|
-
type: string
|
|
9
|
-
bubbles: boolean
|
|
10
|
-
cancelable: boolean
|
|
11
|
-
altKey: boolean
|
|
12
|
-
ctrlKey: boolean
|
|
13
|
-
shiftKey: boolean
|
|
14
|
-
clientX: number
|
|
15
|
-
clientY: number
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
5
|
interface KeyboardParams {
|
|
20
6
|
type: 'keyboard',
|
|
21
7
|
properties: {
|
|
@@ -31,7 +17,7 @@ class Response extends IJob {
|
|
|
31
17
|
readonly method = Method
|
|
32
18
|
readonly params
|
|
33
19
|
|
|
34
|
-
constructor(params:
|
|
20
|
+
constructor(params: KeyboardParams) {
|
|
35
21
|
super()
|
|
36
22
|
this.params = params
|
|
37
23
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { IJob } from "../IJob";
|
|
2
|
+
|
|
3
|
+
interface Params {
|
|
4
|
+
enabled: boolean,
|
|
5
|
+
target: string
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const Method = 'remote.invoke.highlight'
|
|
9
|
+
|
|
10
|
+
class Task extends IJob {
|
|
11
|
+
readonly method = Method
|
|
12
|
+
readonly params
|
|
13
|
+
|
|
14
|
+
constructor(params: Params) {
|
|
15
|
+
super()
|
|
16
|
+
this.params = params
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
class Response extends IJob {
|
|
21
|
+
readonly method = Method
|
|
22
|
+
readonly params: Params
|
|
23
|
+
|
|
24
|
+
constructor(params: Params) {
|
|
25
|
+
super()
|
|
26
|
+
this.params = params
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { Method, Task, Response }
|
package/src/job/invoke/index.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
export * as properties from './properties'
|
|
2
2
|
export * as animation from './animation'
|
|
3
3
|
export * as transform from './transform'
|
|
4
|
+
export * as highlight from './highlight'
|
|
4
5
|
export * as orbit from './orbit'
|
|
5
6
|
export * as pick from './pick'
|
|
6
7
|
export * as screenshot from './screenshot'
|
|
8
|
+
export * as smart from './smart'
|
|
7
9
|
export * as event from './event'
|
|
8
10
|
export * as alert from './alert'
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { IJob } from "../IJob";
|
|
2
|
+
|
|
3
|
+
interface Params {
|
|
4
|
+
dragdrap: { id: string; data: any }
|
|
5
|
+
mouse: { x: number; y: number }
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const Method = 'remote.invoke.smart'
|
|
9
|
+
|
|
10
|
+
class Task extends IJob {
|
|
11
|
+
readonly method = Method
|
|
12
|
+
readonly params
|
|
13
|
+
|
|
14
|
+
constructor(params: Params) {
|
|
15
|
+
super()
|
|
16
|
+
this.params = params
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
interface ResponseParams {
|
|
21
|
+
dragdrap: { id: string; data: any }
|
|
22
|
+
target: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
class Response extends IJob {
|
|
26
|
+
readonly method = Method
|
|
27
|
+
readonly params: ResponseParams
|
|
28
|
+
|
|
29
|
+
constructor(params: ResponseParams) {
|
|
30
|
+
super()
|
|
31
|
+
this.params = params
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export { Method, Task, Response }
|
package/src/utils/index.ts
CHANGED
|
@@ -1,25 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AnimationUnit, Asset, Descriptor } from "@vyr/engine"
|
|
2
2
|
import { RemoteProcess } from "../RemoteProcess"
|
|
3
3
|
import { Job } from "../job"
|
|
4
4
|
|
|
5
|
-
const createControllerStyle = () => {
|
|
6
|
-
const style = document.createElement('style')
|
|
7
|
-
const css = [
|
|
8
|
-
'.vyr-html-wrapper{pointer-events: all !important;}',
|
|
9
|
-
'.vyr-html-wrapper > * {pointer-events: none !important}',
|
|
10
|
-
]
|
|
11
|
-
style.innerText = css.join('\n')
|
|
12
|
-
document.head.append(style)
|
|
13
|
-
}
|
|
14
|
-
|
|
15
5
|
const pickupObject = (process: RemoteProcess) => {
|
|
16
6
|
const executor = (event: MouseEvent) => {
|
|
17
|
-
|
|
18
|
-
const
|
|
7
|
+
if ((event.target instanceof Element) === false) return
|
|
8
|
+
const graphics = process.engine.getGraphics(process.scene)
|
|
9
|
+
const result = graphics.pickup(event.clientX, event.clientY, event.target)
|
|
19
10
|
if (result.length === 0) return
|
|
20
11
|
|
|
21
12
|
const select = result[0]
|
|
22
|
-
process.bridge.send(new Job.invoke.pick.Response({ descriptor: select.
|
|
13
|
+
process.bridge.send(new Job.invoke.pick.Response({ descriptor: select.uuid }))
|
|
23
14
|
}
|
|
24
15
|
|
|
25
16
|
let count = 0
|
|
@@ -58,7 +49,7 @@ const cleanPickupObject = (process: RemoteProcess) => {
|
|
|
58
49
|
const getAnimationUnit = (descriptor: Descriptor) => {
|
|
59
50
|
let max = 0
|
|
60
51
|
descriptor.traverse((sub) => {
|
|
61
|
-
if (sub instanceof
|
|
52
|
+
if (sub instanceof AnimationUnit) {
|
|
62
53
|
const uptime = sub.startTime + sub.duration
|
|
63
54
|
if (uptime > max) max = uptime
|
|
64
55
|
}
|
|
@@ -76,7 +67,6 @@ const getAnimationUnitByAsset = (url: string) => {
|
|
|
76
67
|
}
|
|
77
68
|
|
|
78
69
|
export {
|
|
79
|
-
createControllerStyle,
|
|
80
70
|
pickupObject,
|
|
81
71
|
cleanPickupObject,
|
|
82
72
|
getAnimationUnit,
|
package/src/utils/screenshot.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
let HTMLToImage: any = null
|
|
2
|
-
const screenshot = async (html: HTMLElement, backgroundColor = '#ffffff') => {
|
|
2
|
+
const screenshot = async (html: HTMLElement, size: { width: number; height: number }, backgroundColor = '#ffffff') => {
|
|
3
3
|
if (HTMLToImage === null) {
|
|
4
4
|
//@ts-ignore
|
|
5
5
|
HTMLToImage = await import('dom-to-image')
|
package/src/job/scene/add.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { Descriptor, DeserializationObject } from "@vyr/engine";
|
|
2
|
-
import { IJob } from "../IJob";
|
|
3
|
-
|
|
4
|
-
interface Params {
|
|
5
|
-
parent: string
|
|
6
|
-
node: DeserializationObject<Descriptor>[]
|
|
7
|
-
next: string
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const Method = 'remote.scene.add'
|
|
11
|
-
|
|
12
|
-
class Task extends IJob {
|
|
13
|
-
readonly method = Method
|
|
14
|
-
readonly params
|
|
15
|
-
|
|
16
|
-
constructor(params: Params) {
|
|
17
|
-
super()
|
|
18
|
-
this.params = params
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
export { Method, Task }
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { DraggableData, DraggableEndType } from "@vyr/declare";
|
|
2
|
-
import { IJob } from "../IJob";
|
|
3
|
-
|
|
4
|
-
interface Params {
|
|
5
|
-
type: DraggableEndType,
|
|
6
|
-
dragData: DraggableData<{ uuids: string[] }>,
|
|
7
|
-
targetData: DraggableData<{ uuid: string }>,
|
|
8
|
-
next?: string
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
const Method = 'remote.scene.dragdrap'
|
|
12
|
-
|
|
13
|
-
class Task extends IJob {
|
|
14
|
-
readonly method = Method
|
|
15
|
-
readonly params
|
|
16
|
-
|
|
17
|
-
constructor(params: Params) {
|
|
18
|
-
super()
|
|
19
|
-
this.params = params
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export { Method, Task }
|
package/src/job/scene/index.ts
DELETED
package/src/job/scene/load.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { IJob } from "../IJob";
|
|
2
|
-
|
|
3
|
-
interface Params {
|
|
4
|
-
url: string
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const Method = 'remote.scene.load'
|
|
8
|
-
|
|
9
|
-
class Task extends IJob {
|
|
10
|
-
readonly method = Method
|
|
11
|
-
readonly params
|
|
12
|
-
|
|
13
|
-
constructor(params: Params) {
|
|
14
|
-
super()
|
|
15
|
-
this.params = params
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { Method, Task}
|
package/src/job/scene/remove.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { IJob } from "../IJob";
|
|
2
|
-
|
|
3
|
-
interface Params {
|
|
4
|
-
uuids: string[]
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
const Method = 'remote.scene.remove'
|
|
8
|
-
|
|
9
|
-
class Task extends IJob {
|
|
10
|
-
readonly method = Method
|
|
11
|
-
readonly params
|
|
12
|
-
|
|
13
|
-
constructor(params: Params) {
|
|
14
|
-
super()
|
|
15
|
-
this.params = params
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export { Method, Task }
|
package/src/job/scene/unload.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { IJob } from "../IJob";
|
|
2
|
-
|
|
3
|
-
interface Params { }
|
|
4
|
-
|
|
5
|
-
const Method = 'remote.scene.unload'
|
|
6
|
-
|
|
7
|
-
class Task extends IJob {
|
|
8
|
-
readonly method = Method
|
|
9
|
-
readonly params
|
|
10
|
-
|
|
11
|
-
constructor(params: Params) {
|
|
12
|
-
super()
|
|
13
|
-
this.params = params
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export { Method, Task }
|
package/src/job/scene/update.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Descriptor, DeserializationObject } from "@vyr/engine";
|
|
2
|
-
import { IJob } from "../IJob";
|
|
3
|
-
|
|
4
|
-
interface Params {
|
|
5
|
-
content: DeserializationObject<Descriptor>
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
const Method = 'remote.scene.update'
|
|
9
|
-
|
|
10
|
-
class Task extends IJob {
|
|
11
|
-
readonly method = Method
|
|
12
|
-
readonly params
|
|
13
|
-
|
|
14
|
-
constructor(params: Params) {
|
|
15
|
-
super()
|
|
16
|
-
this.params = params
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { Method, Task }
|