Blender Kitsu: Use Background Thread for Kitsu Login #79
@ -21,6 +21,7 @@
|
||||
from typing import Dict, List, Set, Optional, Tuple, Any
|
||||
|
||||
import bpy
|
||||
import threading
|
||||
|
||||
from blender_kitsu import cache, prefs, gazu
|
||||
|
||||
@ -123,6 +124,12 @@ def auto_login_on_file_open():
|
||||
if not session.is_auth():
|
||||
bpy.ops.kitsu.session_start()
|
||||
|
||||
|
||||
# TODO move threading logic into kitsu.session_start() so all logins are BG threaded
|
||||
def thread_login():
|
||||
x = threading.Thread(target=auto_login_on_file_open, daemon=True)
|
||||
|
||||
|
||||
# ---------REGISTER ----------.
|
||||
|
||||
classes = [
|
||||
@ -139,7 +146,7 @@ def register():
|
||||
# it automatically un-registers after it runs.
|
||||
# FIXME: XXX This makes Blender hang if there is no Internet connectivity
|
||||
# TODO: Rewrite this, so the 'auto' login happens out of the main thread
|
||||
bpy.app.timers.register(auto_login_on_file_open, first_interval=0.2)
|
||||
bpy.app.timers.register(thread_login, first_interval=0.2)
|
||||
|
||||
|
||||
def unregister():
|
||||
|
Loading…
Reference in New Issue
Block a user