Post #1086: ![](https://blenderartists.org/user_avatar/blenderartists.org/rhyging5/48/725092

📋 Metadata

  • Author: roaoao
  • Date: 2017-11-03 14:17:20
  • Type: answer
  • Quality Score: 8/10
  • Reply to: post_01085

🏷️ Tags

pie-menu custom-properties intermediate solved

  • Pie Menu Editor
  • Custom tab
  • Property tab
  • Python Scripting

💬 Content

rhyging5:

I would like to add some buttons of NLA editor ( like track name, action data,etc) but don’t know which code to use. I tried for example: C.animation_data.nla_tracks.active.strips.active.action
but don’t works, Can you help? many thanks in advance

Path to the name of the active nla track is:

C.active_object.animation_data.nla_tracks.active.name

You can use it in Property or Custom tab.

Looks like we don’t have access to the active strip from python. Fortunately we can find it.
Active strip name (Custom tab):

ao = C.active_object; ad = ao and ao.animation_data; at = ad and ad.nla_tracks.active; s = at and [s for s in at.strips if s.active]; s = s and s[0]; L.prop(s, "name", "") if s else L.column(True).label("No Active Strip")

Active action name (Custom tab):

ao = C.active_object; ad = ao and ao.animation_data; at = ad and  ad.nla_tracks.active; s = at and [s for s in at.strips if s.active]; s =  s and s[0]; a = s and s.action; L.prop(a, "name", "") if a else L.column(True).label("No  Action")

To add other buttons to your menu you need to replace “name” with identifier of the button (you can find it in tooltips).


🔗 View on Blender Artists