Merge branch 'Alpha-2' into Armature_Validation_Version2

This commit is contained in:
Yusarina
2025-02-07 18:43:00 +00:00
committed by GitHub
3 changed files with 21 additions and 10 deletions
-3
View File
@@ -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 #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 #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. #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. #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]] = {} old_list: dict[str,list[Material]] = {}
bool_material_list_expand: dict[str,bool] = {} bool_material_list_expand: dict[str,bool] = {}
@@ -46,7 +45,6 @@ class MaterialListBool:
if mat_slot.material: if mat_slot.material:
if mat_slot.material not in newlist: if mat_slot.material not in newlist:
newlist.append(mat_slot.material) newlist.append(mat_slot.material)
still_the_same: bool = True still_the_same: bool = True
if bpy.context.scene.name in MaterialListBool.old_list: if bpy.context.scene.name in MaterialListBool.old_list:
for item in newlist: for item in newlist:
@@ -60,7 +58,6 @@ class MaterialListBool:
else: else:
still_the_same = False still_the_same = False
MaterialListBool.bool_material_list_expand[bpy.context.scene.name] = still_the_same MaterialListBool.bool_material_list_expand[bpy.context.scene.name] = still_the_same
return MaterialListBool.bool_material_list_expand[bpy.context.scene.name] return MaterialListBool.bool_material_list_expand[bpy.context.scene.name]
class ProgressTracker: class ProgressTracker:
+8 -6
View File
@@ -4,6 +4,7 @@ from typing import Optional, Any
from bpy.types import Context from bpy.types import Context
logger = logging.getLogger('avatar_toolkit') logger = logging.getLogger('avatar_toolkit')
_original_error = logger.error
def configure_logging(enabled: bool = False) -> None: def configure_logging(enabled: bool = False) -> None:
"""Configure logging for Avatar Toolkit""" """Configure logging for Avatar Toolkit"""
@@ -16,15 +17,16 @@ def configure_logging(enabled: bool = False) -> None:
if enabled: if enabled:
handler = logging.StreamHandler() handler = logging.StreamHandler()
handler.setLevel(logging.DEBUG) 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) handler.setFormatter(formatter)
logger.addHandler(handler) logger.addHandler(handler)
# Override error logging to include traceback
def error_with_traceback(msg, *args, **kwargs): def error_with_traceback(msg, *args, **kwargs):
if kwargs.get('exc_info', False): if kwargs.get('exc_info', False) or isinstance(msg, Exception):
msg = f"{msg}\n{traceback.format_exc()}" full_msg = f"{msg}\n{traceback.format_exc()}"
logger.error(msg, *args, **kwargs) _original_error(full_msg, *args, **{**kwargs, 'exc_info': False})
else:
_original_error(msg, *args, **kwargs)
logger.error = error_with_traceback logger.error = error_with_traceback
@@ -33,4 +35,4 @@ def update_logging_state(self: Any, context: Context) -> None:
from .addon_preferences import save_preference from .addon_preferences import save_preference
enabled = self.enable_logging enabled = self.enable_logging
save_preference("enable_logging", enabled) save_preference("enable_logging", enabled)
configure_logging(enabled) configure_logging(enabled)
+13 -1
View File
@@ -396,6 +396,12 @@ class AvatarToolkitSceneProperties(PropertyGroup):
default=0 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( list_only_mode: BoolProperty(
name=t("Tools.list_only_mode"), name=t("Tools.list_only_mode"),
description=t("Tools.list_only_mode_desc"), description=t("Tools.list_only_mode_desc"),
@@ -522,7 +528,13 @@ class AvatarToolkitSceneProperties(PropertyGroup):
name="Show Hierarchy Issues", name="Show Hierarchy Issues",
default=False default=False
) )
merge_twist_bones: BoolProperty(
name=t("Tools.merge_twist_bones"),
description=t("Tools.merge_twist_bones_desc"),
default=True
)
def register() -> None: def register() -> None:
"""Register the Avatar Toolkit property group""" """Register the Avatar Toolkit property group"""
logger.info("Registering Avatar Toolkit properties") logger.info("Registering Avatar Toolkit properties")