[Bf-extensions-cvs] [1a1fd78c] master: BlenderKit: small background upload optimization(don't create upload scene always)

Vilém Duha noreply at git.blender.org
Tue Jan 7 11:43:57 CET 2020


Commit: 1a1fd78cd18a4e80bb53c1c580c98c8fa73522f1
Author: Vilém Duha
Date:   Sat Jan 4 18:34:45 2020 +0100
Branches: master
https://developer.blender.org/rBA1a1fd78cd18a4e80bb53c1c580c98c8fa73522f1

BlenderKit: small background upload optimization(don't create upload scene always)

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

M	blenderkit/upload_bg.py

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

diff --git a/blenderkit/upload_bg.py b/blenderkit/upload_bg.py
index 2115649b..b2db44da 100644
--- a/blenderkit/upload_bg.py
+++ b/blenderkit/upload_bg.py
@@ -89,7 +89,7 @@ def upload_file(upload_data, f):
     upload = upload.json()
 
     chunk_size = 1024 * 256
-
+    utils.pprint(upload)
     # file gets uploaded here:
     uploaded = False
     # s3 upload is now the only option
@@ -129,10 +129,7 @@ def upload_files(upload_data, files):
 
 if __name__ == "__main__":
 
-    bpy.data.scenes.new('upload')
-    for s in bpy.data.scenes:
-        if s.name != 'upload':
-            bpy.data.scenes.remove(s)
+
     try:
         bg_blender.progress('preparing scene - append data')
         with open(BLENDERKIT_EXPORT_DATA, 'r') as s:
@@ -144,6 +141,11 @@ if __name__ == "__main__":
 
         upload_set = data['upload_set']
         if 'MAINFILE' in upload_set:
+            bpy.data.scenes.new('upload')
+            for s in bpy.data.scenes:
+                if s.name != 'upload':
+                    bpy.data.scenes.remove(s)
+
             if export_data['type'] == 'MODEL':
                 obnames = export_data['models']
                 main_source, allobs = append_link.append_objects(file_name=data['source_filepath'],



More information about the Bf-extensions-cvs mailing list