Skip to content

Commit

Permalink
try matching file without capitalization
Browse files Browse the repository at this point in the history
  • Loading branch information
ffreyer committed Oct 21, 2024
1 parent 51ce8ff commit fa8c183
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/basic_recipes/mesh.jl
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,22 @@ function plot!(p::Mesh{<: Tuple{<: GeometryBasics.MetaMesh}})
tex = if haskey(x, "image")
x["image"]
elseif haskey(x, "filename")
FileIO.load(x["filename"])
if isfile(x["filename"])
FileIO.load(x["filename"])
else
# try to match filename
path, filename = splitdir(x["filename"])
files = readdir(path)
idx = findfirst(f -> lowercase(f) == lowercase(filename), files)
if idx === nothing
@error "Failed to load texture from material $name - File $filename not found in $path."
fill(RGB{N0f8}(1,0,1), (1,1))
else
FileIO.load(joinpath(path, files[idx]))
end
end
else
fill(RGB{N0f8}(1,0,1))
fill(RGB{N0f8}(1,0,1), (1,1))
end
repeat = get(x, "clamp", false) ? (:clamp_to_edge) : (:repeat)

Expand Down

0 comments on commit fa8c183

Please sign in to comment.