2
$\begingroup$

I have this script, which does what i need with object actions.

import bpy

y_scale = 10

try:
    for fcu in bpy.context.object.animation_data.action.fcurves:
        if fcu.data_path == "location":
            for kp in fcu.keyframe_points:
                kp.co.y *= y_scale
                kp.handle_left.y *= y_scale
                kp.handle_right.y *= y_scale
except TypeError:
    pass

But i actually need to do this with armature bones. Can somebody modify this script to make it work with bones on all actions presented in armature?

$\endgroup$
3
  • 1
    $\begingroup$ if fcu.data_path.endswith("location"): would prob do it. The location data path for pose bones is pose.bones["Bone"].location for example with bone name: "Bone". $\endgroup$
    – batFINGER
    Commented Oct 15, 2016 at 6:13
  • $\begingroup$ It works now, thank you. How do i mark this answered? $\endgroup$ Commented Oct 15, 2016 at 9:52
  • $\begingroup$ Noting that the modified script is still viable in 2.8, and quickly fixes broken actions and pose libraries after applying an armature's scale. Great work! $\endgroup$
    – jackiejake
    Commented Jul 21, 2020 at 8:04

0

You must log in to answer this question.

Browse other questions tagged .