I am making this repetetive thing that I think would be nice to use a script for instead, so I wonder if anyone have an idea to help.
I have animated empties with names like HEAD, HEAD.001, HEAD.002
NECK, NECK.001, NECK.002 etc
I am stitching this animations to a longer animation, by copying the f-curves from HEAD.001 and HEAD.002 into the HEAD fcurves. Then I am adjusting them manually to get a nice blend between them.
The blending thing is ok to do manually so I have control, but the copy pasting would be nice to automate.
I would be really thankful for suggestions!
so you basically want to copy the keyframe_points of one fcurve to another?
Hi CoDEmanX! Yes, at a certain frame so it is adding to the animation.
For example, the Head empty has animation between frame 1-100, then I copy the f-curves from Head.001 that has animation between 101-200, and paste it into Head at frame 101. Then I copy Head.002 from 201-300 and paste into Head at frame 201 etc.
When I do it manually, I place markers where I want to paste them so I can jump quick, but it would of course be quicker to do this with code.
that should be possible, as long as you run that script via spacebar menu over graph editor. Otherwise the poll() check fails and one would have to write a low-level replacement (maybe not the worst idea, since bpy.ops.graph.copy() doesn’t take a frame argument, so we would have to change frame temporarily causing updates).
Dunno however how to indicate the right objects, which are the sources and which is the target…
I tried to go via the NLA editor instead, so I found some lines and filled some things in with my very limited python skills.
It works so it is making strips right after each others like I want to, but I wonder if anyone knows how to write that it should bake it to long actions. I think I somehow have to make all tracks active and then use bpy.ops.nla.bake()?
aa = [“EC_CLAVC7”,“EC_HEAD”,“EC_LELB”,“EC_LSHO”,“EC_RSHO”,“EC_Spine”,“EC_RELB”,“EC_LWR”,“EC_LHAN”,“EC_ROOT”,“EC_RWR”,“EC_RHAN”,“EC_LKNE”,“EC_RKNE”,“EC_RHEE”,“EC_LHEE”,“EC_RTOE”,“EC_LTOE”]
for a in aa:
action = a1.animation_data.action
newtrack = a1.animation_data.nla_tracks.new()
newtrack.name = "NLATRACK"
strip = newtrack.strips.new(name=action.name, start=f1, action=action)
action = a2.animation_data.action
strip = newtrack.strips.new(name=action.name, start=f2, action=action)
action = a3.animation_data.action
strip = newtrack.strips.new(name=action.name, start=f3, action=action)
action = a4.animation_data.action
strip = newtrack.strips.new(name=action.name, start=f4, action=action)
action = a5.animation_data.action
strip = newtrack.strips.new(name=action.name, start=f5, action=action)
Bake Action seems to sample (!!!) all actions, no matter if they are selected in NLA editor or not. Moreover, with “Selected only” and no objects selected, it still baked everything into a new action.