Post #4977: I gained crucial insights from recovering a hallucination project. In the future
📋 Metadata
- Author: Pluglug
- Date: 2023-12-15 05:26:57
- Type:
answer - Quality Score: 7/10
- Reply to: post_04975
- Replies (1): post_04978
🏷️ Tags
popup-dialog scripting intermediate solved
⚙️ Related PME Features
- Popup Dialog Editor
- Macro Editor
- Python Scripting
💬 Content
I gained crucial insights from recovering a hallucination project. In the future, I can ‘avoid’ such situations.
Regarding your questions about the script’s functioning, I must admit that I am also just accepting the phenomenon, as I’m unable to provide a fundamental explanation. However, if you’re considering an implementation without using PME, Python offers more user-friendly and flexible options, such as context managers. Since version 3.2, bpy.context.temp_override() has been available, so I suggest looking into that. (I believe scripting discussions should be a separate topic, and someone more knowledgeable than me might be able to answer.)
As for your additional question, a simple if statement will do the job. In the case of PME, you’ll need to use a ternary operator for a one-liner. Here’s a straightforward example you could use in a custom tab slot:
ao = bpy.context.active_object; draw_menu("PopupDialog_for_tag1") if '_Tag1_' in ao.name else draw_menu("PopupDialog_for_tag2") if '_Tag2_' in ao.name else None
Regarding your inquiry about an implementation for non-auto-closing popup dialogs, I’m not aware of any. If you know of any addons that achieve this, please let me know.
❤️ 1 likes