Post #518:
Ja
📋 Metadata
- Author: roaoao
- Date: 2017-02-16 09:33:32
- Type:
answer - Quality Score: 8/10
- Reply to: post_00517
- Replies (1): post_00522
🏷️ Tags
popup-dialog custom-widgets intermediate solved
⚙️ Related PME Features
- Popup Dialog Editor
- Custom Icons
- Python Scripting
💬 Content
Jakro:
Hi, I may be derping a little but I can’t seem to work out how to add a List Widget (I think that’s what it’s called) to a panel.
I can add the entire texture Atlas Panel but I can’t seem to work out how to just add the List part.
Hi, Jakro.
To add only list widget use this code in Custom tab (Popup Dialog):
L.template_list("UI_UL_list", "template_list_controls", C.scene, "ms_lightmap_groups", C.scene, "ms_lightmap_groups_index", rows=2, maxrows=5)
If you want to add the list with + and - buttons use this:
row = L.row(); row.template_list("UI_UL_list", "template_list_controls", C.scene, "ms_lightmap_groups", C.scene, "ms_lightmap_groups_index", rows=2, maxrows=5); col = row.column(True); col.operator("scene.ms_add_lightmap_group", icon='ZOOMIN', text=""); col.operator("scene.ms_del_lightmap_group", icon='ZOOMOUT', text="")
In most cases you can view the code used to draw widget. Click RMB on the widget (eg + button) and select “Edit Source”. The source will be added to Blender’s text editor.