diff options
author | Julien Duroure <julien.duroure@gmail.com> | 2019-02-27 22:19:29 +0300 |
---|---|---|
committer | Julien Duroure <julien.duroure@gmail.com> | 2019-02-27 22:19:29 +0300 |
commit | 0bbba588f7a5fcdf22107e82308b04462e696f3a (patch) | |
tree | a3818131945e42438addf537f697c7b8cf2f8a7c | |
parent | d2c8d118c1d54b223bdea383d108a05acff2c754 (diff) |
glTF: prevent lazy loading modules
-rwxr-xr-x | io_scene_gltf2/__init__.py | 24 | ||||
-rwxr-xr-x | io_scene_gltf2/io/com/gltf2_io_debug.py | 16 |
2 files changed, 17 insertions, 23 deletions
diff --git a/io_scene_gltf2/__init__.py b/io_scene_gltf2/__init__.py index c68e29eb..8f212b92 100755 --- a/io_scene_gltf2/__init__.py +++ b/io_scene_gltf2/__init__.py @@ -57,7 +57,6 @@ from bpy.props import (StringProperty, from bpy.types import Operator from bpy_extras.io_utils import ImportHelper, ExportHelper -from .io.com.gltf2_io_debug import Log # # Functions / Classes. @@ -431,11 +430,9 @@ class ImportGLTF2(Operator, ImportHelper): filter_glob: StringProperty(default="*.glb;*.gltf", options={'HIDDEN'}) - loglevel: EnumProperty( - items=Log.get_levels(), - name="Log Level", - description="Set level of log to display", - default=Log.default()) + loglevel: IntProperty( + name='Log Level', + description="Log Level") import_pack_images: BoolProperty( name='Pack images', @@ -454,7 +451,6 @@ class ImportGLTF2(Operator, ImportHelper): def draw(self, context): layout = self.layout - layout.prop(self, 'loglevel') layout.prop(self, 'import_pack_images') layout.prop(self, 'import_shading') @@ -466,6 +462,7 @@ class ImportGLTF2(Operator, ImportHelper): from .io.imp.gltf2_io_gltf import glTFImporter from .blender.imp.gltf2_blender_gltf import BlenderGlTF + self.set_debug_log() import_settings = self.as_keywords() self.gltf_importer = glTFImporter(self.filepath, import_settings) @@ -486,6 +483,19 @@ class ImportGLTF2(Operator, ImportHelper): return {'FINISHED'} + def set_debug_log(self): + import logging + if bpy.app.debug_value == 0: + self.loglevel = logging.CRITICAL + elif bpy.app.debug_value == 1: + self.loglevel = logging.ERROR + elif bpy.app.debug_value == 2: + self.loglevel = logging.WARNING + elif bpy.app.debug_value == 3: + self.loglevel = logging.INFO + else: + self.loglevel = logging.NOTSET + def menu_func_import(self, context): self.layout.operator(ImportGLTF2.bl_idname, text='glTF 2.0 (.glb/.gltf)') diff --git a/io_scene_gltf2/io/com/gltf2_io_debug.py b/io_scene_gltf2/io/com/gltf2_io_debug.py index b9098eba..8db70c0c 100755 --- a/io_scene_gltf2/io/com/gltf2_io_debug.py +++ b/io_scene_gltf2/io/com/gltf2_io_debug.py @@ -125,19 +125,3 @@ class Log: self.logger.addHandler(self.hdlr) self.logger.setLevel(int(loglevel)) - @staticmethod - def get_levels(): - levels = [ - (str(logging.CRITICAL), "Critical", "", logging.CRITICAL), - (str(logging.ERROR), "Error", "", logging.ERROR), - (str(logging.WARNING), "Warning", "", logging.WARNING), - (str(logging.INFO), "Info", "", logging.INFO), - (str(logging.NOTSET), "NotSet", "", logging.NOTSET) - ] - - return levels - - @staticmethod - def default(): - return str(logging.ERROR) - |