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-01-04 02:08:36 +0300
committerVilém Duha <vilda.novak@gmail.com>2020-01-07 13:43:43 +0300
commit1fe256ff3512436b15c6aa37e1374634fbdd2958 (patch)
treeb2744aaa229261db0996f5d30a9a8e5535d2566e
parentee8ddef20075d1ef8b902516cdd2bcc46e40e783 (diff)
BlenderKit: validation tools improvements
People who can validate are now recognized from profile info In menu it's possible to put asset on hold besides validation reupload of thumbnails doesn't put asset back to pre-validation state, only main file upload.
-rw-r--r--blenderkit/search.py4
-rw-r--r--blenderkit/ui_panels.py6
-rw-r--r--blenderkit/upload.py2
-rw-r--r--blenderkit/upload_bg.py15
4 files changed, 16 insertions, 11 deletions
diff --git a/blenderkit/search.py b/blenderkit/search.py
index 844b7fd1..1dd7e6c2 100644
--- a/blenderkit/search.py
+++ b/blenderkit/search.py
@@ -635,7 +635,7 @@ def write_profile(adata):
if user.get('remainingPrivateQuota') is not None:
user['remainingPrivateQuota'] /= (1024 * 1024)
- if user.get('id') == 2:
+ if adata.get('canEditAllAssets') is True:
user['exmenu'] = True
else:
user['exmenu'] = False
@@ -675,7 +675,7 @@ def get_profile():
def profile_is_validator():
a = bpy.context.window_manager.get('bkit profile')
- if a is not None and a.get('exmenu'):
+ if a is not None and a['user'].get('exmenu'):
return True
return False
diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py
index d8ca90fc..4541de6a 100644
--- a/blenderkit/ui_panels.py
+++ b/blenderkit/ui_panels.py
@@ -772,11 +772,15 @@ class OBJECT_MT_blenderkit_asset_menu(bpy.types.Menu):
if profile is not None:
# validation by admin
if profile['user']['exmenu']:
+ layout.label(text='Validation tools:')
if asset_data['verificationStatus'] != 'validated':
op = layout.operator('object.blenderkit_change_status', text='Validate')
op.asset_id = asset_data['id']
op.state = 'validated'
-
+ if asset_data['verificationStatus'] != 'on_hold':
+ op = layout.operator('object.blenderkit_change_status', text='Put on Hold')
+ op.asset_id = asset_data['id']
+ op.state = 'on_hold'
if author_id == str(profile['user']['id']):
layout.label(text='Management tools:')
diff --git a/blenderkit/upload.py b/blenderkit/upload.py
index b44ae2f3..001c6211 100644
--- a/blenderkit/upload.py
+++ b/blenderkit/upload.py
@@ -622,7 +622,7 @@ def start_upload(self, context, asset_type, reupload, upload_set):
else:
url += props.id + '/'
try:
- if upload_set != ['METADATA']:
+ if 'MAINFILE' in upload_set:
json_metadata["verificationStatus"] = "uploading"
r = rerequests.put(url, json=json_metadata, headers=headers, verify=True, immediate=True) # files = files,
ui.add_report('uploaded metadata')
diff --git a/blenderkit/upload_bg.py b/blenderkit/upload_bg.py
index a9c9f19b..2115649b 100644
--- a/blenderkit/upload_bg.py
+++ b/blenderkit/upload_bg.py
@@ -197,17 +197,18 @@ if __name__ == "__main__":
if uploaded:
# mark on server as uploaded
- confirm_data = {
- "verificationStatus": "uploaded"
- }
+ if 'MAINFILE' in upload_set:
+ confirm_data = {
+ "verificationStatus": "uploaded"
+ }
- url = paths.get_api_url() + 'assets/'
+ url = paths.get_api_url() + 'assets/'
- headers = utils.get_headers(upload_data['token'])
+ headers = utils.get_headers(upload_data['token'])
- url += upload_data["id"] + '/'
+ url += upload_data["id"] + '/'
- r = rerequests.patch(url, json=confirm_data, headers=headers, verify=True) # files = files,
+ r = rerequests.patch(url, json=confirm_data, headers=headers, verify=True) # files = files,
bg_blender.progress('upload finished successfully')
else: