diff --git a/core/common.py b/core/common.py index c00fb43..95300d7 100644 --- a/core/common.py +++ b/core/common.py @@ -28,7 +28,6 @@ class MaterialListBool: #For the love that is holy do not ever touch these. If this was java I would make these private #They should only be accessed via context.scene.texture_atlas_Has_Mat_List_Shown #This is so we know if the materials are up to date. messing with these variables directly will make the thing blow up. - #The only exception to this is the ExpandSection_Materials operator which populates this with new data once the materials have changed and need reloading. old_list: dict[str,list[Material]] = {} bool_material_list_expand: dict[str,bool] = {} @@ -46,7 +45,6 @@ class MaterialListBool: if mat_slot.material: if mat_slot.material not in newlist: newlist.append(mat_slot.material) - still_the_same: bool = True if bpy.context.scene.name in MaterialListBool.old_list: for item in newlist: @@ -60,7 +58,6 @@ class MaterialListBool: else: still_the_same = False MaterialListBool.bool_material_list_expand[bpy.context.scene.name] = still_the_same - return MaterialListBool.bool_material_list_expand[bpy.context.scene.name] class ProgressTracker: diff --git a/core/logging_setup.py b/core/logging_setup.py index 2f65ce7..1cf2137 100644 --- a/core/logging_setup.py +++ b/core/logging_setup.py @@ -4,6 +4,7 @@ from typing import Optional, Any from bpy.types import Context logger = logging.getLogger('avatar_toolkit') +_original_error = logger.error def configure_logging(enabled: bool = False) -> None: """Configure logging for Avatar Toolkit""" @@ -16,15 +17,16 @@ def configure_logging(enabled: bool = False) -> None: if enabled: handler = logging.StreamHandler() handler.setLevel(logging.DEBUG) - formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s\n%(exc_info)s' if enabled else '%(message)s') + formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(formatter) logger.addHandler(handler) - # Override error logging to include traceback def error_with_traceback(msg, *args, **kwargs): - if kwargs.get('exc_info', False): - msg = f"{msg}\n{traceback.format_exc()}" - logger.error(msg, *args, **kwargs) + if kwargs.get('exc_info', False) or isinstance(msg, Exception): + full_msg = f"{msg}\n{traceback.format_exc()}" + _original_error(full_msg, *args, **{**kwargs, 'exc_info': False}) + else: + _original_error(msg, *args, **kwargs) logger.error = error_with_traceback @@ -33,4 +35,4 @@ def update_logging_state(self: Any, context: Context) -> None: from .addon_preferences import save_preference enabled = self.enable_logging save_preference("enable_logging", enabled) - configure_logging(enabled) + configure_logging(enabled) \ No newline at end of file diff --git a/core/properties.py b/core/properties.py index e6acdaa..b944662 100644 --- a/core/properties.py +++ b/core/properties.py @@ -396,6 +396,12 @@ class AvatarToolkitSceneProperties(PropertyGroup): default=0 ) + merge_twist_bones: BoolProperty( + name=t("Tools.merge_twist_bones"), + description=t("Tools.merge_twist_bones_desc"), + default=True + ) + list_only_mode: BoolProperty( name=t("Tools.list_only_mode"), description=t("Tools.list_only_mode_desc"), @@ -522,7 +528,13 @@ class AvatarToolkitSceneProperties(PropertyGroup): name="Show Hierarchy Issues", default=False ) - + + merge_twist_bones: BoolProperty( + name=t("Tools.merge_twist_bones"), + description=t("Tools.merge_twist_bones_desc"), + default=True + ) + def register() -> None: """Register the Avatar Toolkit property group""" logger.info("Registering Avatar Toolkit properties")