【问题标题】:Is there a way to copy/paste action-keyframes with python script in Blender?有没有办法在 Blender 中使用 python 脚本复制/粘贴动作关键帧?
【发布时间】:2019-10-18 14:55:03
【问题描述】:

我有很多混合文件,每个文件也有很多动画(动作)。 我需要将所有动作的所有关键帧移动 15 帧,我可以这样做(对于许多文件的帮助 powershell):

    for action in bpy.data.actions: 
        for fcurve in action.fcurves:
            for point in fcurve.keyframe_points:
                point.co.x += 15.0

在脚本之前

脚本之后

这确实有效,问题是我需要将它们导出为 fbx, 所以在导出动画时它会忽略前 14 帧,因为它们是空的。我需要将第 15 帧复制/粘贴或复制到第 0 帧,以便在开始时获得静态动画(我将使用它在动画之间淡入淡出)。

这就是我想要的结果:

【问题讨论】:

    标签: python blender


    【解决方案1】:

    您可以 insert a new keyframe point 将帧设置为 1,并使用第一个关键帧的值。

    for action in bpy.data.actions:
        for fcurve in action.fcurves:
            fcurve.keyframe_points.insert(1, fcurve.keyframe_points[0].co.y)
    

    如果要复制或设置其他属性,插入返回新的keyframe

    【讨论】:

    • 这正是我想要的。现在我看到它不一定是复制和粘贴框架。我只需要前 15 帧是静态的,以改善其他软件中的某些过渡。我真的很感激这个答案,我一直在寻找一段时间。另外,我会阅读“关键帧”的参考资料,看看我还能做什么。
    • @JavierSantos 你可以找到更多花哨的关键帧here
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-04-12
    • 1970-01-01
    • 2010-09-11
    相关资源
    最近更新 更多