2
$\begingroup$

I have 2 bones at the exact same location and in the same armature. I also have an action and a set of FCurves which are all assigned to the same bone.

Now i need to "move" the fcurves from that bone to the other bone. I first tried to simply edit the fcurve.data_path:

original path: 'pose.bones["mHipLeft"].location'
my edit      : fcurve.data_path='pose.bones["HipLeft"].location'

But this did not move the FCurve to the other bone. Possibly i made it wrong, or i forgot an update somewhere?

I also looked into the Blender API and i searched in the release/script folder but i could not find anything about "move an fcurve".

Now the only other idea that i have is to Create new FCurves, copy the data and then delete the original FCurves. But this looks like a lot of trouble. So before i go this way maybe someone knows an easier solution for this?

And in the case when the only option is to copy the FCurves, then is it sufficient to do the copy in this way? (I found this in the addon library):

def copyFCurve(newCurve, oldCurve):
    for point in oldCurve.keyframe_points:
        newCurve.keyframe_points.insert(frame=point.co.x, value=point.co.y)
$\endgroup$
2
$\begingroup$

I found that this moves an FCurve from one bone to another:

def moveFcurve(action, fromBone, toBone):
    for fc in [fc for fc in action.fcurves if fc.group.name == fromBone]:
        fc.group.name = toBone
        for channel in fc.group.channels:
            channel.data_path = channel.data_path.replace(fromBone, toBone)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.