Post #4881: The PME autorun folder is used to automatically execute scripts when Blender sta

📋 Metadata

  • Author: Pluglug
  • Date: 2023-11-08 09:34:47
  • Type: answer
  • Quality Score: 8/10
  • Reply to: post_04880

🏷️ Tags

macro scripting intermediate solved

  • Macro Editor
  • Python Scripting
  • autorun folder
  • overlay() function
  • Custom functionality registration

💬 Content

The PME autorun folder is used to automatically execute scripts when Blender starts, making sure that the functionality they provide is immediately available without any additional steps. By placing the script in this folder, it becomes part of your Blender startup routine.
PME Scripting Reference

In the case of status_notifier.py, utilizing PME’s autorun feature allowed me to implement its functionality seamlessly. It spared me from the more laborious process of registering it as a standalone addon. With PME, you can streamline your workflow, focusing on script functionality rather than the setup process.

To address your other questions:
Firstly, there seems to be a misunderstanding. status_notifier.py is not a function that is called by PME macros or anything else within PME. It simply adds a drawing handler when Blender is executed, and this handler isn’t something that you modify during Blender sessions.

If you’re looking to display overlay text when a PME macro starts, you can indeed use the previously mentioned overlay() function. You’d just execute this function at the beginning of your macro. While the message provided by status_notifier is persistent, overlay() presents a temporary message that fades away but should still serve your needs well.
image

For adding custom functionality in another scenario, you can register it with PME using code like pme.context.add_global(). Once registered, these can be used in PME’s Command and Custom tabs, or even from external scripts. Try searching this thread with the keyword “autorun” for more insights. I have provided scripts in the past for adding to pme.context.globals via autorun. They will surely serve as a useful reference.

PME Scripting Reference

(By the way, the overlay() function is also one of the objects registered with pme.context.globals. It’s added to PME’s source code ‘overlay.py’ at the end using add_global.)

Adam_Szalai:

The py You provided contains only the Boxcutter text display.

The script is currently specialized for displaying the status of Boxcutter, but this is just one example. By editing the generate_text_lines function, you can add text displays for other tools or statuses. The script is designed to be easily customizable to suit your needs and can be extended accordingly.


🔗 View on Blender Artists