[Bf-extensions-cvs] [d7f05ada] master: BlenderKit: fix ratings

Vilém Duha noreply at git.blender.org
Thu Mar 26 12:26:46 CET 2020


Commit: d7f05adabbe94c976ff6a63a6f7a080d82218220
Author: Vilém Duha
Date:   Thu Mar 26 12:25:54 2020 +0100
Branches: master
https://developer.blender.org/rBAd7f05adabbe94c976ff6a63a6f7a080d82218220

BlenderKit: fix ratings

-rating was virtually possible even if not logged in, but in reality the user couldn't rate on server.
-ratings were sent far too often to server thanks to an extra call.

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

M	blenderkit/ui.py

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

diff --git a/blenderkit/ui.py b/blenderkit/ui.py
index 24db4bdf..411e3acf 100644
--- a/blenderkit/ui.py
+++ b/blenderkit/ui.py
@@ -990,6 +990,10 @@ def floor_raycast(context, mx, my):
 def is_rating_possible():
     ao = bpy.context.active_object
     ui = bpy.context.scene.blenderkitUI
+    preferences = bpy.context.preferences.addons['blenderkit'].preferences
+    #first test if user is logged in.
+    if preferences.api_key == '':
+        return False, False, None, None
     if bpy.context.scene.get('assets rated') is not None and ui.down_up == 'SEARCH':
         if bpy.context.mode in ('SCULPT', 'PAINT_TEXTURE'):
             b = utils.get_active_brush()
@@ -1096,9 +1100,7 @@ def interact_rating(r, mx, my, event):
                         bkit_ratings.rating_work_hours = wh
 
                 if event.type == 'LEFTMOUSE' and event.value == 'RELEASE':
-                    if bkit_ratings.rating_quality > 0.1 or bkit_ratings.rating_work_hours > 0.1:
-                        ratings.upload_rating(asset)
-                    ui.last_rating_time = time.time()
+                    ui.last_rating_time = time.time() # this prop seems obsolete now?
                 return True
             else:
                 ui.rating_button_on = True



More information about the Bf-extensions-cvs mailing list