4
$\begingroup$

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.

$\endgroup$
2
  • $\begingroup$ 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). $\endgroup$ Commented Apr 27, 2017 at 21:27
  • $\begingroup$ 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. $\endgroup$ Commented Apr 28, 2017 at 0:17

1 Answer 1

5
$\begingroup$

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)
$\endgroup$
2
  • $\begingroup$ To nitpick, an object can have 2 active actions, a transform action and a shape key action: i.imgur.com/6u7CR5N.png :) But yes, action editor shows only the transform action, shape key editor shows the other one. $\endgroup$ Commented Sep 5, 2018 at 0:11
  • $\begingroup$ 'action' current action...'nla_tracks' list of actions ...everything wrong with blender summarized right here $\endgroup$
    – Phil
    Commented May 28, 2022 at 21:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .