glTF export: Add logging level control for export

This was already the case at import
This commit is contained in:
Julien Duroure 2024-08-30 06:48:07 +02:00
parent 4dad2a567d
commit 11451a2082
Notes: blender-bot 2024-11-13 18:11:56 +01:00
Referenced by issue #124452, Blender LTS: Maintenance Task 4.2

View File

@ -5,7 +5,7 @@
bl_info = {
'name': 'glTF 2.0 format',
'author': 'Julien Duroure, Scurest, Norbert Nopper, Urs Hanselmann, Moritz Becher, Benjamin Schmithüsen, Jim Eckerlein, and many external contributors',
"version": (4, 3, 21),
"version": (4, 3, 22),
'blender': (4, 2, 0),
'location': 'File > Import-Export',
'description': 'Import-Export as glTF 2.0',
@ -163,6 +163,20 @@ def is_draco_available():
return is_draco_available.draco_exists
def set_debug_log():
import logging
if bpy.app.debug_value == 0: # Default values => Display all messages except debug ones
return logging.INFO
elif bpy.app.debug_value == 1:
return logging.WARNING
elif bpy.app.debug_value == 2:
return logging.ERROR
elif bpy.app.debug_value == 3:
return logging.CRITICAL
elif bpy.app.debug_value == 4:
return logging.DEBUG
class ConvertGLTF2_Base:
"""Base class containing options that should be exposed during both import and export."""
@ -1051,7 +1065,7 @@ class ExportGLTF2_Base(ConvertGLTF2_Base):
# All custom export settings are stored in this container.
export_settings = {}
export_settings['loglevel'] = logging.INFO
export_settings['loglevel'] = set_debug_log()
export_settings['exported_images'] = {}
export_settings['exported_texture_nodes'] = []
@ -1865,7 +1879,7 @@ class ImportGLTF2(Operator, ConvertGLTF2_Base, ImportHelper):
def import_gltf2(self, context):
import os
self.set_debug_log()
self.loglevel = set_debug_log()
import_settings = self.as_keywords()
user_extensions = []
@ -1924,19 +1938,6 @@ class ImportGLTF2(Operator, ConvertGLTF2_Base, ImportHelper):
self.report({'ERROR'}, e.args[0])
return {'CANCELLED'}
def set_debug_log(self):
import logging
if bpy.app.debug_value == 0: # Default values => Display all messages except debug ones
self.loglevel = logging.INFO
elif bpy.app.debug_value == 1:
self.loglevel = logging.WARNING
elif bpy.app.debug_value == 2:
self.loglevel = logging.ERROR
elif bpy.app.debug_value == 3:
self.loglevel = logging.CRITICAL
elif bpy.app.debug_value == 4:
self.loglevel = logging.DEBUG
def import_bone_panel(layout, operator):
header, body = layout.panel("GLTF_import_bone", default_closed=False)