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.
This commit is contained in:
+30
-19
@@ -105,29 +105,40 @@ def validate_armature(armature: Object, detailed_messages: bool = False) -> Unio
|
|||||||
|
|
||||||
# Non-standard bones check
|
# Non-standard bones check
|
||||||
non_standard_bones = []
|
non_standard_bones = []
|
||||||
required_patterns = [
|
|
||||||
'Hips', 'Spine', 'Chest', 'Neck', 'Head',
|
# Bones to ignore
|
||||||
'Upper', 'Lower', 'Hand', 'Foot', 'Toe',
|
ignore_patterns = [
|
||||||
'Thumb', 'Index', 'Middle', 'Ring', 'Pinky',
|
'tail', 'skirt', 'dress', 'hair', 'ribbon', 'bow', 'hat', 'cap',
|
||||||
'Eye'
|
'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:
|
for bone_name in found_bones:
|
||||||
if any(pattern in bone_name for pattern in required_patterns):
|
# Normalize bone name for comparison
|
||||||
# Normalize bone name for comparison
|
normalized_bone_name = simplify_bonename(bone_name)
|
||||||
normalized_bone_name = simplify_bonename(bone_name)
|
|
||||||
|
# Check if bone should be ignored (accessory bone)
|
||||||
# Check against normalized standard bones
|
is_ignored = any(pattern in normalized_bone_name for pattern in ignore_patterns)
|
||||||
normalized_standard_bones = [simplify_bonename(name) for name in standard_bones.values()]
|
|
||||||
|
if not is_ignored:
|
||||||
|
# Check if bone is in standard or acceptable lists
|
||||||
is_standard = normalized_bone_name in normalized_standard_bones
|
is_standard = normalized_bone_name in normalized_standard_bones
|
||||||
|
is_acceptable_bone = normalized_bone_name in normalized_acceptable_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
|
|
||||||
|
|
||||||
if not (is_standard or is_acceptable_bone):
|
if not (is_standard or is_acceptable_bone):
|
||||||
non_standard_bones.append(bone_name)
|
non_standard_bones.append(bone_name)
|
||||||
|
|||||||
Reference in New Issue
Block a user