diff options
author | Vilem Duha <vilem.duha@gmail.com> | 2019-05-29 16:01:01 +0300 |
---|---|---|
committer | Vilem Duha <vilem.duha@gmail.com> | 2019-06-01 19:49:18 +0300 |
commit | 85fd48c32cbdb42f81b26bfb81d411d83e0898b0 (patch) | |
tree | bef0f8366dbe1aca4953cad20e87051468c36651 /blenderkit/download.py | |
parent | 88d0e75f1f35af1ea208565a6eb187162ed8451b (diff) |
BlenderKit: convert all imports to importlib
+ new Oauth script version (finished in next commit)
+split login/signup buttons
Diffstat (limited to 'blenderkit/download.py')
-rw-r--r-- | blenderkit/download.py | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/blenderkit/download.py b/blenderkit/download.py index 3eaa4e51..7bdbc3c4 100644 --- a/blenderkit/download.py +++ b/blenderkit/download.py @@ -16,23 +16,22 @@ # # ##### END GPL LICENSE BLOCK ##### +if "bpy" in locals(): + from importlib import reload + + paths = reload(paths) + append_link = reload(append_link) + utils = reload(utils) +else: + from blenderkit import paths, append_link, utils + import threading import time import requests -import shutil, sys, os, math -import random +import shutil, sys, os import uuid import copy -if "bpy" in locals(): - import imp - - imp.reload(paths) - imp.reload(append_link) - imp.reload(utils) - -else: - from blenderkit import paths, append_link, utils import bpy from bpy.props import ( IntProperty, @@ -492,7 +491,7 @@ def timer_update(): # TODO might get moved to handle all blenderkit stuff, not done = try_finished_append(asset_data, **tcom.passargs) if not done: at = asset_data['asset_type'] - tcom.passargs['retry_counter'] = tcom.passargs.get('retry_counter',0) +1 + tcom.passargs['retry_counter'] = tcom.passargs.get('retry_counter', 0) + 1 if at in ('model', 'material'): download(asset_data, **tcom.passargs) elif asset_data['asset_type'] == 'material': @@ -595,13 +594,12 @@ def download(asset_data, **kwargs): tcom = ThreadCom() tcom.passargs = kwargs - if kwargs.get('retry_counter',0) > 3: + if kwargs.get('retry_counter', 0) > 3: sprops = utils.get_search_props() sprops.report = f"Maximum retries exceeded for {asset_data['name']}" utils.p(sprops.report) return - # incoming data can be either directly dict from python, or blender id property # (recovering failed downloads on reload) if type(asset_data) == dict: |