Skip to content

Commit

Permalink
Merge pull request #203 from rdeits/rd/update-meshcat
Browse files Browse the repository at this point in the history
Update meshcat to get threejs 0.132 and switch to Artifacts.toml
  • Loading branch information
rdeits committed Aug 29, 2021
2 parents 8b96fab + 3f6b9df commit cb4a741
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 59 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ jobs:
fail-fast: false
matrix:
version:
- '1.3'
- '1.5'
- '1'
os:
- ubuntu-latest
- macOS-latest
Expand Down
6 changes: 6 additions & 0 deletions Artifacts.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[meshcat]
git-tree-sha1 = "7583d693a20da2ec792ca48ab505df298d14e23e"

[[meshcat.download]]
url = "https://github.com/rdeits/meshcat/tarball/a03d1abf636c059166132a6d9434a164a155ecbe"
sha256 = "7631f6ec0fa64868863636a3ce71460e9b1edfc6f4c5179218ebd4ffcde8f3de"
9 changes: 5 additions & 4 deletions Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "MeshCat"
uuid = "283c5d60-a78f-5afe-a0af-af636b173e11"
authors = ["Robin Deits <[email protected]>"]
version = "0.13.2"
version = "0.14.0"

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

[compat]
BinDeps = "1"
Blink = "0.12"
Blink = "0.12.4"
Cassette = "0.2.5, 0.3"
Colors = "0.9, 0.10, 0.11, 0.12"
CoordinateTransformations = "0.5, 0.6"
DocStringExtensions = "0.5, 0.6, 0.7, 0.8"
FFMPEG = "0.2, 0.3, 0.4"
GeometryBasics = "0.2, 0.3"
GeometryBasics = "0.3"
MeshIO = "0.4"
Meshing = "0.5"
MsgPack = "1"
Expand All @@ -43,7 +44,7 @@ Requires = "0.5, 1"
Rotations = "1"
StaticArrays = "0.10, 0.11, 0.12, 1"
WebSockets = "1"
julia = "1.3"
julia = "1.5"

[extras]
Blink = "ad839575-38b3-5650-b840-f874b8c74a25"
Expand Down
2 changes: 0 additions & 2 deletions assets/.gitignore

This file was deleted.

45 changes: 0 additions & 45 deletions deps/build.jl

This file was deleted.

2 changes: 1 addition & 1 deletion notebooks/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Meshing = "e6723b4c-ebff-59f1-b4b7-d97aa5274f73"
Rotations = "6038ab10-8711-5258-84ad-4b1120ba62dc"

[compat]
Colors = "0.9"
Colors = "0.9, 0.10, 0.11, 0.12"
FileIO = "1"
GeometryBasics = "0.3"
MeshIO = "0.4"
Expand Down
3 changes: 2 additions & 1 deletion src/MeshCat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ using LinearAlgebra: UniformScaling, Diagonal, norm
using Sockets: listen, @ip_str, IPAddr, IPv4, IPv6
using Base64: base64encode
using MsgPack: MsgPack, pack
using Pkg.Artifacts: @artifact_str
import Mux
import Logging
import Mux.WebSockets
Expand Down Expand Up @@ -118,7 +119,7 @@ include("servers.jl")
include("assets.jl")
include("integrations.jl")

const VIEWER_ROOT = joinpath(@__DIR__, "..", "assets", "meshcat", "dist")
const VIEWER_ROOT = joinpath(first(readdir(artifact"meshcat", join=true)), "dist")

function __init__()
main_js = abspath(joinpath(VIEWER_ROOT, "main.min.js"))
Expand Down
15 changes: 15 additions & 0 deletions src/artifact_helper.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using Tar, Inflate, SHA

function artifact_helper(sha::AbstractString)
url = "https://github.com/rdeits/meshcat/tarball/$sha"
filename = download(url)

println("""
[meshcat]
git-tree-sha1 = "$(Tar.tree_hash(IOBuffer(inflate_gzip(filename))))"
[[meshcat.download]]
url = "$url"
sha256 = "$(bytes2hex(open(sha256, filename)))"
""")
end
6 changes: 3 additions & 3 deletions src/lowering.jl
Original file line number Diff line number Diff line change
Expand Up @@ -300,9 +300,9 @@ end
function lower(cmd::SetProperty)
# The background controls expect [r, g, b] arrays rather than hex codes.
value = cmd.value
if cmd.property ("top_color", "bottom_color")
rgb = RGB(value)
value = round.(Int, 255 .* [red(rgb), green(rgb), blue(rgb)])
if cmd.property ("color", "top_color", "bottom_color")
rgb = RGBA(value)
value = Float32.([red(rgb), green(rgb), blue(rgb), alpha(rgb)])
end
Dict{String, Any}(
"type" => "set_property",
Expand Down
4 changes: 2 additions & 2 deletions test/visualizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,10 @@ end
setanimation!(vis, anim1)
anim2 = Animation()
atframe(anim2, 0) do
setprop!(vis["/Cameras/default/rotated/<object>"], "zoom", 1)
settransform!(vis["/Cameras/default"], Translation(0, 0, -0.5))
end
atframe(anim2, 30) do
setprop!(vis["/Cameras/default/rotated/<object>"], "zoom", 0.5)
settransform!(vis["/Cameras/default"], Translation(0, 0, 0.5))
end
setanimation!(vis, anim2)
anim_combined = merge(anim1, anim2)
Expand Down

2 comments on commit cb4a741

@rdeits
Copy link
Owner Author

@rdeits rdeits commented on cb4a741 Aug 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/43726

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.14.0 -m "<description of version>" cb4a7410f2162b1cb6b2ea7e535c0f55b0832a9a
git push origin v0.14.0

Please sign in to comment.