[Bf-extensions-cvs] [a2a4229b] master: BlenderKit: small fixes in UI and comments

Vilém Duha noreply at git.blender.org
Wed Oct 2 16:11:35 CEST 2019


Commit: a2a4229b7ed9118aa83808aaa41240abd4396f89
Author: Vilém Duha
Date:   Wed Oct 2 12:39:27 2019 +0200
Branches: master
https://developer.blender.org/rBAa2a4229b7ed9118aa83808aaa41240abd4396f89

BlenderKit: small fixes in UI and comments

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

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

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

diff --git a/blenderkit/download.py b/blenderkit/download.py
index 468aea05..3e4d49d6 100644
--- a/blenderkit/download.py
+++ b/blenderkit/download.py
@@ -298,7 +298,7 @@ def append_asset(asset_data, **kwargs):  # downloaders=[], location=None,
         downloaders = kwargs.get('downloaders')
         s = bpy.context.scene
         sprops = s.blenderkit_models
-        # TODO this is here because combinations of linking objects or appending groups are rather not-userfull
+        # TODO this is here because combinations of linking objects or appending groups are rather not-usefull
         if sprops.append_method == 'LINK_COLLECTION':
             sprops.append_link = 'LINK'
             sprops.import_as = 'GROUP'
diff --git a/blenderkit/ui_panels.py b/blenderkit/ui_panels.py
index c50172bf..edd51308 100644
--- a/blenderkit/ui_panels.py
+++ b/blenderkit/ui_panels.py
@@ -108,6 +108,7 @@ def draw_upload_common(layout, props, asset_type, context):
     # if props.upload_state.find('Error') > -1:
     #     layout.label(text = props.upload_state)
 
+
     if props.asset_base_id == '':
         optext = 'Upload %s' % asset_type.lower()
         op = layout.operator("object.blenderkit_upload", text=optext, icon='EXPORT')
@@ -206,8 +207,6 @@ def draw_panel_model_upload(self, context):
         layout.prop(props, 'design_year')
 
     row = layout.row()
-    if props.work_hours == 0:
-        row.label(text='', icon='ERROR')
     row.prop(props, 'work_hours')
 
     layout.prop(props, 'adult')
@@ -261,8 +260,6 @@ def draw_panel_scene_upload(self, context):
         layout.prop(props, 'design_year')
     layout.prop(props, 'condition')
     row = layout.row()
-    if props.work_hours == 0:
-        row.label(text='', icon='ERROR')
     row.prop(props, 'work_hours')
     layout.prop(props, 'adult')
 
@@ -362,12 +359,12 @@ class VIEW3D_PT_blenderkit_model_properties(Panel):
     bl_idname = "VIEW3D_PT_blenderkit_model_properties"
     bl_space_type = 'VIEW_3D'
     bl_region_type = 'UI'
-    bl_label = "Model tweaking"
+    bl_label = "Selected Asset"
     bl_context = "objectmode"
 
     @classmethod
     def poll(cls, context):
-        p = bpy.context.active_object is not None and bpy.context.active_object.get('asset_data') is not None
+        p = bpy.context.active_object is not None
         return p
 
     def draw(self, context):
@@ -743,7 +740,7 @@ class OBJECT_MT_blenderkit_asset_menu(bpy.types.Menu):
                     op = layout.operator('wm.url_open', text="Open author's website")
                     op.url = a['aboutMeUrl']
 
-                op = layout.operator('view3d.blenderkit_search', text="Show assets by author." + ui_props.asset_type.lower())
+                op = layout.operator('view3d.blenderkit_search', text="Show assets by author.")
                 op.keywords = ''
                 op.author_id = author_id
 
diff --git a/blenderkit/upload.py b/blenderkit/upload.py
index 955713b5..b44ae2f3 100644
--- a/blenderkit/upload.py
+++ b/blenderkit/upload.py
@@ -120,8 +120,6 @@ def get_missing_data_model(props):
         write_to_report(props, 'Add thumbnail:')
 
         props.report += props.thumbnail_generating_state + '\n'
-    # if props.work_hours == 0.0:
-    #     write_to_report(props, 'Fill in work hours')
     if props.engine == 'NONE':
         write_to_report(props, 'Set at least one rendering/output engine')
     if not any(props.dimensions):
@@ -140,8 +138,6 @@ def get_missing_data_scene(props):
         write_to_report(props, 'Add thumbnail:')
 
         props.report += props.thumbnail_generating_state + '\n'
-    # if props.work_hours == 0.0:
-    #     write_to_report(props, 'Fill in work hours')
     if props.engine == 'NONE':
         write_to_report(props, 'Set at least one rendering/output engine')
 
@@ -475,8 +471,8 @@ def verification_status_change(self, context, asset_id, state):
     headers = utils.get_headers(user_preferences.api_key)
     try:
         r = rerequests.patch(url, json=upload_data, headers=headers, verify=True)  # files = files,
-        #print('changed status ')
-        #print(r.text)
+        # print('changed status ')
+        # print(r.text)
     except requests.exceptions.RequestException as e:
         print(e)
         return {'CANCELLED'}
@@ -511,7 +507,7 @@ def check_storage_quota(props):
         preferences = bpy.context.preferences.addons['blenderkit'].preferences
         adata = search.request_profile(preferences.api_key)
         if adata is None:
-            props.report = 'User profile not retrieved.'
+            props.report = 'Please log-in first.'
             return False
         search.write_profile(adata)
         profile = adata
@@ -614,7 +610,7 @@ def start_upload(self, context, asset_type, reupload, upload_set):
     global reports
     if props.asset_base_id == '':
         try:
-            r = rerequests.post(url, json=json_metadata, headers=headers, verify=True, immediate = True)  # files = files,
+            r = rerequests.post(url, json=json_metadata, headers=headers, verify=True, immediate=True)  # files = files,
             ui.add_report('uploaded metadata')
             utils.p(r.text)
         except requests.exceptions.RequestException as e:
@@ -628,7 +624,7 @@ def start_upload(self, context, asset_type, reupload, upload_set):
         try:
             if upload_set != ['METADATA']:
                 json_metadata["verificationStatus"] = "uploading"
-            r = rerequests.put(url, json=json_metadata, headers=headers, verify=True , immediate = True)  # files = files,
+            r = rerequests.put(url, json=json_metadata, headers=headers, verify=True, immediate=True)  # files = files,
             ui.add_report('uploaded metadata')
             # parse the request
             # print('uploaded metadata')
@@ -812,15 +808,16 @@ class AssetVerificationStatusChange(Operator):
 
     state: StringProperty(
         name="verification_status",
-        default = 'uploaded'
+        default='uploaded'
     )
+
     @classmethod
     def poll(cls, context):
         return True
 
     def draw(self, context):
         layout = self.layout
-        #if self.state == 'deleted':
+        # if self.state == 'deleted':
         layout.label(text='Really delete asset from BlenderKit online storage?')
         # layout.prop(self, 'state')
 
@@ -830,7 +827,7 @@ class AssetVerificationStatusChange(Operator):
 
     def invoke(self, context, event):
         print(self.state)
-        if self.state =='deleted':
+        if self.state == 'deleted':
             wm = context.window_manager
             return wm.invoke_props_dialog(self)



More information about the Bf-extensions-cvs mailing list