4

To clarify, say you have ten actions. You want to find all actions that Object1 is affected by. If that object is changed by even a single F-curve in a given action, that counts. Is there a way to do this via code?

If this isn't possible in the current version, I'm also considering a user solution in the form of a naming convention. For example, include the name of the target object in the action name, and that action is added to a list. But I'd prefer to be told that my initial approach isn't feasible before going about it that way.

Joshua King
  • 321
  • 4
  • 12
  • An object can only ever be assigned 1 action as far as I'm aware, so unless I'm misunderstanding, you would just check which action is assigned to it (if there is one). – Ray Mairlot Apr 27 '17 at 21:27
  • Do you mean to say an object can only ever have one active action? That's true. But there can be any number of inactive actions that manipulate a given object. What I'm asking is it there's a way to find all actions (active or inactive) that manipulate a specific object. That's I meant by actions an object is "involved" with. – Joshua King Apr 28 '17 at 00:17

1 Answers1

5

An object can have one active action, this is the one that is shown in the action editor. All other actions that affect an object can be found in the objects NLA data.

import bpy

for obj in bpy.context.scene.objects:
    ad = obj.animation_data
    if ad:
        if ad.action:
            print(obj.name,'uses',ad.action.name)
        for t in ad.nla_tracks:
            for s in t.strips:
                print(obj.name,'uses',s.action.name)
sambler
  • 55,387
  • 3
  • 59
  • 192
  • To nitpick, an object can have 2 active actions, a transform action and a shape key action: https://i.imgur.com/6u7CR5N.png :) But yes, action editor shows only the transform action, shape key editor shows the other one. – Manu Järvinen Sep 05 '18 at 00:11
  • 'action' current action...'nla_tracks' list of actions ...everything wrong with blender summarized right here – Phil May 28 '22 at 21:44