Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender-addons.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVilém Duha <vilda.novak@gmail.com>2020-12-05 20:26:05 +0300
committerVilém Duha <vilda.novak@gmail.com>2020-12-05 20:26:05 +0300
commit05fd1e08cfb277b1ea13bfca47fbb56dca156032 (patch)
tree2c8df464f7de39874e850473d0814076b7c9fc7d /blenderkit/upload_bg.py
parent8c87cf0afccb2bb73a3575eaa58016cfec4e177a (diff)
BlenderKit: resolutions
This introduces resolutins into the addon. This update should enhance the usability of the addon, especially for people with weaker computers. It downloads reduced version of the assets - only images are scaled down by now. Images are also converted in some cases from .png to .jpgs to save space. - there's a default resolution setting - resolutions can be swapped by user - resolutions apply only to textured models and materials with textures larger than 1024px - Resolutions aren't yet generated on the server, so will be visible after a few days. Version of the addon was bumped up to 1.0.40.
Diffstat (limited to 'blenderkit/upload_bg.py')
-rw-r--r--blenderkit/upload_bg.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/blenderkit/upload_bg.py b/blenderkit/upload_bg.py
index 236793c0..a0e95535 100644
--- a/blenderkit/upload_bg.py
+++ b/blenderkit/upload_bg.py
@@ -77,7 +77,7 @@ class upload_in_chunks(object):
def upload_file(upload_data, f):
headers = utils.get_headers(upload_data['token'])
version_id = upload_data['id']
- bg_blender.progress('uploading %s' % f['type'])
+ bg_blender.progress(f"uploading {f['type']} {os.path.basename(f['file_path'])}")
upload_info = {
'assetId': version_id,
'fileType': f['type'],
@@ -89,7 +89,7 @@ def upload_file(upload_data, f):
upload = upload.json()
#
chunk_size = 1024 * 1024 * 2
- utils.pprint(upload)
+ # utils.pprint(upload)
# file gets uploaded here:
uploaded = False
# s3 upload is now the only option
@@ -100,7 +100,7 @@ def upload_file(upload_data, f):
data=upload_in_chunks(f['file_path'], chunk_size, f['type']),
stream=True, verify=True)
- if upload_response.status_code == 200:
+ if 250>upload_response.status_code >199:
uploaded = True
else:
print(upload_response.text)
@@ -111,6 +111,7 @@ def upload_file(upload_data, f):
time.sleep(1)
# confirm single file upload to bkit server
+ print(upload)
upload_done_url = paths.get_api_url() + 'uploads_s3/' + upload['id'] + '/upload-file/'
upload_response = rerequests.post(upload_done_url, headers=headers, verify=True)
@@ -120,6 +121,7 @@ def upload_file(upload_data, f):
def upload_files(upload_data, files):
+ '''uploads several files in one run'''
uploaded_all = True
for f in files:
uploaded = upload_file(upload_data, f)
@@ -130,8 +132,6 @@ def upload_files(upload_data, files):
if __name__ == "__main__":
-
-
try:
bg_blender.progress('preparing scene - append data')
with open(BLENDERKIT_EXPORT_DATA, 'r') as s: