[Bf-extensions-cvs] [6665bb98] master: BlenderKit: fixes
Vilém Duha
noreply at git.blender.org
Wed Mar 18 13:35:03 CET 2020
Commit: 6665bb9820c46c560420d3b5b2e5ab4c02e3125a
Author: Vilém Duha
Date: Wed Mar 18 13:34:37 2020 +0100
Branches: master
https://developer.blender.org/rBA6665bb9820c46c560420d3b5b2e5ab4c02e3125a
BlenderKit: fixes
-first run now saves preferences to not appear again on each blender start
-fix possible error with assetbar shortcuts (wrong index)
-validation - update status in search results on verification status change
===================================================================
M blenderkit/__init__.py
M blenderkit/search.py
M blenderkit/ui.py
M blenderkit/upload.py
===================================================================
diff --git a/blenderkit/__init__.py b/blenderkit/__init__.py
index 35a5b1ec..68b2547e 100644
--- a/blenderkit/__init__.py
+++ b/blenderkit/__init__.py
@@ -1529,7 +1529,8 @@ class BlenderKitAddonPreferences(AddonPreferences):
first_run: BoolProperty(
name="First run",
description="Detects if addon was already registered/run.",
- default=True
+ default=True,
+ update=utils.save_prefs
)
# allow_proximity : BoolProperty(
# name="allow proximity data reports",
diff --git a/blenderkit/search.py b/blenderkit/search.py
index 94b0c94c..1db1f619 100644
--- a/blenderkit/search.py
+++ b/blenderkit/search.py
@@ -154,6 +154,8 @@ def timer_update():
if first_time:# first time
first_time = False
if preferences.show_on_start or preferences.first_run:
+ # TODO here it should check if there are some results, and only open assetbar if this is the case, not search.
+ #if bpy.context.scene.get('search results') is None:
search()
preferences.first_run = False
if preferences.tips_on_start:
@@ -236,6 +238,9 @@ def timer_update():
if durl and tname:
tooltip = generate_tooltip(r)
+ #for some reason, the id was still int on some occurances. investigate this.
+ r['author']['id'] = str(r['author']['id'])
+
asset_data = {'thumbnail': tname,
'thumbnail_small': small_tname,
# 'thumbnails':allthumbs,
@@ -248,7 +253,7 @@ def timer_update():
'tags': r['tags'],
'can_download': r.get('canDownload', True),
'verification_status': r['verificationStatus'],
- 'author_id': str(r['author']['id']),
+ 'author_id': r['author']['id'],
# 'author': r['author']['firstName'] + ' ' + r['author']['lastName']
# 'description': r['description'],
}
diff --git a/blenderkit/ui.py b/blenderkit/ui.py
index f5efae7d..24db4bdf 100644
--- a/blenderkit/ui.py
+++ b/blenderkit/ui.py
@@ -1664,7 +1664,7 @@ class AssetBarOperator(bpy.types.Operator):
else:
return {'RUNNING_MODAL'}
- if event.type == 'W' and ui_props.active_index != -3:
+ if event.type == 'W' and ui_props.active_index > -1:
sr = bpy.context.scene['search results']
asset_data = sr[ui_props.active_index]
a = bpy.context.window_manager['bkit authors'].get(asset_data['author_id'])
@@ -1673,7 +1673,7 @@ class AssetBarOperator(bpy.types.Operator):
if a.get('aboutMeUrl') is not None:
bpy.ops.wm.url_open(url=a['aboutMeUrl'])
return {'RUNNING_MODAL'}
- if event.type == 'A' and ui_props.active_index != -3:
+ if event.type == 'A' and ui_props.active_index > -1:
sr = bpy.context.scene['search results']
asset_data = sr[ui_props.active_index]
a = asset_data['author_id']
@@ -1683,7 +1683,7 @@ class AssetBarOperator(bpy.types.Operator):
utils.p('author:', a)
search.search(author_id=a)
return {'RUNNING_MODAL'}
- if event.type == 'X' and ui_props.active_index != -3:
+ if event.type == 'X' and ui_props.active_index > -1:
sr = bpy.context.scene['search results']
asset_data = sr[ui_props.active_index]
print(asset_data['name'])
diff --git a/blenderkit/upload.py b/blenderkit/upload.py
index f2f295e5..980fbf7f 100644
--- a/blenderkit/upload.py
+++ b/blenderkit/upload.py
@@ -810,6 +810,17 @@ class AssetVerificationStatusChange(Operator):
def execute(self, context):
preferences = bpy.context.preferences.addons['blenderkit'].preferences
+ # update status in search results for validator's clarity
+ sr = bpy.context.scene['search results']
+ sro = bpy.context.scene['search results orig']['results']
+
+ for r in sr:
+ if r['id'] == self.asset_id:
+ r['verification_status'] = self.state
+ for r in sro:
+ if r['id'] == self.asset_id:
+ r['verificationStatus'] = self.state
+
thread = threading.Thread(target=verification_status_change_thread,
args=(self.asset_id, self.state, preferences.api_key))
thread.start()
More information about the Bf-extensions-cvs
mailing list