Post #2036: wh

📋 Metadata

🏷️ Tags

v1-18-8 popup-dialog node-groups advanced solved

  • Regular Menu
  • Custom Python Scripting
  • Popup Dialog Editor

💬 Content

whinton:

I was wondering if there is a way to access bpy.data.node_groups so that I could create a popup menu to quickly pull up different node trees in the node editor.

Each node editor has its own way to access the data. For example:
Change active animation node group:

C.space_data.node_tree = D.node_groups['Node Group Name']

Change active shader node group:

C.space_data.id_from.active_material = D.materials['Material Name']

To create a popup menu for animation nodes editor add a new Regular Menu with 1 slot and use this code in Custom tab (Tested in Blender 2.79):

[operator(L, "pme.exec", text=ng.name, icon='CHECKBOX_HLT' if C.space_data.node_tree == ng else 'CHECKBOX_DEHLT', cmd="C.space_data.node_tree = D.node_groups['%s']" % ng.name) for ng in D.node_groups]

❤️ 1 likes


🔗 View on Blender Artists