Post #4924: I intended to present a simple example of using PME Property, but it turned out

📋 Metadata

🏷️ Tags

macro properties intermediate advanced

  • Macro Editor
  • Property Editor
  • Python Scripting

💬 Content

I intended to present a simple example of using PME Property, but it turned out to be a bit complex. However, in this example, I didn’t use PME Property’s Getter or Setter, nor did I Store it in Pref. It’s just about creating an option for a single macro.

PME_NameMod.json (2.8 KB)

What I’ve created this time is a macro that adds a chosen prefix or suffix to the name of a selected object. It utilizes three properties:

  1. nm_str_presuf: The text to be added.
  2. nm_enum_presuf: Choose whether to add the text as a prefix or suffix.
  3. nm_reset_after_use: Choose whether to delete the text entered in nm_str_presuf after renaming.

These properties are used in the macro “NM_Add PreSuf To Selected Obj”.

I believe this serves as a straightforward example of utilizing properties within a macro. Take a peek inside the macro; you’ll find the ternary operators and list comprehensions commonly used in PME. This might be a bit challenging, so feel free to reach out to me if you plan to apply it.

SimpleNameMod.py (2.4 KB)

I got carried away and turned it into an addon (there’s no keymap. Please search for “NameMod” using F3). It functions exactly like its PME implementation. It also has three properties and shows a popup upon execution. While PME implementations require the code to be written in one line, a general script has better readability, even for those with minimal knowledge. If you’re interested, I invite you to compare both.

The examples above are just one way to utilize PME Property. These explanations are not detailed guides on specific implementations, but rather to showcase the potential of PME Property. When thinking of new features or ideas in Blender, keeping in mind the three basic concepts of sequential progression, conditional branching, and repetition can help materialize most ideas.

If you have any ideas, please feel free to reach out to me.


❤️ 3 likes


🔗 View on Blender Artists