Post #2231: Wow, thanks. Didn’t know about this feature.

📋 Metadata

🏷️ Tags

v1-20-x macro scripting advanced solved

  • Macro Editor
  • Python Scripting
  • Pie Menu Editor
  • Popup Dialog Editor

💬 Content

Wow, thanks. Didn’t know about this feature.
Here is the code for the pie, menu or popup (Command tab, Blender 2.8+):

macro_name = "My Macro"; ao = C.active_object; ([(setattr(C.view_layer.objects, "active", o), open_menu(macro_name)) for o in C.selected_objects], setattr(C.view_layer.objects, "active", ao)) if E.alt else open_menu(macro_name)

Alt+Click a button to call the macro for all selected objects
Click to call it for the active object only.

Note that you can pass variables to your macro:

open_menu("My Macro", my_var1=111, my_var2=222)

❤️ 2 likes


🔗 View on Blender Artists