Post #4753: : post_04754, post_04755
🏷️ Tags
macro python-scripting intermediate unsolved
⚙️ Related PME Features
- Macro Editor
- Python Scripting
- Overlay/Text Display
💬 Content
Pluglug:
s = C.space_data.shading; s.light = 'MATCAP' if s.light == 'STUDIO' else 'STUDIO' if s.light == 'MATCAP' else None; overlay(f"{s.light.capitalize()} Mode", offset_y=100, duration=1.0)
Thank you very much,I just realized that PME can also add TEXT. And I have a more complicated code to switch head1 and head2 collection display alternately, I tried to write it as a line of code according to the example you gave but it didn’t work, and how to write the overlay code?
#display collection[head2] and show overlay “head2”
if bpy.data.collections["1head"].hide_viewport == False and bpy.data.collections["2head"].hide_viewport == False:
bpy.data.collections["2head"].hide_viewport = True
#display collection[head2] and show overlay “head2”
elif bpy.data.collections["1head"].hide_viewport == False and bpy.data.collections["2head"].hide_viewport == True:
bpy.data.collections["2head"].hide_viewport = False
bpy.data.collections["1head"].hide_viewport = True
#display collection[head1] and show overlay “head1”
elif bpy.data.collections["1head"].hide_viewport == True and bpy.data.collections["2head"].hide_viewport == False:
bpy.data.collections["1head"].hide_viewport = False
bpy.data.collections["2head"].hide_viewport = True