Post #4754: coll_1 = bpy.data.collections[“1head”]; coll_2 = bpy.data.collections[“2head”];

📋 Metadata

🏷️ Tags

macro python-scripting advanced unsolved

  • 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


🔗 View on Blender Artists