1
$\begingroup$

Iam trying to assign "ACTION1" and "ACTION2" to several objects.

This is my current code:

def copyAnim(animObj):
    context = bpy.context
    obj = bpy.data.objects[animObj]
    obs = [o for o in bpy.data.objects if o.name.startswith("object")]
    action = obj.animation_data.action
    print(obs)

    for ob in obs:
        if ob.animation_data:
            ob.animation_data.action = action.copy()
        else:
            ob.animation_data_create()
            ob.animation_data.action = action.copy()

copyAnim('Object_Holding_ACTION1')

But here is the Problem: if i want to add another action (with copyAnim('Object_Holding_ACTION2') ) "ACTION1" gets overwritten.

$\endgroup$
  • 1
    $\begingroup$ Overwritten? each object with name starting with "object" will be assigned a copy of the action on the object named "Object_Holding_ACTION2" $\endgroup$ – batFINGER Oct 24 '16 at 11:59
  • $\begingroup$ Yea, thats my problem. I want "ACTION1" and "ACTION2" both to affect the objects. $\endgroup$ – froggyman Oct 24 '16 at 12:41
  • 1
    $\begingroup$ Have a look at the NLA $\endgroup$ – batFINGER Oct 24 '16 at 12:59
  • $\begingroup$ I played around a bit with the NLA. It got almost all functionality i want, but i couldn't get overlapping animations to work. @batFINGER $\endgroup$ – froggyman Oct 24 '16 at 16:43

Your Answer

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

Browse other questions tagged or ask your own question.