Removed hardcoded bones names

This commit is contained in:
Yusarina
2025-08-03 16:33:51 +01:00
parent f90efb549a
commit b39e20e647
2 changed files with 14 additions and 93 deletions
+8 -8
View File
@@ -285,12 +285,12 @@ bone_names.update({
'head': bone_names['head'] + ['jbipchead', 'jhead', 'vrmhead', 'lefteye', 'righteye'], 'head': bone_names['head'] + ['jbipchead', 'jhead', 'vrmhead', 'lefteye', 'righteye'],
# VRM arms - both simplified patterns # VRM arms - both simplified patterns
'left_shoulder': bone_names['left_shoulder'] + ['jbipllshoulder', 'jlshoulder', 'jbiplshoulder', 'leftshoulder'], 'left_shoulder': bone_names['left_shoulder'] + ['jbipllshoulder', 'jlshoulder', 'jbiplshoulder', 'leftshoulder', 'jbipllclavicle'],
'left_arm': bone_names['left_arm'] + ['jbiplupperarm', 'jlupperarm', 'leftupperarm'], 'left_arm': bone_names['left_arm'] + ['jbiplupperarm', 'jlupperarm', 'leftupperarm'],
'left_elbow': bone_names['left_elbow'] + ['jbipllforearm', 'jlforearm', 'jbipllowerarm', 'leftlowerarm'], 'left_elbow': bone_names['left_elbow'] + ['jbipllforearm', 'jlforearm', 'jbipllowerarm', 'leftlowerarm'],
'left_wrist': bone_names['left_wrist'] + ['jbipllhand', 'jlhand', 'jbiplhand', 'lefthand'], 'left_wrist': bone_names['left_wrist'] + ['jbipllhand', 'jlhand', 'jbiplhand', 'lefthand'],
'right_shoulder': bone_names['right_shoulder'] + ['jbiprlshoulder', 'jrshoulder', 'jbiprshoulder', 'rightshoulder'], 'right_shoulder': bone_names['right_shoulder'] + ['jbiprlshoulder', 'jrshoulder', 'jbiprshoulder', 'rightshoulder', 'jbiprrclavicle'],
'right_arm': bone_names['right_arm'] + ['jbiprrupperarm', 'jrupperarm', 'jbiprupperarm', 'rightupperarm'], 'right_arm': bone_names['right_arm'] + ['jbiprrupperarm', 'jrupperarm', 'jbiprupperarm', 'rightupperarm'],
'right_elbow': bone_names['right_elbow'] + ['jbiprrforearm', 'jrforearm', 'jbiprforearm', 'jbiprlowerarm', 'rightlowerarm'], 'right_elbow': bone_names['right_elbow'] + ['jbiprrforearm', 'jrforearm', 'jbiprforearm', 'jbiprlowerarm', 'rightlowerarm'],
'right_wrist': bone_names['right_wrist'] + ['jbiprrhand', 'jrhand', 'jbiprhand', 'righthand'], 'right_wrist': bone_names['right_wrist'] + ['jbiprrhand', 'jrhand', 'jbiprhand', 'righthand'],
@@ -314,12 +314,12 @@ bone_names.update({
'jaw': ['jaw', 'mandible', 'lowerjaw', 'chin', 'あご', 'ik_あご'], 'jaw': ['jaw', 'mandible', 'lowerjaw', 'chin', 'あご', 'ik_あご'],
# Breast bones # Breast bones
'breast_1_l': bone_names['breast_1_l'] + ['jbipcbreast1l', 'jlbreast1'], 'breast_1_l': bone_names['breast_1_l'] + ['jbipcbreast1l', 'jlbreast1', 'jseclbust1'],
'breast_2_l': bone_names['breast_2_l'] + ['jbipcbreast2l', 'jlbreast2'], 'breast_2_l': bone_names['breast_2_l'] + ['jbipcbreast2l', 'jlbreast2', 'jseclbust2'],
'breast_3_l': bone_names['breast_3_l'] + ['jbipcbreast3l', 'jlbreast3'], 'breast_3_l': bone_names['breast_3_l'] + ['jbipcbreast3l', 'jlbreast3', 'jseclbust3'],
'breast_1_r': bone_names['breast_1_r'] + ['jbipcbreast1r', 'jrbreast1'], 'breast_1_r': bone_names['breast_1_r'] + ['jbipcbreast1r', 'jrbreast1', 'jsecrbust1'],
'breast_2_r': bone_names['breast_2_r'] + ['jbipcbreast2r', 'jrbreast2'], 'breast_2_r': bone_names['breast_2_r'] + ['jbipcbreast2r', 'jrbreast2', 'jsecrbust2'],
'breast_3_r': bone_names['breast_3_r'] + ['jbipcbreast3r', 'jrbreast3'], 'breast_3_r': bone_names['breast_3_r'] + ['jbipcbreast3r', 'jrbreast3', 'jsecrbust3'],
# VRM fingers - Left (including Little finger variations) # VRM fingers - Left (including Little finger variations)
'thumb_0_l': bone_names['thumb_0_l'] + ['jbipllthumb0', 'jlthumb0', 'jbipllthumbmetacarpal', 'jlthumbmetacarpal', 'leftthumbmetacarpal'], 'thumb_0_l': bone_names['thumb_0_l'] + ['jbipllthumb0', 'jlthumb0', 'jbipllthumbmetacarpal', 'jlthumbmetacarpal', 'leftthumbmetacarpal'],
+6 -85
View File
@@ -85,94 +85,15 @@ def find_vrm_bones_in_armature(armature: Object) -> Dict[str, str]:
def guess_unity_name_from_vrm(vrm_simplified: str) -> Optional[str]: def guess_unity_name_from_vrm(vrm_simplified: str) -> Optional[str]:
""" """
Attempt to guess Unity bone name from VRM simplified name Attempt to guess Unity bone name from VRM simplified name using dictionary lookup
""" """
# Map common VRM patterns to Unity equivalents if vrm_simplified in reverse_bone_lookup:
pattern_mappings = { standard_bone_key = reverse_bone_lookup[vrm_simplified]
'jbipcupperchest': 'UpperChest',
'jbipcchest': 'Chest',
'jbipcspine': 'Spine',
'jbipchips': 'Hips',
'jbipcneck': 'Neck',
'jbipchead': 'Head',
# Left arm if standard_bone_key in standard_bones:
'jbipllclavicle': 'LeftShoulder', return standard_bones[standard_bone_key]
'jbipllshoulder': 'LeftShoulder',
'jbiplshoulder': 'LeftShoulder',
'jbiplupperarm': 'LeftUpperArm',
'jbipllforearm': 'LeftLowerArm',
'jbipllowerarm': 'LeftLowerArm',
'jbipllhand': 'LeftHand',
'jbiplhand': 'LeftHand',
# Right arm (both single and double R patterns) return None
'jbiprrclavicle': 'RightShoulder',
'jbiprlshoulder': 'RightShoulder',
'jbiprshoulder': 'RightShoulder',
'jbiprupperarm': 'RightUpperArm',
'jbiprrupperarm': 'RightUpperArm',
'jbiprforearm': 'RightLowerArm',
'jbiprrforearm': 'RightLowerArm',
'jbiprlowerarm': 'RightLowerArm',
'jbiprhand': 'RightHand',
'jbiprrhand': 'RightHand',
# Left leg
'jbiplupperleg': 'LeftUpperLeg',
'jbipllowerleg': 'LeftLowerLeg',
'jbipllfoot': 'LeftFoot',
'jbiplfoot': 'LeftFoot',
'jbiplltoe': 'LeftToes',
'jbipltoebase': 'LeftToes',
# Right leg (both single and double R patterns)
'jbiprupperleg': 'RightUpperLeg',
'jbiprrupperleg': 'RightUpperLeg',
'jbiprlowerleg': 'RightLowerLeg',
'jbiprrlowerleg': 'RightLowerLeg',
'jbiprfoot': 'RightFoot',
'jbiprrfoot': 'RightFoot',
'jbiprtoe': 'RightToes',
'jbiprrtoe': 'RightToes',
'jbiprtoebase': 'RightToes',
# Eyes
'jbipcleye': 'LeftEye',
'jbipcreye': 'RightEye',
'jadjlfaceeye': 'LeftEye',
'jadjrfaceeye': 'RightEye',
# Fingers - Left
'jbiplthumb1': 'LeftThumb1',
'jbiplthumb2': 'LeftThumb2',
'jbiplthumb3': 'LeftThumb3',
'jbiplindex1': 'LeftIndex1',
'jbiplindex2': 'LeftIndex2',
'jbiplindex3': 'LeftIndex3',
'jbiplmiddle1': 'LeftMiddle1',
'jbiplmiddle2': 'LeftMiddle2',
'jbiplmiddle3': 'LeftMiddle3',
'jbiplring1': 'LeftRing1',
'jbiplring2': 'LeftRing2',
'jbiplring3': 'LeftRing3',
'jbipllittle1': 'LeftPinky1',
'jbipllittle2': 'LeftPinky2',
'jbipllittle3': 'LeftPinky3',
'jbiprlittle1': 'RightPinky1',
'jbiprlittle2': 'RightPinky2',
'jbiprlittle3': 'RightPinky3',
# Breast bones
'jseclbust1': 'Breast1_L',
'jseclbust2': 'Breast2_L',
'jseclbust3': 'Breast3_L',
'jsecrbust1': 'Breast1_R',
'jsecrbust2': 'Breast2_R',
'jsecrbust3': 'Breast3_R'
}
return pattern_mappings.get(vrm_simplified)
def is_vrm_collider_object(obj_name: str) -> bool: def is_vrm_collider_object(obj_name: str) -> bool: