[Bf-extensions-cvs] [3168fd6d] master: BlenderKit: fix cancelling of download

Vilém Duha noreply at git.blender.org
Thu Sep 10 11:30:43 CEST 2020


Commit: 3168fd6dade4d7f6c1157f4e5ea9b3f8ff067a9a
Author: Vilém Duha
Date:   Thu Sep 10 11:30:01 2020 +0200
Branches: master
https://developer.blender.org/rBA3168fd6dade4d7f6c1157f4e5ea9b3f8ff067a9a

BlenderKit: fix cancelling of download

until now, cancelling a download always cancelled the last download, not the one clicked on

===================================================================

M	blenderkit/ui_panels.py
M	blenderkit/upload.py

===================================================================

diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py
index d70c8b69..7f51f5c5 100644
--- a/blenderkit/ui_panels.py
+++ b/blenderkit/ui_panels.py
@@ -1318,13 +1318,14 @@ class VIEW3D_PT_blenderkit_downloads(Panel):
 
     def draw(self, context):
         layout = self.layout
-        for threaddata in download.download_threads:
+        for i,threaddata in enumerate(download.download_threads):
             tcom = threaddata[2]
             asset_data = threaddata[1]
             row = layout.row()
             row.label(text=asset_data['name'])
             row.label(text=str(int(tcom.progress)) + ' %')
-            row.operator('scene.blenderkit_download_kill', text='', icon='CANCEL')
+            op = row.operator('scene.blenderkit_download_kill', text='', icon='CANCEL')
+            op.thread_index = i
             if tcom.passargs.get('retry_counter', 0) > 0:
                 row = layout.row()
                 row.label(text='failed. retrying ... ', icon='ERROR')
diff --git a/blenderkit/upload.py b/blenderkit/upload.py
index 8e547cbc..ef637d79 100644
--- a/blenderkit/upload.py
+++ b/blenderkit/upload.py
@@ -817,7 +817,7 @@ class AssetVerificationStatusChange(Operator):
         preferences = bpy.context.preferences.addons['blenderkit'].preferences
 
         if not bpy.context.scene['search results']:
-            return;
+            return {'CANCELLED'};
         # update status in search results for validator's clarity
         sr = bpy.context.scene['search results']
         sro = bpy.context.scene['search results orig']['results']



More information about the Bf-extensions-cvs mailing list