Merge branch 'Alpha-2' into texture-atlas

This commit is contained in:
Yusarina
2025-02-07 18:38:12 +00:00
committed by GitHub
14 changed files with 896 additions and 45 deletions
+3 -3
View File
@@ -28,7 +28,7 @@ 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 +46,7 @@ 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 +60,7 @@ 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:
+69
View File
@@ -354,3 +354,72 @@ resonite_translations = {
'thumb_2_r': "thumb2.R",
'thumb_3_r': "thumb3.R"
}
rigify_unity_names = {
"DEF-spine": "Hips",
"DEF-spine.001": "Spine",
"DEF-spine.002": "Chest",
"DEF-spine.003": "UpperChest",
"DEF-neck": "Neck",
"DEF-head": "Head",
"DEF-shoulder.L": "LeftShoulder",
"DEF-upper_arm.L": "LeftUpperArm",
"DEF-forearm.L": "LeftLowerArm",
"DEF-hand.L": "LeftHand",
"DEF-shoulder.R": "RightShoulder",
"DEF-upper_arm.R": "RightUpperArm",
"DEF-forearm.R": "RightLowerArm",
"DEF-hand.R": "RightHand",
"DEF-thigh.L": "LeftUpperLeg",
"DEF-shin.L": "LeftLowerLeg",
"DEF-foot.L": "LeftFoot",
"DEF-toe.L": "LeftToes",
"DEF-thigh.R": "RightUpperLeg",
"DEF-shin.R": "RightLowerLeg",
"DEF-foot.R": "RightFoot",
"DEF-toe.R": "RightToes"
}
rigify_basic_unity_names = {
"spine": "Hips",
"spine.001": "Spine",
"spine.002": "Chest",
"spine.003": "UpperChest",
"neck": "Neck",
"head": "Head",
"shoulder.L": "LeftShoulder",
"upper_arm.L": "LeftUpperArm",
"forearm.L": "LeftLowerArm",
"hand.L": "LeftHand",
"shoulder.R": "RightShoulder",
"upper_arm.R": "RightUpperArm",
"forearm.R": "RightLowerArm",
"hand.R": "RightHand",
"thigh.L": "LeftUpperLeg",
"shin.L": "LeftLowerLeg",
"foot.L": "LeftFoot",
"toe.L": "LeftToes",
"thigh.R": "RightUpperLeg",
"shin.R": "RightLowerLeg",
"foot.R": "RightFoot",
"toe.R": "RightToes"
}
rigify_unnecessary_bones = [
'face',
'ear.l', 'ear.r',
'forehead',
'cheek.t.l', 'cheek.t.r',
'cheek.b.l', 'cheek.b.r',
'brow.t.l', 'brow.t.r',
'brow.b.l', 'brow.b.r',
'jaw',
'chin',
'nose',
'temple.l', 'temple.r',
'teeth',
'lip',
'lid',
'heel',
'pelvis.'
]
+8 -6
View File
@@ -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)
+48 -2
View File
@@ -18,6 +18,13 @@ from .common import get_armature_list, get_active_armature, get_all_meshes, Scen
from ..functions.visemes import VisemePreview
from ..functions.eye_tracking import set_rotation
class ZeroWeightBoneItem(PropertyGroup):
"""Property group for zero weight bone list items"""
name: StringProperty(name="Bone Name")
selected: BoolProperty(name="Selected", default=True)
has_children: BoolProperty(name="Has Children", default=False)
is_deform: BoolProperty(name="Is Deform Bone", default=False)
def update_validation_mode(self: PropertyGroup, context: Context) -> None:
"""Updates validation mode and saves preference"""
logger.info(f"Updating validation mode to: {self.validation_mode}")
@@ -361,6 +368,46 @@ class AvatarToolkitSceneProperties(PropertyGroup):
default=True
)
preserve_parent_bones: BoolProperty(
name=t("Tools.preserve_parent_bones"),
description=t("Tools.preserve_parent_bones_desc"),
default=True
)
target_bone_type: EnumProperty(
name=t("Tools.target_bone_type"),
description=t("Tools.target_bone_type_desc"),
items=[
('ALL', t("Tools.target_all_bones"), ""),
('DEFORM', t("Tools.target_deform_bones"), ""),
('NON_DEFORM', t("Tools.target_non_deform_bones"), "")
],
default='ALL'
)
zero_weight_bones: CollectionProperty(
type=ZeroWeightBoneItem,
name="Zero Weight Bones",
description="List of bones with zero weights"
)
zero_weight_bones_index: IntProperty(
name="Zero Weight Bone Index",
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"),
default=False
)
cleanup_shape_keys: BoolProperty(
name=t('MergeArmature.cleanup_shape_keys'),
description=t('MergeArmature.cleanup_shape_keys_desc'),
@@ -463,8 +510,7 @@ class AvatarToolkitSceneProperties(PropertyGroup):
type=SceneMatClass
)
def register() -> None:
"""Register the Avatar Toolkit property group"""
logger.info("Registering Avatar Toolkit properties")