Post #2036:
wh
📋 Metadata
- Author: roaoao
- Date: 2019-03-15 06:40:11
- Type:
answer - Quality Score: 9/10
- Reply to: post_02034
- Replies (1): post_02037
🏷️ Tags
v1-18-8 popup-dialog node-groups advanced solved
⚙️ Related PME Features
- 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