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-03-18 15:34:37 +0300
committerVilém Duha <vilda.novak@gmail.com>2020-03-18 15:34:49 +0300
commit6665bb9820c46c560420d3b5b2e5ab4c02e3125a (patch)
treefdb850f817c5f7113f36cc38f44bd6bd2c24336c /blenderkit
parente61a7e8bfe226aa1db7b5126f50cd9e7ba295239 (diff)
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
Diffstat (limited to 'blenderkit')
-rw-r--r--blenderkit/__init__.py3
-rw-r--r--blenderkit/search.py7
-rw-r--r--blenderkit/ui.py6
-rw-r--r--blenderkit/upload.py11
4 files changed, 22 insertions, 5 deletions
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()