From 769234a474d251fdea4c8427ed476cab33eceae0 Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Fri, 22 Jun 2018 20:32:47 -0400 Subject: [PATCH 1/2] switch to AssetRegistry --- REQUIRE | 2 +- src/MeshCat.jl | 9 ++++++++- src/visualizer.jl | 6 +----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/REQUIRE b/REQUIRE index 61dc145..08b437d 100644 --- a/REQUIRE +++ b/REQUIRE @@ -14,6 +14,6 @@ BinDeps 0.8.7 # Communication MsgPack 0.1.1 -WebIO 0.1.8 +WebIO 0.2.0 Mux 0.2.3 JSExpr 0.1.0 diff --git a/src/MeshCat.jl b/src/MeshCat.jl index 2d9c394..b7fb2c0 100644 --- a/src/MeshCat.jl +++ b/src/MeshCat.jl @@ -3,6 +3,7 @@ __precompile__() module MeshCat using WebIO +import AssetRegistry using GeometryTypes, CoordinateTransformations using Rotations: rotation_between, Rotation using Colors: Color, Colorant, RGB, RGBA, alpha @@ -10,7 +11,7 @@ using StaticArrays: StaticVector, SVector, SDiagonal using GeometryTypes: raw using Parameters: @with_kw using Base.Random: UUID, uuid1 -using DocStringExtensions +using DocStringExtensions: SIGNATURES using JSExpr: @js, @new, @var using Base.Filesystem: rm using BinDeps: download_cmd, unpack_cmd @@ -90,4 +91,10 @@ function develop_meshcat_assets(skip_confirmation=false) rm(joinpath(meshcat_dir, "..", "meshcat.stamp")) end +const ASSET_KEYS = String[] + +function __init__() + push!(ASSET_KEYS, AssetRegistry.register(abspath(joinpath(VIEWER_ROOT, "main.min.js")))) +end + end diff --git a/src/visualizer.jl b/src/visualizer.jl index 0b501b4..9eba15f 100644 --- a/src/visualizer.jl +++ b/src/visualizer.jl @@ -7,11 +7,7 @@ mutable struct CoreVisualizer controls::Dict{String, Tuple{Observable, AbstractControl}} function CoreVisualizer() - scope = WebIO.Scope( - imports=[ - "pkg/MeshCat/meshcat/dist/main.min.js" - ] - ) + scope = WebIO.Scope(imports=ASSET_KEYS) command_channel = Observable(scope, "meshcat-command", UInt8[]) request_channel = Observable(scope, "meshcat-request", "") controls_channel = Observable(scope, "meshcat-controls", []) From 1e554867ca1017765a0b7f23a2d0838c0f599cc4 Mon Sep 17 00:00:00 2001 From: Robin Deits Date: Fri, 22 Jun 2018 20:33:36 -0400 Subject: [PATCH 2/2] update REQUIRE --- REQUIRE | 1 + 1 file changed, 1 insertion(+) diff --git a/REQUIRE b/REQUIRE index 08b437d..40e1fe0 100644 --- a/REQUIRE +++ b/REQUIRE @@ -17,3 +17,4 @@ MsgPack 0.1.1 WebIO 0.2.0 Mux 0.2.3 JSExpr 0.1.0 +AssetRegistry 0.0.1