diff --git a/blenderkit/ui.py b/blenderkit/ui.py index 8db62433defae708ca9e7671782a782c3d99e2f7..f8d48b2d6b1f5200879dd0fd5c69d2c5a6572dc9 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 784fc47be6280b15e5f285d16b61aaa647074cc2..c1a59cd8b9488a61c3eb3d06b0acf9a960e785fd 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 8589e196800dcbda5f9b4dbc5080f53e52a27985..97621d112bb572be152ae3c6c3cc1d3af336c7b5 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