diff options
-rw-r--r-- | blenderkit/ui.py | 9 | ||||
-rw-r--r-- | blenderkit/utils.py | 3 | ||||
-rw-r--r-- | io_mesh_stl/blender_utils.py | 4 |
3 files changed, 11 insertions, 5 deletions
diff --git a/blenderkit/ui.py b/blenderkit/ui.py index 069809c6..fc9563a9 100644 --- a/blenderkit/ui.py +++ b/blenderkit/ui.py @@ -659,11 +659,14 @@ def draw_callback_2d_progress(self, context): for threaddata in download.download_threads: asset_data = threaddata[1] tcom = threaddata[2] + + directory = paths.get_temp_dir('%s_search' % asset_data['asset_type']) + tpath = os.path.join(directory, asset_data['thumbnail_small']) + img = utils.get_hidden_image(tpath, asset_data['id']) + if tcom.passargs.get('downloaders'): for d in tcom.passargs['downloaders']: - directory = paths.get_temp_dir('%s_search' % asset_data['asset_type']) - tpath = os.path.join(directory, asset_data['thumbnail_small']) - img = utils.get_hidden_image(tpath, 'rating_preview') + loc = view3d_utils.location_3d_to_region_2d(bpy.context.region, bpy.context.space_data.region_3d, d['location']) if loc is not None: diff --git a/blenderkit/utils.py b/blenderkit/utils.py index 784fc47b..c1a59cd8 100644 --- a/blenderkit/utils.py +++ b/blenderkit/utils.py @@ -252,11 +252,12 @@ def get_hidden_image(tpath, bdata_name, force_reload=False): img.filepath = tpath img.reload() + img.colorspace_settings.name = 'Linear' elif force_reload: if img.packed_file is not None: img.unpack(method='USE_ORIGINAL') img.reload() - img.colorspace_settings.name = 'Linear' + img.colorspace_settings.name = 'Linear' return img diff --git a/io_mesh_stl/blender_utils.py b/io_mesh_stl/blender_utils.py index 8589e196..97621d11 100644 --- a/io_mesh_stl/blender_utils.py +++ b/io_mesh_stl/blender_utils.py @@ -80,7 +80,8 @@ def faces_from_mesh(ob, global_matrix, use_mesh_modifiers=False): import bpy # get the editmode data - ob.update_from_editmode() + if ob.mode == "EDIT": + ob.update_from_editmode() # get the modifiers if use_mesh_modifiers: @@ -94,6 +95,7 @@ def faces_from_mesh(ob, global_matrix, use_mesh_modifiers=False): mesh = mesh_owner.to_mesh() except RuntimeError: return + if mesh is None: return |