Skip to content
Snippets Groups Projects
Commit 1191a172 authored by Vilém Duha's avatar Vilém Duha
Browse files

BlenderKit: improve model thumbnail generator

parent 236ce9e8
Branches
Tags
No related merge requests found
...@@ -970,7 +970,7 @@ class BlenderKitModelUploadProps(PropertyGroup, BlenderKitCommonUploadProps): ...@@ -970,7 +970,7 @@ class BlenderKitModelUploadProps(PropertyGroup, BlenderKitCommonUploadProps):
update=autothumb.update_upload_model_preview) update=autothumb.update_upload_model_preview)
thumbnail_background_lightness: FloatProperty(name="Thumbnail Background Lightness", thumbnail_background_lightness: FloatProperty(name="Thumbnail Background Lightness",
description="set to make your material stand out", default=.9, description="set to make your material stand out", default=1.0,
min=0.01, max=10) min=0.01, max=10)
thumbnail_angle: EnumProperty( thumbnail_angle: EnumProperty(
......
...@@ -139,19 +139,19 @@ if __name__ == "__main__": ...@@ -139,19 +139,19 @@ if __name__ == "__main__":
bpy.context.view_layer.update() bpy.context.view_layer.update()
# import blender's HDR here # import blender's HDR here
hdr_path = Path('datafiles/studiolights/world/interior.exr') # hdr_path = Path('datafiles/studiolights/world/interior.exr')
bpath = Path(bpy.utils.resource_path('LOCAL')) # bpath = Path(bpy.utils.resource_path('LOCAL'))
ipath = bpath / hdr_path # ipath = bpath / hdr_path
ipath = str(ipath) # ipath = str(ipath)
# this stuff is for mac and possibly linux. For blender // means relative path. # this stuff is for mac and possibly linux. For blender // means relative path.
# for Mac, // means start of absolute path # for Mac, // means start of absolute path
if ipath.startswith('//'): # if ipath.startswith('//'):
ipath = ipath[1:] # ipath = ipath[1:]
#
img = bpy.data.images['interior.exr'] # img = bpy.data.images['interior.exr']
img.filepath = ipath # img.filepath = ipath
img.reload() # img.reload()
bpy.context.scene.render.resolution_x = int(data['thumbnail_resolution']) bpy.context.scene.render.resolution_x = int(data['thumbnail_resolution'])
bpy.context.scene.render.resolution_y = int(data['thumbnail_resolution']) bpy.context.scene.render.resolution_y = int(data['thumbnail_resolution'])
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment