Skip to content

Commit

Permalink
Merge pull request #98 from tkoolen/tk/hide
Browse files Browse the repository at this point in the history
 Add hide! utility function.
  • Loading branch information
rdeits authored Apr 7, 2019
2 parents 4f6771c + ddcdcf0 commit 9451883
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/MeshCat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ export setobject!,
settransform!,
delete!,
setprop!,
setanimation!
setanimation!,
setvisible!

export AbstractVisualizer,
AbstractMaterial,
Expand Down
3 changes: 2 additions & 1 deletion src/abstract_visualizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ function setprop! end
function setcontrol! end


# Convenient shortcuts for creating new objects
# Convenient shortcuts
setobject!(vis::AbstractVisualizer, geom::GeometryLike) = setobject!(vis, Object(geom))
setobject!(vis::AbstractVisualizer, geom::GeometryLike, material::AbstractMaterial) = setobject!(vis, Object(geom, material))
setvisible!(vis::AbstractVisualizer, visible::Bool) = setprop!(vis, "visible", visible)
9 changes: 9 additions & 0 deletions test/visualizer.jl
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,15 @@ end
end
end

@testset "setvisible!" begin
v = vis[:box_to_hide]
setobject!(v, HyperRectangle(Vec(0., 0, 0), Vec(0.1, 0.2, 0.3)))
sleep(1)
setvisible!(v, false)
sleep(1)
setvisible!(v, true)
end

sleep(5)

if !(Sys.iswindows() && haskey(ENV, "CI"))
Expand Down

0 comments on commit 9451883

Please sign in to comment.