Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions wwut.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import glob
from bpy.props import StringProperty, FloatVectorProperty
from bpy.types import Operator, Panel
from bpy_extras import anim_utils
from mathutils import Vector, Quaternion

# 插件的基本信息
Expand Down Expand Up @@ -37,7 +38,10 @@ def delete_keyframes_by_prefix(prefix, report_func):
return 0

# 获取所有动画曲线
fcurves = action.fcurves
slot = armature.animation_data.action_slot
channelbag = anim_utils.action_get_channelbag_for_slot(action, slot)
fcurves = channelbag.fcurves
# fcurves = action.fcurves
to_remove = []

# 遍历所有动画曲线
Expand Down Expand Up @@ -905,15 +909,19 @@ def execute(self, context):
action = shape_keys.animation_data.action

# 获取所有形态键相关的动画曲线
slot = shape_keys.animation_data.action_slot
channelbag = anim_utils.action_get_channelbag_for_slot(action, slot)
fcurves = channelbag.fcurves

fcurves_to_remove = []
for fcurve in action.fcurves:
for fcurve in fcurves:
# 检查是否是形态键相关的数据路径
if fcurve.data_path.startswith("key_blocks["):
fcurves_to_remove.append(fcurve)

# 删除找到的动画曲线
for fcurve in fcurves_to_remove:
action.fcurves.remove(fcurve)
fcurves.remove(fcurve)

if fcurves_to_remove:
self.report({'INFO'}, f"已清除 {len(fcurves_to_remove)} 个形态键关键帧")
Expand Down Expand Up @@ -981,7 +989,10 @@ def execute(self, context):
return {'CANCELLED'}

# 获取所有动画曲线
fcurves = action.fcurves
slot = armature.animation_data.action_slot
channelbag = anim_utils.action_get_channelbag_for_slot(action, slot)
fcurves = channelbag.fcurves
# fcurves = action.fcurves

# 统计修改的关键帧数量
modified_keyframes = 0
Expand Down