Post #1149: Wa

📋 Metadata

🏷️ Tags

python-scripting intermediate solved

  • Python Scripting
  • Macro Editor
  • Overlay messaging

💬 Content

Way2Close:

Heya, So I am using:

overlay(“Add Cube”, duration=1.5); bpy.ops.mesh.primitive_cube_add()

and I just realized if I do this I can’t use redo afterwards, Is there a way to print to the overlay and be able to redo?

Try to add undo positional argument (True) and execution context (INVOKE_DEFAULT):

overlay("Add Cube", duration=1.5); bpy.ops.mesh.primitive_cube_add('INVOKE_DEFAULT', True)

Undo flag enables redo features.
INVOKE_DEFAULT flag executes operator in interactive mode (if exists).

PME uses them by default when there is only one operator in the code.
In this case you need to add them manually.

Way2Close:

(the overlay() doesn’t work with modal operators either)

Yes, modal operators use this feature and can override messages.
Not sure how to fix this, but I’ll try.


🔗 View on Blender Artists