Skip to content

Commit

Permalink
Fix hdrihaven
Browse files Browse the repository at this point in the history
  • Loading branch information
eliemichel committed Jun 2, 2021
1 parent f8fe090 commit cd7fd2f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
10 changes: 7 additions & 3 deletions blender/LilySurfaceScraper/Scrapers/HdriHavenScraper.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,13 +82,17 @@ def fetchVariant(self, variant_index, material_data):
material_data.name = "hdrihaven/" + base_name + '/' + var_name

url = variant_data[variant_index].attrib['href']
if url.startswith("//"):
url = "https:" + url
if url.endswith('.exr') or url.endswith('.hdr') or url.endswith('.jpg'):
map_url = url
else:
redirect_html = self.fetchHtml(url)
map_url = "https://hdrihaven.com" + redirect_html.xpath("//a[@download]/@href")[0]
if url.startswith("//"):
url = "https:" + url
map_url = redirect_html.xpath("//a[@download]/@href")[0]
if map_url.startswith("//"):
map_url = "https:" + map_url
elif not map_url.startswith("http"):
map_url = "https://hdrihaven.com" + map_url
material_data.maps['sky'] = self.fetchImage(map_url, material_data.name, 'sky')

return True
2 changes: 1 addition & 1 deletion blender/LilySurfaceScraper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
bl_info = {
"name": "Lily Surface Scraper",
"author": "Élie Michel <elie.michel@exppad.com>",
"version": (1, 6, 2),
"version": (1, 7, 1),
"blender": (2, 82, 0),
"location": "Properties > Material",
"description": "Import material from a single URL",
Expand Down

0 comments on commit cd7fd2f

Please sign in to comment.