Skip to content

Commit

Permalink
Handle both versions of GB in meshimage recipe
Browse files Browse the repository at this point in the history
  • Loading branch information
asinghvi17 committed Dec 25, 2024
1 parent 6eacfac commit 762bb62
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/mesh_image.jl
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,18 @@ function Makie.plot!(plot::MeshImage)
# You may have noticed that nowhere above did we actually create a mesh.
# Let's remedy that now!
final_mesh = lift(plot, points_observable, faces_observable, uv_observable; ignore_equal_values = true#=, priority = -100=#) do points, faces, uv
return GeometryBasics.Mesh(
points,
faces;
uv = uv, # each point gets a UV, they're interpolated on faces
)
@static if hasproperty(GeometryBasics, :metafree) # pre v0.5
return GeometryBasics.Mesh(
GeometryBasics.meta(points; uv=uv), # each point gets a UV, they're interpolated on faces
faces
)
else # post v0.5 / Makie v0.22
return GeometryBasics.Mesh(
points,
faces;
uv = uv, # each point gets a UV, they're interpolated on faces
)
end
end

# Finally, we plot the mesh.
Expand Down

0 comments on commit 762bb62

Please sign in to comment.