Post #4754: coll_1 = bpy.data.collections[“1head”]; coll_2 = bpy.data.collections[“2head”];
📋 Metadata
- Author: Pluglug
- Date: 2023-06-16 13:17:07
- Type:
discussion - Quality Score: 8/10
- Reply to: post_04753
- Replies (1): post_04757
🏷️ Tags
macro python-scripting advanced unsolved
⚙️ Related PME Features
- Macro Editor
- Python Scripting
- Overlay
💬 Content
coll_1 = bpy.data.collections[“1head”]; coll_2 = bpy.data.collections[“2head”]; coll_1.hide_viewport, coll_2.hide_viewport = not coll_1.hide_viewport and coll_2.hide_viewport , not coll_2.hide_viewport; bpy.ops.pme.overlay(text=coll_1.name if not coll_1.hide_viewport and coll_2.hide_viewport else coll_2.name if not coll_2.hide_viewport and coll_1.hide_viewport else "")
This works, but it’s incredibly complex and difficult to read. Moreover, it doesn’t consider the situation when both collections are hidden.
In this case, I would create a general-purpose function to switch the display status of the two collections and add it to pme.context.globals.
❤️ 1 likes