Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A little experiment towards better clean up + more typed observables #2372

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 16 additions & 13 deletions GLMakie/src/drawing_primitives.jl
Original file line number Diff line number Diff line change
Expand Up @@ -77,24 +77,27 @@ function connect_camera!(gl_attributes, cam, space = gl_attributes[:space])
return nothing
end

function cached_robj!(robj_func, screen, scene, x::AbstractPlot)
function cached_robj!(robj_func, screen, scene, @nospecialize(x::AbstractPlot))
# poll inside functions to make wait on compile less prominent
pollevents(screen)
ignore = Set([
:transformation, :tickranges, :ticklabels, :raw, :SSAO,
:lightposition, :material,
:inspector_label, :inspector_hover, :inspector_clear
])
robj = get!(screen.cache, objectid(x)) do
filtered = filter(x.attributes) do (k, v)
!in(k, (
:transformation, :tickranges, :ticklabels, :raw, :SSAO,
:lightposition, :material,
:inspector_label, :inspector_hover, :inspector_clear
))
end
gl_attributes = Dict{Symbol, Any}()
plot_attributes = attributes(x)
setfield!(plot_attributes, :convert, true)
setfield!(plot_attributes, :plotkey, plotkey(x))
empty!(getfield(plot_attributes, :observables))

for (key, value) in plot_attributes
key in ignore && continue

gl_attributes = Dict{Symbol, Any}(map(filtered) do key_value
key, value = key_value
gl_key = to_glvisualize_key(key)
gl_value = lift_convert(key, value, x)
gl_key => gl_value
end)
gl_attributes[gl_key] = value
end

pointlight = Makie.get_point_light(scene)
if !isnothing(pointlight)
Expand Down
3 changes: 2 additions & 1 deletion MakieCore/Project.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
authors = ["Simon Danisch"]
name = "MakieCore"
uuid = "20f20a25-4f0e-4fdf-b5d1-57303727442b"
authors = ["Simon Danisch"]
version = "0.5.1"

[deps]
GeometryBasics = "5c1252a2-5f33-56bf-86c9-59e7332b4326"
Observables = "510215fc-4207-5dde-b226-833fc4488ee2"

[compat]
Expand Down
2 changes: 1 addition & 1 deletion MakieCore/src/MakieCore.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ end
using Observables
using Observables: to_value
using Base: RefValue

using GeometryBasics

include("types.jl")
include("attributes.jl")
Expand Down
Loading