Macroman

by Kruithne in Addons


MacroMan provides a simple way to save, manage and run snippets of Python code - "macros" - in Blender. This is perfect for power-users who leverage the automation capabilities that the Python API in Blender provides without having to manage snippets in an external program or by reloading a boilerplate add-on.

  • Macros can be created and edited inside Blender using the default Text Editor panel, eliminating the need for any external script management.
  • Macros can be quickly accessed via a keybindable menu, or individually bound to dedicated keybindings of their own.
  • Macros are stored on disk as .py files for external editing/management/backup if desired.

How do I create a macro?
Open the "Text Editor" panel in Blender and click the "New Text" button at the top. Write or paste in the snippet you wish to create as a macro. The top two lines of the macro should designate an ID and a label for the macro, as shown below.



Once done, press the "Save Macro" button on the top-right of the editor, and you're done.

How do I run a macro that I've created?
There are three options, the first is to use the macro menu. To access this, you must first create a new keybinding bound to the wm.call_menu action with the name property set to SCREEN_MT_macroman_menu

Once bound, press the keybinding and a menu of macros will appear allowing you to quickly execute them.

The second option is to bind a macro you've created directly to a dedicated keybinding. To do this, create a keybinding with the action set to macro.my_macro_id where my_macro_id is the ID that you defined at the top of the macro.



Third and finally, you can directly call a macro through the API from another script, add-on, macro or terminal by using the bpy.ops prefix to the action shown above. For example, to invoke a macro with the ID my_example_macro, you would call bpy.ops.macro.example_macro()

How do I delete a macro that I've created?
To delete a macro, click the "Open Macro Folder" button on the "Text Editor" panel and delete the corresponding macro file. If your macro ID is my_example_macro, then the file will be my_example_macro.py. After deletion, click the "Reload Macros" button on the "Text Editor" panel or reload Blender.

Can I edit macros externally into another IDE or text editor?
Yes. Click the "Open Macro Folder" button on the "Text Editor" panel. Any files with the .py extension included in this directory will be considered macros providing they define an ID and a label as shown in the creation process above. After any macro files are added/edited, click the "Reload Macros" button and you'll be good to go.

What can macros do?
The short answer is: anything. Macros have full access to the Blender Python API, which means if you can think of it, then you can most likely automate it. A quick tip to get started is to enable "Python Tooltips" in Blender preferences. When hovering over any UI component in Blender, you will now see the Python API call, these can all be used in macros. The sky is the limit, and there are numerous resources on the internet for Python and the Blender API; get creative!


Are there any security concerns to consider?
Always use caution when running macros that you didn't write yourself. Macros have full access to the Python/Blender API just like any Blender add-on or third-party code snippet would, so as with everything you should be careful when running macros from any source.

$10

Have questions before purchasing?
Login to message

Details
Sales 40+
Published almost 3 years ago
Software Version 2.6x, 2.7x, 2.77, 2.78, 2.79, 2.8, 2.81, 2.82, 2.83, 2.9, 2.91, 2.92, 2.93, 3.0, 3.1, 3.2, 3.3, 3.4
License GPL
Discover more products like this

automation macro programming Python spring22 Scripting