Skip to content

Commit cb4a741

Browse files
authored
Merge pull request #203 from rdeits/rd/update-meshcat
Update meshcat to get threejs 0.132 and switch to Artifacts.toml
2 parents 8b96fab + 3f6b9df commit cb4a741

File tree

10 files changed

+35
-59
lines changed

10 files changed

+35
-59
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
version:
13-
- '1.3'
1413
- '1.5'
14+
- '1'
1515
os:
1616
- ubuntu-latest
1717
- macOS-latest

Artifacts.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[meshcat]
2+
git-tree-sha1 = "7583d693a20da2ec792ca48ab505df298d14e23e"
3+
4+
[[meshcat.download]]
5+
url = "https://github.com/rdeits/meshcat/tarball/a03d1abf636c059166132a6d9434a164a155ecbe"
6+
sha256 = "7631f6ec0fa64868863636a3ce71460e9b1edfc6f4c5179218ebd4ffcde8f3de"

Project.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "MeshCat"
22
uuid = "283c5d60-a78f-5afe-a0af-af636b173e11"
33
authors = ["Robin Deits <[email protected]>"]
4-
version = "0.13.2"
4+
version = "0.14.0"
55

66
[deps]
77
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
@@ -18,6 +18,7 @@ Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"
1818
MsgPack = "99f44e22-a591-53d1-9472-aa23ef4bd671"
1919
Mux = "a975b10e-0019-58db-a62f-e48ff68538c9"
2020
Parameters = "d96e819e-fc66-5662-9728-84c9c7592b0a"
21+
Pkg = "44cfe95a-1eb2-52ea-b672-e2afdf69b78f"
2122
Requires = "ae029012-a4dd-5104-9daa-d747884805df"
2223
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"
2324
Sockets = "6462fe0b-24de-5631-8697-dd941f90decc"
@@ -27,13 +28,13 @@ WebSockets = "104b5d7c-a370-577a-8038-80a2059c5097"
2728

2829
[compat]
2930
BinDeps = "1"
30-
Blink = "0.12"
31+
Blink = "0.12.4"
3132
Cassette = "0.2.5, 0.3"
3233
Colors = "0.9, 0.10, 0.11, 0.12"
3334
CoordinateTransformations = "0.5, 0.6"
3435
DocStringExtensions = "0.5, 0.6, 0.7, 0.8"
3536
FFMPEG = "0.2, 0.3, 0.4"
36-
GeometryBasics = "0.2, 0.3"
37+
GeometryBasics = "0.3"
3738
MeshIO = "0.4"
3839
Meshing = "0.5"
3940
MsgPack = "1"
@@ -43,7 +44,7 @@ Requires = "0.5, 1"
4344
Rotations = "1"
4445
StaticArrays = "0.10, 0.11, 0.12, 1"
4546
WebSockets = "1"
46-
julia = "1.3"
47+
julia = "1.5"
4748

4849
[extras]
4950
Blink = "ad839575-38b3-5650-b840-f874b8c74a25"

assets/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

deps/build.jl

Lines changed: 0 additions & 45 deletions
This file was deleted.

notebooks/Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Meshing = "e6723b4c-ebff-59f1-b4b7-d97aa5274f73"
99
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"
1010

1111
[compat]
12-
Colors = "0.9"
12+
Colors = "0.9, 0.10, 0.11, 0.12"
1313
FileIO = "1"
1414
GeometryBasics = "0.3"
1515
MeshIO = "0.4"

src/MeshCat.jl

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ using LinearAlgebra: UniformScaling, Diagonal, norm
4141
using Sockets: listen, @ip_str, IPAddr, IPv4, IPv6
4242
using Base64: base64encode
4343
using MsgPack: MsgPack, pack
44+
using Pkg.Artifacts: @artifact_str
4445
import Mux
4546
import Logging
4647
import Mux.WebSockets
@@ -118,7 +119,7 @@ include("servers.jl")
118119
include("assets.jl")
119120
include("integrations.jl")
120121

121-
const VIEWER_ROOT = joinpath(@__DIR__, "..", "assets", "meshcat", "dist")
122+
const VIEWER_ROOT = joinpath(first(readdir(artifact"meshcat", join=true)), "dist")
122123

123124
function __init__()
124125
main_js = abspath(joinpath(VIEWER_ROOT, "main.min.js"))

src/artifact_helper.jl

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using Tar, Inflate, SHA
2+
3+
function artifact_helper(sha::AbstractString)
4+
url = "https://github.com/rdeits/meshcat/tarball/$sha"
5+
filename = download(url)
6+
7+
println("""
8+
[meshcat]
9+
git-tree-sha1 = "$(Tar.tree_hash(IOBuffer(inflate_gzip(filename))))"
10+
11+
[[meshcat.download]]
12+
url = "$url"
13+
sha256 = "$(bytes2hex(open(sha256, filename)))"
14+
""")
15+
end

src/lowering.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,9 @@ end
300300
function lower(cmd::SetProperty)
301301
# The background controls expect [r, g, b] arrays rather than hex codes.
302302
value = cmd.value
303-
if cmd.property ("top_color", "bottom_color")
304-
rgb = RGB(value)
305-
value = round.(Int, 255 .* [red(rgb), green(rgb), blue(rgb)])
303+
if cmd.property ("color", "top_color", "bottom_color")
304+
rgb = RGBA(value)
305+
value = Float32.([red(rgb), green(rgb), blue(rgb), alpha(rgb)])
306306
end
307307
Dict{String, Any}(
308308
"type" => "set_property",

test/visualizer.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,10 +252,10 @@ end
252252
setanimation!(vis, anim1)
253253
anim2 = Animation()
254254
atframe(anim2, 0) do
255-
setprop!(vis["/Cameras/default/rotated/<object>"], "zoom", 1)
255+
settransform!(vis["/Cameras/default"], Translation(0, 0, -0.5))
256256
end
257257
atframe(anim2, 30) do
258-
setprop!(vis["/Cameras/default/rotated/<object>"], "zoom", 0.5)
258+
settransform!(vis["/Cameras/default"], Translation(0, 0, 0.5))
259259
end
260260
setanimation!(vis, anim2)
261261
anim_combined = merge(anim1, anim2)

0 commit comments

Comments
 (0)