@viamrobotics/motion-tools 1.27.0 → 1.27.1
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.
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { PortalTarget } from '@threlte/extras'
|
|
9
9
|
import { useXR } from '@threlte/xr'
|
|
10
10
|
import { provideToast, ToastContainer } from '@viamrobotics/prime-core'
|
|
11
|
+
import { ThemeUtils } from 'svelte-tweakpane-ui'
|
|
11
12
|
|
|
12
13
|
import type { CameraPose } from '../hooks/useControls.svelte'
|
|
13
14
|
|
|
@@ -90,10 +91,6 @@
|
|
|
90
91
|
const currentRobotCameraWidgets = $derived(settings.current.openCameraWidgets[partID] || [])
|
|
91
92
|
const { isPresenting } = useXR()
|
|
92
93
|
|
|
93
|
-
$effect(() => {
|
|
94
|
-
environment.current.inputBindingsEnabled = inputBindingsEnabled
|
|
95
|
-
})
|
|
96
|
-
|
|
97
94
|
createPartIDContext(() => partID)
|
|
98
95
|
provideDrawConnectionConfig(() => drawConnectionConfig)
|
|
99
96
|
provideWeblabs()
|
|
@@ -106,9 +103,18 @@
|
|
|
106
103
|
() => localConfigProps
|
|
107
104
|
)
|
|
108
105
|
|
|
109
|
-
$effect
|
|
106
|
+
$effect(() => {
|
|
107
|
+
environment.current.inputBindingsEnabled = inputBindingsEnabled
|
|
110
108
|
environment.current.isStandalone = !localConfigProps
|
|
111
109
|
})
|
|
110
|
+
|
|
111
|
+
$effect(() => {
|
|
112
|
+
ThemeUtils.setGlobalDefaultTheme({
|
|
113
|
+
...ThemeUtils.presets.light,
|
|
114
|
+
baseBackgroundColor: '#fbfbfc',
|
|
115
|
+
baseShadowColor: 'transparent',
|
|
116
|
+
})
|
|
117
|
+
})
|
|
112
118
|
</script>
|
|
113
119
|
|
|
114
120
|
{#if settings.current.enableQueryDevtools}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
module
|
|
3
3
|
lang="ts"
|
|
4
4
|
>
|
|
5
|
-
import { ThemeUtils } from 'svelte-tweakpane-ui'
|
|
6
5
|
import { BufferAttribute, Euler, MathUtils, Quaternion } from 'three'
|
|
7
6
|
|
|
8
7
|
import { OrientationVector } from '../../three/OrientationVector'
|
|
@@ -280,12 +279,6 @@
|
|
|
280
279
|
2
|
|
281
280
|
)
|
|
282
281
|
}
|
|
283
|
-
|
|
284
|
-
ThemeUtils.setGlobalDefaultTheme({
|
|
285
|
-
...ThemeUtils.presets.light,
|
|
286
|
-
baseBackgroundColor: '#fbfbfc',
|
|
287
|
-
baseShadowColor: 'transparent',
|
|
288
|
-
})
|
|
289
282
|
</script>
|
|
290
283
|
|
|
291
284
|
{#snippet ImmutableField({
|
package/dist/ecs/traits.js
CHANGED
|
@@ -230,7 +230,9 @@ export const updateGeometryTrait = (entity, geometry) => {
|
|
|
230
230
|
}
|
|
231
231
|
else if (geometry.geometryType.case === 'mesh') {
|
|
232
232
|
if (entity.has(BufferGeometry)) {
|
|
233
|
+
const old = entity.get(BufferGeometry);
|
|
233
234
|
entity.set(BufferGeometry, parsePlyInput(geometry.geometryType.value.mesh));
|
|
235
|
+
old?.dispose();
|
|
234
236
|
}
|
|
235
237
|
else {
|
|
236
238
|
entity.remove(Box, Sphere, Capsule);
|
|
@@ -2,18 +2,19 @@ import { ArmClient, BaseClient, CameraClient, GantryClient, GenericComponentClie
|
|
|
2
2
|
import { createResourceClient, createResourceQuery, useResourceNames, } from '@viamrobotics/svelte-sdk';
|
|
3
3
|
import {} from 'koota';
|
|
4
4
|
import { getContext, setContext, untrack } from 'svelte';
|
|
5
|
-
import { Color } from 'three';
|
|
5
|
+
import { Color, Matrix4 } from 'three';
|
|
6
6
|
import { resourceColors } from '../color';
|
|
7
7
|
import { RefetchRates } from '../components/overlay/RefreshRate.svelte';
|
|
8
8
|
import { hierarchy, traits, useWorld } from '../ecs';
|
|
9
9
|
import { updateGeometryTrait } from '../ecs/traits';
|
|
10
|
-
import { createPose,
|
|
10
|
+
import { createPose, poseToMatrix } from '../transform';
|
|
11
11
|
import { useEnvironment } from './useEnvironment.svelte';
|
|
12
12
|
import { useLogs } from './useLogs.svelte';
|
|
13
13
|
import { useResourceByName } from './useResourceByName.svelte';
|
|
14
14
|
import { RefreshRates, useSettings } from './useSettings.svelte';
|
|
15
15
|
const key = Symbol('geometries-context');
|
|
16
16
|
const colorUtil = new Color();
|
|
17
|
+
const tempMatrix = new Matrix4();
|
|
17
18
|
export const provideGeometries = (partID) => {
|
|
18
19
|
const environment = useEnvironment();
|
|
19
20
|
const resources = useResourceByName();
|
|
@@ -97,8 +98,11 @@ export const provideGeometries = (partID) => {
|
|
|
97
98
|
const existing = entities.get(entityKey);
|
|
98
99
|
if (existing) {
|
|
99
100
|
hierarchy.setParent(existing, name);
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
poseToMatrix(center, tempMatrix);
|
|
102
|
+
const matrix = existing.get(traits.Matrix);
|
|
103
|
+
if (matrix && !matrix.equals(tempMatrix)) {
|
|
104
|
+
matrix.copy(tempMatrix);
|
|
105
|
+
existing.changed(traits.Matrix);
|
|
102
106
|
}
|
|
103
107
|
updateGeometryTrait(existing, geometry);
|
|
104
108
|
continue;
|
|
@@ -106,7 +110,7 @@ export const provideGeometries = (partID) => {
|
|
|
106
110
|
const entityTraits = [
|
|
107
111
|
...hierarchy.parentTraits(name),
|
|
108
112
|
traits.Name(label),
|
|
109
|
-
traits.
|
|
113
|
+
traits.Matrix(poseToMatrix(center, new Matrix4())),
|
|
110
114
|
traits.GeometriesAPI,
|
|
111
115
|
traits.Geometry(geometry),
|
|
112
116
|
];
|
package/dist/three/OBBHelper.js
CHANGED
|
@@ -39,9 +39,12 @@ const expandBoxByTransformedBox = (box, childBox, matrix) => {
|
|
|
39
39
|
};
|
|
40
40
|
export class OBBHelper extends LineSegments2 {
|
|
41
41
|
constructor(color = 0x000000, linewidth = 2) {
|
|
42
|
-
const
|
|
42
|
+
const boxGeometry = new BoxGeometry();
|
|
43
|
+
const edges = new EdgesGeometry(boxGeometry);
|
|
43
44
|
const geometry = new LineSegmentsGeometry();
|
|
44
45
|
geometry.setPositions(edges.getAttribute('position').array);
|
|
46
|
+
edges.dispose();
|
|
47
|
+
boxGeometry.dispose();
|
|
45
48
|
const material = new LineMaterial({
|
|
46
49
|
color,
|
|
47
50
|
linewidth,
|
package/dist/three/arrow.js
CHANGED
|
@@ -20,6 +20,8 @@ export const createArrowGeometry = () => {
|
|
|
20
20
|
// Place its center at y = shaftLength + headLength/2 so tip lands at y = shaftLength + headLength
|
|
21
21
|
headGeo.translate(0, tailLength + headLength * 0.5, 0);
|
|
22
22
|
const merged = mergeGeometries([tailGeometry, headGeo], true);
|
|
23
|
+
tailGeometry.dispose();
|
|
24
|
+
headGeo.dispose();
|
|
23
25
|
merged.computeVertexNormals();
|
|
24
26
|
merged.computeBoundingBox();
|
|
25
27
|
merged.computeBoundingSphere();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@viamrobotics/motion-tools",
|
|
3
|
-
"version": "1.27.
|
|
3
|
+
"version": "1.27.1",
|
|
4
4
|
"description": "Motion visualization with Viam",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"prettier-plugin-tailwindcss": "0.6.14",
|
|
65
65
|
"publint": "0.3.12",
|
|
66
66
|
"runed": "0.31.1",
|
|
67
|
-
"svelte": "5.55.
|
|
67
|
+
"svelte": "5.55.7",
|
|
68
68
|
"svelte-check": "4.4.5",
|
|
69
69
|
"svelte-tweakpane-ui": "^1.5.16",
|
|
70
70
|
"svelte-virtuallists": "1.4.2",
|