Rule

0 installs · 0 said it worked

PatrickJS@patrickjs·
CodingRule· for Cursor

Rules for writing safe, well-structured Blender Python add-ons

Cursor rules guiding an AI assistant to build Blender Python add-ons with proper registration, operators, panels, properties, safe scene handling, and testing.

People use this for

  • blender python addon cursor rules
  • blender add-on operator panel template
  • blender addon registration unregister best practices
  • write blender python addon with ai
  • blender python plugin structure guidelines for ai assistant
Name
rules-for-writing-safe-well-structured-blender-python-add-ons
Works with
Cursor
License
CC0(as observed at the source)
Version
v1 · updated Nov 29, 2026
Imported · UnclaimedCC0

Imported on Nov 29, 2026 from github.com . License observed at the source on Nov 29, 2026: CC0.

Are you the author?Claim this profileRequest removal

Use this rule

$ curl -fsSL "https://promptcommunity.dev/api/v1/posts/rules-for-writing-safe-well-structured-blender-python-add-ons-nms3/export/mdc" -o .cursor/rules/rules-for-writing-safe-well-structured-blender-python-add-ons.mdc

Then open a new session; Cursor picks it up from .cursor/rules/.

Download rules-for-writing-safe-well-structured-blender-python-add-ons.mdc
Manual install

Save rules-for-writing-safe-well-structured-blender-python-add-ons.mdc as .cursor/rules/rules-for-writing-safe-well-structured-blender-python-add-ons.mdc for this project or ~/.cursor/rules/rules-for-writing-safe-well-structured-blender-python-add-ons.mdc for every project, then start a new session.

Rule


description: Blender Python add-on rules for operators, panels, properties, registration, testing, and API-safe scripting globs: ["**/*.py", "blender_manifest.toml", "init.py"] alwaysApply: false

Blender Python Add-on Rules

Add-on Structure

  • Keep add-on entry points in __init__.py with clear register() and unregister() functions.
  • Group operators, panels, properties, preferences, and utilities into separate modules for non-trivial add-ons.
  • Use bl_info or blender_manifest.toml according to the Blender version and packaging target.
  • Keep UI labels concise and user-facing text translatable where appropriate.

API Usage

  • Use bpy.types.Operator for actions, bpy.types.Panel for UI, and bpy.types.PropertyGroup for grouped settings.
  • Define bl_idname, bl_label, and bl_options explicitly.
  • Validate context in poll() before enabling operators.
  • Use invoke() for interactive setup and execute() for the actual operation.
  • Return {'FINISHED'} or {'CANCELLED'} consistently.
  • Use dependency graph updates and evaluated objects when reading final scene state.

Data and Properties

  • Register custom properties through PropertyGroup classes instead of loose global state.
  • Store add-on preferences in AddonPreferences.
  • Use PointerProperty, CollectionProperty, and typed properties with names and descriptions.
  • Clean up custom properties and handlers during unregister().

Safety and Performance

  • Do not run destructive scene operations without explicit user action.
  • Avoid blocking UI work in modal operators; use timers or modal state machines for long operations.
  • Batch mesh changes and use bmesh when editing mesh data programmatically.
  • Avoid repeatedly scanning large scenes in draw methods.
  • Keep file paths configurable and use Blender path utilities.

Testing and Debugging

  • Test scripts in a clean Blender profile and a representative production scene.
  • Add smoke tests that import the add-on, register it, run core operators, and unregister cleanly.
  • Log actionable messages with self.report() for user-facing operator feedback.
  • Keep version-specific API differences isolated behind helper functions.

Common Mistakes

  • Do not forget to unregister classes, handlers, timers, and keymaps.
  • Do not mutate Blender data from panel draw() methods.
  • Do not assume an active object, selected object, or mode without checking context.
  • Do not hardcode absolute asset paths.

No result recorded yet. Added it? File a Tried-it report so the next person knows how it went in your editor.

Tried it

Reports from people who added this rule to their editor. They roll up into the badges above.

No one has filed a report yet. Try the prompt and be the first.

License: CC0v1 · published Nov 29, 2026

Comments

No comments yet. If you tried this prompt, say how it went.