From 08082501c9a30c64f7b5c0556e8c473e8ee96b2d Mon Sep 17 00:00:00 2001 From: Yusarina Date: Mon, 28 Jul 2025 09:28:24 +0100 Subject: [PATCH] Broke it but this should fix it So thing stop working, fixed it. Also added basic accessory check which should close https://github.com/teamneoneko/Avatar-Toolkit/issues/170 Though it is basic it should get the job done for now unto we come up with a better solution. --- core/armature_validation.py | 49 +++++++++++++++++++++++-------------- 1 file changed, 30 insertions(+), 19 deletions(-) diff --git a/core/armature_validation.py b/core/armature_validation.py index 072b71f..7a72d7d 100644 --- a/core/armature_validation.py +++ b/core/armature_validation.py @@ -105,29 +105,40 @@ def validate_armature(armature: Object, detailed_messages: bool = False) -> Unio # Non-standard bones check non_standard_bones = [] - required_patterns = [ - 'Hips', 'Spine', 'Chest', 'Neck', 'Head', - 'Upper', 'Lower', 'Hand', 'Foot', 'Toe', - 'Thumb', 'Index', 'Middle', 'Ring', 'Pinky', - 'Eye' + + # Bones to ignore + ignore_patterns = [ + 'tail', 'skirt', 'dress', 'hair', 'ribbon', 'bow', 'hat', 'cap', + 'butt', 'breast', 'boob', 'chest_', 'belly', 'stomach', + 'wing', 'fin', 'horn', 'ear_', 'accessory', 'extra', + 'cloth', 'fabric', 'cape', 'coat', 'jacket', 'shirt', + 'pants', 'shoe', 'boot', 'sock', 'glove', 'mitten', + 'belt', 'strap', 'buckle', 'button', 'zipper', + 'jewel', 'gem', 'ring', 'necklace', 'earring', + 'flower', 'leaf', 'feather', 'fur', 'scale', + 'bangs', 'sideburn', 'bell', 'leash', 'ears', 'chain', + 'headband', 'necklace', 'necktie', 'strapNeck', 'ring', + 'pin', 'hair', + ] + # Create normalized lookup sets for faster comparison + normalized_standard_bones = {simplify_bonename(name) for name in standard_bones.values()} + normalized_acceptable_bones = set() + for names in acceptable_bone_names.values(): + normalized_acceptable_bones.update(simplify_bonename(name) for name in names) + for bone_name in found_bones: - if any(pattern in bone_name for pattern in required_patterns): - # Normalize bone name for comparison - normalized_bone_name = simplify_bonename(bone_name) - - # Check against normalized standard bones - normalized_standard_bones = [simplify_bonename(name) for name in standard_bones.values()] + # Normalize bone name for comparison + normalized_bone_name = simplify_bonename(bone_name) + + # Check if bone should be ignored (accessory bone) + is_ignored = any(pattern in normalized_bone_name for pattern in ignore_patterns) + + if not is_ignored: + # Check if bone is in standard or acceptable lists is_standard = normalized_bone_name in normalized_standard_bones - - # Check against normalized acceptable bones - is_acceptable_bone = False - for names in acceptable_bone_names.values(): - normalized_acceptable_names = [simplify_bonename(name) for name in names] - if normalized_bone_name in normalized_acceptable_names: - is_acceptable_bone = True - break + is_acceptable_bone = normalized_bone_name in normalized_acceptable_bones if not (is_standard or is_acceptable_bone): non_standard_bones.append(bone_name)