BlenderKit: fix T84391
This issue was caused by wrong use of importlib, turns out this was wrong from the very beginning and that I never studied how reimporting of libs woks. Now the speed of script reload seems not to be influenced by BlenderKit anymore.
This commit is contained in:
parent
083251ec45
commit
82e528ea36
Notes:
blender-bot
2023-02-14 18:43:26 +01:00
Referenced by issue #84391, CTest/Addons: Blenderkit adds 4+ minutes to the script_load_addons test
|
@ -17,13 +17,7 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
utils = reload(utils)
|
||||
ui = reload(ui)
|
||||
else:
|
||||
from blenderkit import utils, ui
|
||||
from blenderkit import utils, ui
|
||||
|
||||
import bpy
|
||||
import uuid
|
||||
|
|
|
@ -17,12 +17,7 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
utils = reload(utils)
|
||||
else:
|
||||
from blenderkit import utils
|
||||
from blenderkit import utils
|
||||
|
||||
import bpy
|
||||
from object_print3d_utils import operators as ops
|
||||
|
|
|
@ -17,14 +17,7 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
paths = reload(paths)
|
||||
utils = reload(utils)
|
||||
bg_blender = reload(bg_blender)
|
||||
else:
|
||||
from blenderkit import paths, utils, bg_blender
|
||||
from blenderkit import paths, utils, bg_blender
|
||||
|
||||
import tempfile, os, subprocess, json, sys
|
||||
|
||||
|
@ -140,8 +133,6 @@ def start_thumbnailer(self, context):
|
|||
"thumbnail_denoising": bkit.thumbnail_denoising,
|
||||
}, s)
|
||||
|
||||
|
||||
|
||||
proc = subprocess.Popen([
|
||||
binary_path,
|
||||
"--background",
|
||||
|
@ -166,7 +157,7 @@ def start_thumbnailer(self, context):
|
|||
return {'FINISHED'}
|
||||
|
||||
|
||||
def start_material_thumbnailer(self, context, wait = False):
|
||||
def start_material_thumbnailer(self, context, wait=False):
|
||||
# Prepare to save the file
|
||||
mat = bpy.context.active_object.active_material
|
||||
mat.blenderkit.is_generating_thumbnail = True
|
||||
|
@ -215,7 +206,6 @@ def start_material_thumbnailer(self, context, wait = False):
|
|||
"texture_size_meters": bkit.texture_size_meters,
|
||||
}, s)
|
||||
|
||||
|
||||
proc = subprocess.Popen([
|
||||
binary_path,
|
||||
"--background",
|
||||
|
@ -276,7 +266,7 @@ class GenerateThumbnailOperator(bpy.types.Operator):
|
|||
message = "please save your file first"
|
||||
|
||||
def draw_message(self, context):
|
||||
self.layout.label(text = message)
|
||||
self.layout.label(text=message)
|
||||
|
||||
bpy.context.window_manager.popup_menu(draw_message, title=title, icon='INFO')
|
||||
return {'FINISHED'}
|
||||
|
@ -290,7 +280,6 @@ class GenerateMaterialThumbnailOperator(bpy.types.Operator):
|
|||
bl_label = "BlenderKit Material Thumbnail Generator"
|
||||
bl_options = {'REGISTER', 'INTERNAL'}
|
||||
|
||||
|
||||
@classmethod
|
||||
def poll(cls, context):
|
||||
return bpy.context.view_layer.objects.active is not None
|
||||
|
|
|
@ -17,14 +17,8 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
utils = reload(utils)
|
||||
append_link = reload(append_link)
|
||||
bg_blender = reload(bg_blender)
|
||||
else:
|
||||
from blenderkit import utils, append_link, bg_blender
|
||||
from blenderkit import utils, append_link, bg_blender
|
||||
|
||||
import sys, json, math
|
||||
import bpy
|
||||
|
|
|
@ -17,14 +17,8 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
utils = reload(utils)
|
||||
append_link = reload(append_link)
|
||||
bg_blender = reload(bg_blender)
|
||||
else:
|
||||
from blenderkit import utils, append_link, bg_blender
|
||||
from blenderkit import utils, append_link, bg_blender
|
||||
|
||||
import sys, json, math
|
||||
from pathlib import Path
|
||||
|
|
|
@ -16,12 +16,8 @@
|
|||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
utils = reload(utils)
|
||||
else:
|
||||
from blenderkit import utils
|
||||
from blenderkit import utils
|
||||
|
||||
import bpy
|
||||
import sys, threading, os
|
||||
|
|
|
@ -16,19 +16,8 @@
|
|||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
tasks_queue = reload(tasks_queue)
|
||||
utils = reload(utils)
|
||||
paths = reload(paths)
|
||||
search = reload(search)
|
||||
categories = reload(categories)
|
||||
oauth = reload(oauth)
|
||||
ui = reload(ui)
|
||||
ui = reload(ui_panels)
|
||||
else:
|
||||
from blenderkit import tasks_queue, utils, paths, search, categories, oauth, ui, ui_panels
|
||||
from blenderkit import tasks_queue, utils, paths, search, categories, oauth, ui, ui_panels
|
||||
|
||||
import bpy
|
||||
|
||||
|
|
|
@ -16,15 +16,8 @@
|
|||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
paths = reload(paths)
|
||||
utils = reload(utils)
|
||||
tasks_queue = reload(tasks_queue)
|
||||
rerequests = reload(rerequests)
|
||||
else:
|
||||
from blenderkit import paths, utils, tasks_queue, rerequests
|
||||
from blenderkit import paths, utils, tasks_queue, rerequests
|
||||
|
||||
import requests
|
||||
import json
|
||||
|
|
|
@ -16,19 +16,8 @@
|
|||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
paths = reload(paths)
|
||||
append_link = reload(append_link)
|
||||
utils = reload(utils)
|
||||
ui = reload(ui)
|
||||
colors = reload(colors)
|
||||
tasks_queue = reload(tasks_queue)
|
||||
rerequests = reload(rerequests)
|
||||
rerequests = reload(resolutions)
|
||||
else:
|
||||
from blenderkit import paths, append_link, utils, ui, colors, tasks_queue, rerequests, resolutions
|
||||
from blenderkit import paths, append_link, utils, ui, colors, tasks_queue, rerequests, resolutions
|
||||
|
||||
import threading
|
||||
import time
|
||||
|
|
|
@ -17,12 +17,7 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
utils = reload(utils)
|
||||
else:
|
||||
from blenderkit import utils
|
||||
from blenderkit import utils
|
||||
|
||||
import bpy, mathutils
|
||||
from bpy.types import (
|
||||
|
|
|
@ -16,15 +16,7 @@
|
|||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
paths = reload(paths)
|
||||
utils = reload(utils)
|
||||
rerequests = reload(rerequests)
|
||||
tasks_queue = reload(tasks_queue)
|
||||
else:
|
||||
from blenderkit import paths, utils, rerequests, tasks_queue
|
||||
from blenderkit import paths, utils, rerequests, tasks_queue
|
||||
|
||||
import bpy
|
||||
import requests, threading
|
||||
|
|
|
@ -16,16 +16,8 @@
|
|||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
ui = reload(ui)
|
||||
utils = reload(utils)
|
||||
paths = reload(paths)
|
||||
tasks_queue = reload(tasks_queue)
|
||||
bkit_oauth = reload(bkit_oauth)
|
||||
else:
|
||||
from blenderkit import ui, utils, paths, tasks_queue, bkit_oauth
|
||||
from blenderkit import ui, utils, paths, tasks_queue, bkit_oauth
|
||||
|
||||
import requests
|
||||
import bpy
|
||||
|
|
|
@ -17,20 +17,7 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
paths = reload(paths)
|
||||
append_link = reload(append_link)
|
||||
bg_blender = reload(bg_blender)
|
||||
utils = reload(utils)
|
||||
download = reload(download)
|
||||
search = reload(search)
|
||||
rerequests = reload(rerequests)
|
||||
upload_bg = reload(upload_bg)
|
||||
image_utils = reload(image_utils)
|
||||
else:
|
||||
from blenderkit import paths, append_link, bg_blender, utils, download, search, rerequests, upload_bg, image_utils
|
||||
from blenderkit import paths, append_link, bg_blender, utils, download, search, rerequests, upload_bg, image_utils
|
||||
|
||||
import sys, json, os, time
|
||||
import subprocess
|
||||
|
|
|
@ -17,22 +17,9 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
paths = reload(paths)
|
||||
utils = reload(utils)
|
||||
categories = reload(categories)
|
||||
ui = reload(ui)
|
||||
colors = reload(colors)
|
||||
bkit_oauth = reload(bkit_oauth)
|
||||
version_checker = reload(version_checker)
|
||||
tasks_queue = reload(tasks_queue)
|
||||
rerequests = reload(rerequests)
|
||||
resolutions = reload(resolutions)
|
||||
else:
|
||||
from blenderkit import paths, utils, categories, ui, colors, bkit_oauth, version_checker, tasks_queue, rerequests, \
|
||||
resolutions
|
||||
from blenderkit import paths, utils, categories, ui, colors, bkit_oauth, version_checker, tasks_queue, rerequests, \
|
||||
resolutions
|
||||
|
||||
import blenderkit
|
||||
from bpy.app.handlers import persistent
|
||||
|
|
|
@ -16,12 +16,8 @@
|
|||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
utils = reload(utils)
|
||||
else:
|
||||
from blenderkit import utils
|
||||
from blenderkit import utils
|
||||
|
||||
import bpy
|
||||
from bpy.app.handlers import persistent
|
||||
|
|
|
@ -17,24 +17,9 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
import importlib
|
||||
|
||||
paths = importlib.reload(paths)
|
||||
ratings = importlib.reload(ratings)
|
||||
utils = importlib.reload(utils)
|
||||
search = importlib.reload(search)
|
||||
upload = importlib.reload(upload)
|
||||
ui_bgl = importlib.reload(ui_bgl)
|
||||
download = importlib.reload(download)
|
||||
bg_blender = importlib.reload(bg_blender)
|
||||
colors = importlib.reload(colors)
|
||||
tasks_queue = importlib.reload(tasks_queue)
|
||||
ui_panels = importlib.reload(ui_panels)
|
||||
icons = importlib.reload(icons)
|
||||
else:
|
||||
from blenderkit import paths, ratings, utils, search, upload, ui_bgl, download, bg_blender, colors, tasks_queue, \
|
||||
ui_panels,icons
|
||||
from blenderkit import paths, ratings, utils, search, upload, ui_bgl, download, bg_blender, colors, tasks_queue, \
|
||||
ui_panels,icons
|
||||
|
||||
import bpy
|
||||
|
||||
|
|
|
@ -16,19 +16,8 @@
|
|||
#
|
||||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
if "bpy" in locals():
|
||||
import importlib
|
||||
|
||||
paths = importlib.reload(paths)
|
||||
ratings = importlib.reload(ratings)
|
||||
utils = importlib.reload(utils)
|
||||
download = importlib.reload(download)
|
||||
categories = importlib.reload(categories)
|
||||
icons = importlib.reload(icons)
|
||||
search = importlib.reload(search)
|
||||
resolutions = importlib.reload(resolutions)
|
||||
else:
|
||||
from blenderkit import paths, ratings, utils, download, categories, icons, search, resolutions
|
||||
from blenderkit import paths, ratings, utils, download, categories, icons, search, resolutions
|
||||
|
||||
from bpy.types import (
|
||||
Panel
|
||||
|
|
|
@ -17,27 +17,7 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
asset_inspector = reload(asset_inspector)
|
||||
paths = reload(paths)
|
||||
utils = reload(utils)
|
||||
bg_blender = reload(bg_blender)
|
||||
autothumb = reload(autothumb)
|
||||
version_checker = reload(version_checker)
|
||||
search = reload(search)
|
||||
ui_panels = reload(ui_panels)
|
||||
ui = reload(ui)
|
||||
overrides = reload(overrides)
|
||||
colors = reload(colors)
|
||||
rerequests = reload(rerequests)
|
||||
categories = reload(categories)
|
||||
upload_bg = reload(upload_bg)
|
||||
tasks_queue = reload(tasks_queue)
|
||||
image_utils = reload(image_utils)
|
||||
else:
|
||||
from blenderkit import asset_inspector, paths, utils, bg_blender, autothumb, version_checker, search, ui_panels, ui, \
|
||||
from blenderkit import asset_inspector, paths, utils, bg_blender, autothumb, version_checker, search, ui_panels, ui, \
|
||||
overrides, colors, rerequests, categories, upload_bg, tasks_queue, image_utils
|
||||
|
||||
import tempfile, os, subprocess, json, re
|
||||
|
|
|
@ -17,18 +17,8 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
paths = reload(paths)
|
||||
append_link = reload(append_link)
|
||||
bg_blender = reload(bg_blender)
|
||||
utils = reload(utils)
|
||||
rerequests = reload(rerequests)
|
||||
tasks_queue = reload(tasks_queue)
|
||||
ui = reload(ui)
|
||||
else:
|
||||
from blenderkit import paths, append_link, bg_blender, utils, rerequests, tasks_queue, ui
|
||||
from blenderkit import paths, append_link, bg_blender, utils, rerequests, tasks_queue, ui
|
||||
|
||||
import sys, json, os, time
|
||||
import requests
|
||||
|
|
|
@ -17,14 +17,7 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "bpy" in locals():
|
||||
from importlib import reload
|
||||
|
||||
paths = reload(paths)
|
||||
rerequests = reload(rerequests)
|
||||
|
||||
else:
|
||||
from blenderkit import paths, rerequests
|
||||
from blenderkit import paths, rerequests
|
||||
|
||||
import bpy
|
||||
from mathutils import Vector
|
||||
|
|
|
@ -17,12 +17,7 @@
|
|||
# ##### END GPL LICENSE BLOCK #####
|
||||
|
||||
|
||||
if "requests" in locals():
|
||||
from importlib import reload
|
||||
|
||||
paths = reload(paths)
|
||||
else:
|
||||
from blenderkit import paths
|
||||
from blenderkit import paths
|
||||
|
||||
import requests, os, json, threading
|
||||
|
||||
|
|
Loading…
Reference in New Issue