Skip to content

snippets: add gpu-draw-handler.py (viewport overlay with a removable draw handler) #500

Open

Description

@TMHSDigital

What

Add a snippet snippets/gpu-draw-handler.py: a viewport overlay that registers a SpaceView3D.draw_handler_add callback, keeps the handle, and removes it in unregister(). Draw one POLYLINE_UNIFORM_COLOR line with gpu.state.blend_set('ALPHA'), then restore 'NONE'.

Why

The gpu-drawing-and-overlays skill teaches this pattern, but there is no copy-paste snippet, and snippets are what people grab first.

How

  • Copy the "overlay pattern" block from skills/gpu-drawing-and-overlays/SKILL.md. Keep the snippet between 5 and 75 lines (tests/check_counts.py enforces the range).
  • Update the snippet count from 29 to 30 wherever python tests/check_counts.py reports it.
  • Run python tests/run_all.py, then open a PR.

No Blender install needed: snippets are syntax-checked in CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions