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>2019-09-04 15:39:22 +0300
committerVilém Duha <vilda.novak@gmail.com>2019-09-10 17:55:31 +0300
commit16299222c41de0bd77335cd0e97656edeb2090c3 (patch)
tree34d19c059c4c6f90008c63147a753f644d634524 /blenderkit/download.py
parent5f3c703ea4b0f4651e4f28e682a91382a90a5596 (diff)
BlenderKit: switch update functions to independent timers.
-seems to improve performance, and fixes assets not appending while asset bar is off.
Diffstat (limited to 'blenderkit/download.py')
-rw-r--r--blenderkit/download.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/blenderkit/download.py b/blenderkit/download.py
index 9f5f0314..3131ad10 100644
--- a/blenderkit/download.py
+++ b/blenderkit/download.py
@@ -402,9 +402,9 @@ def append_asset(asset_data, **kwargs): # downloaders=[], location=None,
shutil.copy(thumbpath, asset_thumb_path)
brush.icon_filepath = asset_thumb_path
- if bpy.context.sculpt_object:
+ if bpy.context.view_layer.objects.active.mode == 'SCULPT':
bpy.context.tool_settings.sculpt.brush = brush
- elif bpy.context.image_paint_object: # could be just else, but for future possible more types...
+ elif bpy.context.view_layer.objects.active.mode == 'TEXTURE_PAINT': # could be just else, but for future possible more types...
bpy.context.tool_settings.image_paint.brush = brush
# TODO set brush by by asset data(user can be downloading while switching modes.)
@@ -510,7 +510,7 @@ def timer_update(): # TODO might get moved to handle all blenderkit stuff, not
sres['downloaded'] = 100
utils.p('finished download thread')
- return .2
+ return .5
class Downloader(threading.Thread):
@@ -886,7 +886,7 @@ def register_download():
bpy.utils.register_class(BlenderkitKillDownloadOperator)
bpy.app.handlers.load_post.append(scene_load)
bpy.app.handlers.save_pre.append(scene_save)
- # bpy.app.timers.register(timer_update, persistent = True)
+ bpy.app.timers.register(timer_update, persistent = True)
def unregister_download():
@@ -894,4 +894,4 @@ def unregister_download():
bpy.utils.unregister_class(BlenderkitKillDownloadOperator)
bpy.app.handlers.load_post.remove(scene_load)
bpy.app.handlers.save_pre.remove(scene_save)
- # bpy.app.timers.unregister(timer_update)
+ bpy.app.timers.unregister(timer_update)