I am currently working on integrating some assets into a custom engine. The engine relies on each animation being a separate action. The asset files I am working with however have all 50 animations "baked" into one singe "DefaultAction". I have resolved this issue in the past by simply copying the giant "DefaultAction" for every animation and removing the frames for the other animations. This however is rather tedious and time consuming.
I was wondering if the python api provided by blender contains the functionality required to be able to automate this task? For example, could I select the "DefaultAction" and then create multiple other actions based on the frames inside of "DefaultAction"?
Not looking for anyone to write this, just looking for confirmation that it is theoretically possible, and if so maybe a link to the classes of the api that could be used to do this. If it's doable I will see what I can put together and provide source for others as I believe this would be a valuable asset to have (since this isn't the first time I've run into this issue I suppose others have as well).
I have given this a shot and think I'm close, but am having dificulty finding the right method/procedure to use to actually remove the keyframe_point from the fcurve of the action:
import bpy base_action_name = "bend" sub_actions = [ ("sub_bend_001", 0, 14) ,("sub_bend_002", 15, 29) ] for a in sub_actions: new_action = bpy.data.actions.get(base_action_name).copy() new_action.name = a for fc in new_action.fcurves: i = 0 for kfp in fc.keyframe_points: if i < a or i > a: kfp.remove(kfp) # AttributeError: 'Keyframe' object has no attribute 'remove' i = i + 1
Anyone know how to remove keyframe_points from an fcurve?