From d8015c348f04306f717427b1da6152abc473ba2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B0=8F=E7=85=9C?= <2082529121@qq.com> Date: Sat, 6 Dec 2025 21:07:54 +0800 Subject: [PATCH] feat(importing): Add pupil control bone tail positions and refine bone cleanup logic - Add tail position definitions for left and right pupil control bones (cf_J_hitomi_tx_L and cf_J_hitomi_tx_R) with Z-axis offset of 0.01 - Remove IK control bones (cf_pv_*) from must_keep_bones list for C model armature cleanup, as these are not needed in subsequent KKBP steps - Update must_keep_bones comments to clarify that IK control bones are intentionally excluded during C model processing - Improve logging message to explicitly indicate that deleted accessory bones include IK control bones - Add inline comments to pupil control bones in must_keep_bones list for better code documentation --- importing/modifyarmature.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/importing/modifyarmature.py b/importing/modifyarmature.py index ed6e7ee..2f7651d 100644 --- a/importing/modifyarmature.py +++ b/importing/modifyarmature.py @@ -258,6 +258,7 @@ better_fbx_bone_tails = { 'cf_J_Eye06_s_L': (0.0179830194, -0.0083362609, -0.0178645924), 'cf_J_Eye07_s_L': (0.0006974302, -0.0135568678, -0.0231180415), 'cf_J_Eye08_s_L': (-0.0155729428, -0.0184436664, -0.0195927024), + 'cf_J_hitomi_tx_L': (0.0, 0.0, 0.01), # 左眼瞳控制骨骼 'cf_J_Eye_txdam_R': (-0.0005300008, -0.0006456077, 0.0108191594), 'cf_J_Eye_tx_R': (-0.0005300008, -0.0006456077, 0.0108191594), 'cf_J_Eye_rz_R': (-0.0018717796, -0.0143385679, -0.007591337), @@ -270,6 +271,7 @@ better_fbx_bone_tails = { 'cf_J_Eye06_s_R': (-0.0179587901, -0.0083584338, -0.0178358555), 'cf_J_Eye07_s_R': (-0.0006720722, -0.0135397911, -0.0230915993), 'cf_J_Eye08_s_R': (0.0155643187, -0.018403694, -0.0196200199), + 'cf_J_hitomi_tx_R': (0.0, 0.0, 0.01), # 右眼瞳控制骨骼 'cf_J_Mayu_ty': (1.36853e-05, 0.0106744692, 0.0), 'cf_J_Mayumoto_L': (0.0005722754, -0.0010105595, 0.0111785308), 'cf_J_Mayu_L': (0.0005722754, -0.0010105595, 0.0111785308), @@ -498,20 +500,15 @@ class modify_armature(bpy.types.Operator): c.switch(armature, 'edit') # 定义必须保留的骨骼(即使不在 better_fbx_bone_tails 中) - # 这些是 KKBP 后续步骤需要的特殊骨骼 + # 注意:在 C 模式下,不保留 IK 控制骨骼(cf_pv_*) must_keep_bones = [ - 'cf_pv_root', # IK 根骨骼 - 'cf_pv_hand_L', 'cf_pv_hand_R', # 手部 IK - 'cf_pv_elbo_L', 'cf_pv_elbo_R', # 肘部 IK - 'cf_pv_foot_L', 'cf_pv_foot_R', # 脚部 IK - 'cf_pv_knee_L', 'cf_pv_knee_R', # 膝盖 IK 'cf_hit_head', # 头部碰撞 'p_cf_body_bone', # 身体骨骼 'p_cf_head_bone', # 头部骨骼 'a_n_back', # 背部锚点 'a_n_headside', # 头部侧面锚点 - 'cf_J_hitomi_tx_R', - 'cf_J_hitomi_tx_L', + 'cf_J_hitomi_tx_R', # 右眼瞳控制 + 'cf_J_hitomi_tx_L', # 左眼瞳控制 ] # 收集所有需要删除的骨骼(不在 better_fbx_bone_tails 中且不在必须保留列表中的) @@ -529,7 +526,7 @@ class modify_armature(bpy.types.Operator): armature.data.edit_bones.remove(armature.data.edit_bones[bone_name]) deleted_count += 1 - print(f"[KKBP] 已删除 {deleted_count} 个配饰骨骼") + print(f"[KKBP] 已删除 {deleted_count} 个配饰骨骼(包括 IK 控制骨骼)") print(f"[KKBP] 保留了 {len(better_fbx_bone_tails)} 个核心骨骼 + {len(must_keep_bones)} 个必需骨骼") c.switch(armature, 'object')