Post #4748: I see. What you’re calling a “Hint text” is referred to as an “Overlay” in PME.
📋 Metadata
- Author: Pluglug
- Date: 2023-06-14 18:16:56
- Type:
answer - Quality Score: 9/10
- Reply to: post_04747
🏷️ Tags
pie-menu scripting intermediate solved
⚙️ Related PME Features
- Pie Menu Editor
- Macro Editor
- Python Scripting
- Overlay functionality
💬 Content
I see. What you’re calling a “Hint text” is referred to as an “Overlay” in PME. When you look up the document, you can see that it can be used as overlay(text, **kwargs).
The description of the arguments in the document is concise, so let me add a bit to it:
- overlay(text, **kwargs)
Draw overlay message- text : The string to be displayed. It cannot be omitted.
- alignment : The position of the display. If omitted, it defaults to ‘TOP’. The available options are [‘TOP’, ‘TOP_LEFT’, ‘TOP_RIGHT’, ‘BOTTOM’, ‘BOTTOM_LEFT’, ‘BOTTOM_RIGHT’].
- duration : The duration until the text disappears. The default value is 2.0 seconds. You specify in decimal form.
- offset_x : Adjusts the position of the text along the x-axis. The default value is 10px. You specify in integer form.
- offset_y : Adjusts the position of the text along the y-axis. The default value is 10px. You specify in integer form.
Also, you cannot specify the size of the text. The value of PME Settings>Overlay tab>Font Size is used.
Here is an example of use in the command tab.
overlay(text='Hello', offset_y=100, duration=1.0)
Adding overlay() to the script to switch the shading light would look like this:
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)
The overlay() is actually the bpy.ops.pme.overlay() operator. If you’re interested in why you can use this operator as overlay(), call me again. It might be a long story…
❤️ 2 likes