0
$\begingroup$

I'm making an addon for the NLA editor, and I need to know precisely which strips are selected in the NLA editor.

Unfortunately this means checking every single data object in the blend file, because there are 20 other data types with animation data to consider beside Objects - materials, nodetrees, armatures, worlds, etc...

The problem however is in telling whether or not one of these non-Objects are associated within the active scene, because if I have 5 scenes with NLA tracks in each one, I may have multiple NLA tracks selected in one scene's summary dopesheet, but I just want to know the selected nla strips in the active scene's summary dopesheet (ignoring filters and such).

Simply put, I need to know which non-Objects (ie, material, armature, world, etc) are associated with a scene in any way.

Any ideas?

$\endgroup$
  • $\begingroup$ Can you not make use of the "users" data recorded for each of these data types? I know users are recorded per file and not per scene and due to the purging method it sometimes reports false users but seems like a good starting place. $\endgroup$ – kheetor Mar 29 '19 at 18:34
0
$\begingroup$

I looked at Blender's source code and realised it was quite an ordeal for the dopesheet to filter objects relevant to a context, so I gave up any hope of a simple solution and just went about doing a ersatz version of it in python.

It's a bit of a mess, but it works for detecting most non-objects (and objects) with animation data in a context:

https://gist.github.com/hedgehog90/634ea03acd2a1d87f99fbb06857e1956

$\endgroup$

Your Answer

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

Not the answer you're looking for?Browse other questions tagged or ask your own question.