惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
NISL@THU
NISL@THU
The Hacker News
The Hacker News
C
CXSECURITY Database RSS Feed - CXSecurity.com
T
Tenable Blog
Forbes - Security
Forbes - Security
V2EX - 技术
V2EX - 技术
Webroot Blog
Webroot Blog
Schneier on Security
Schneier on Security
T
The Exploit Database - CXSecurity.com
T
Tor Project blog
C
Cisco Blogs
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
PCI Perspectives
PCI Perspectives
O
OpenAI News
C
Cyber Attacks, Cyber Crime and Cyber Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Google Online Security Blog
Google Online Security Blog
宝玉的分享
宝玉的分享
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
量子位
D
Docker
AI
AI
Blog — PlanetScale
Blog — PlanetScale
S
Security @ Cisco Blogs
S
Schneier on Security
The GitHub Blog
The GitHub Blog
W
WeLiveSecurity
云风的 BLOG
云风的 BLOG
M
MIT News - Artificial intelligence
P
Privacy International News Feed
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
H
Hackread – Cybersecurity News, Data Breaches, AI and More
B
Blog
C
Check Point Blog
A
About on SuperTechFans
D
Darknet – Hacking Tools, Hacker News & Cyber Security
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Engineering at Meta
Engineering at Meta
I
InfoQ
T
Threat Research - Cisco Blogs
Project Zero
Project Zero
Cloudbric
Cloudbric
MongoDB | Blog
MongoDB | Blog
Cisco Talos Blog
Cisco Talos Blog
L
Lohrmann on Cybersecurity
S
Securelist

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
I put Claude inside Blender's Text Editor
Pawel Piecuc · 2026-05-02 · via DEV Community

I got tired of the alt-tab loop. Write a Blender script. Hit an error. Switch to a browser. Paste the traceback to Claude. Copy the fix back. Re-run. Repeat.

So I built Claude Code for Blender, an extension that puts Claude in the Text Editor's sidebar with the active script as automatic context, scene-aware tools, and the ability to actually run the Python it generates. Here's what I learned building it.

The shape of the thing

The extension is pure Python — no native dependencies, no build step. About 5,200 lines across 12 files, packaged as a Blender 4.2+ extension manifest. You drop the folder into your extensions directory, enable it in preferences, hit N in the Text Editor, and Claude shows up next to your code.

Two things made it more than a chat wrapper:

  1. Claude can run code in your Blender session — with undo support, and if the code raises an exception, the traceback gets sent back automatically and Claude tries again.
  2. Claude can edit your text blocks as if they were files on disk — not by generating diffs you copy-paste, but by actually opening and writing them.

The second part is where the interesting engineering lives.

Two backends, one UI

I shipped with two backends and a toggle to switch between them:

  • CLI backend — shells out to claude -p (the Claude Code CLI in headless mode). Uses your existing Pro/Max/Team subscription. No API key required.
  • API backend — direct calls to the Messages API with prepaid credits. Implements its own agentic tool-use loop with Blender-specific tools.

Why both? Because the constraints are different. With the CLI, you're piggybacking on a subscription you might already pay for, and you get all of Claude Code's built-in tools (Read, Edit, Write, Glob, Grep, Bash) for free. With the API, you can give Claude tools that talk directly to bpycreate_object, add_modifier, setup_camera, set_render_settings — instead of going through generated Python every time.

The CLI route turned out trickier than the API route, which surprised me. More on that below.

The main-thread problem

Blender has one rule that shapes everything: bpy.* calls only work on the main thread. If you call them from anywhere else you either get garbage state or a segfault.

That's a problem when your AI assistant streams responses for thirty seconds and you don't want the UI to freeze. So the extension runs the request on a background thread and uses Blender's bpy.app.timers to dispatch back to the main thread.

The bridge is small but it earns its place:

class MainThreadBridge:
    def __init__(self):
        self._queue = queue.Queue()
        self._lock = threading.Lock()
        self._streaming_text = ""

    def execute_on_main(self, fn, *args, **kwargs):
        """Run fn on main thread, block bg thread until done, return result."""
        holder = _ResultHolder()

        def _wrapper():
            try:
                holder.set(fn(*args, **kwargs))
            except Exception as e:
                holder.set_error(e)

        self._queue.put(_wrapper)
        return holder  # caller does holder.wait()

Enter fullscreen mode Exit fullscreen mode

A timer drains the queue every tick. Streaming text deltas use a separate lock-protected string so the UI redraw can read the latest chunk without serializing through the queue. Tool calls use the blocking variant — the background thread parks on _event.wait() while Blender executes the tool and returns the result.

One subtle gotcha: bpy.context inside a timer callback has no window, screen, or area. If the tool needs UI context (switching the active text block, redrawing a region), you have to wrap it in temp_override(). I lost an afternoon to that one.

The text-block VFS

Here's the part I'm proud of.

Blender's Text Editor stores scripts as in-memory bpy.types.Text datablocks. They're not files. They have no path. Claude Code CLI, on the other hand, expects to operate on files — that's what its Read/Edit/Write tools do.

So I wrote a small virtual filesystem that mirrors text blocks to disk:

  • On request, every text block in the .blend gets written to /tmp/blender_claude/<blend_name>/<block_name>.py.
  • The CLI runs with cwd set to that directory, so when Claude says "read my_script.py", the file is right there.
  • After the response completes, the workspace is scanned and changes are synced back to Blender's text blocks.
  • A background poll fires every two seconds to catch external edits and keep the two sides in sync.

The trick is that Claude doesn't need to know it's not editing real files. From its perspective the workspace looks like any other project directory. It uses Glob to find scripts, Edit to do find-and-replace, Write to create new ones. All of that just works, and the extension translates it back to Blender state on the way out.

A few text-block names are reserved and excluded from the sync:

Name Purpose
@Prompt@ Multi-line prompt buffer
@CLAUDE.md@ Per-project instructions, prepended to the system prompt
^... (caret prefix) Local scratch blocks, never synced

@CLAUDE.md@ is the one users seem to like most. You write project-specific rules ("always validate with compile() before exec()", "prefer modifiers to bmesh", "this scene is for a music video, keep things stylized"), and they ride along with every prompt for that .blend file.

The agentic loop on the API side

For the API backend, I wrote a simple tool-use loop:

1. Send messages to /v1/messages with stream=True and the tool catalog.
2. Read SSE deltas: text → push to UI, tool_use → buffer the input JSON.
3. On message_complete, if stop_reason == "tool_use":
     - Run each tool on the main thread via the bridge.
     - Append the assistant message + tool_result content to messages.
     - Loop back to step 1.
   Otherwise: done.

Enter fullscreen mode Exit fullscreen mode

Streaming responses are the easy part — requests with stream=True, parse SSE lines, push text deltas to the UI immediately. The harder part is buffering partial tool input. Anthropic streams tool inputs as partial_json deltas, so you accumulate the string, parse it once on content_block_stop, and only then dispatch.

The tools themselves are scoped narrowly. I started with a single execute_python tool and let Claude write code for everything. That worked, but it was slower (extra round-trips for code generation), more error-prone (subtle bpy 4.0+ API changes broke things), and harder to undo. So I added dedicated tools for the boring 80%: create an object, add a modifier, assign a material, set up a camera. Claude reaches for those first and only falls back to execute_python for genuinely custom logic.

That single decision — preferring narrow tools over a code-execution sledgehammer — was the biggest quality win.

Error self-correction

When execute_python raises, the tool result includes the traceback. Claude reads it, sees what broke, and writes a fix. No human in the loop.

try:
    exec(compile(code, '<claude>', 'exec'), namespace)
    return {"status": "ok"}
except Exception:
    return {"status": "error", "traceback": traceback.format_exc()}

Enter fullscreen mode Exit fullscreen mode

Two details matter here. First, compile() before exec() — this catches syntax errors with line numbers so Claude can see exactly where the problem is. Second, every execution wraps bpy.ops.ed.undo_push() so a single chat turn is one undo step. If Claude breaks your scene, one Ctrl+Z makes it whole again.

Blender 4.0+ API gotchas

Claude knows Python. Claude doesn't necessarily know that Blender 4.0 renamed half the Principled BSDF sockets, or that mat.blend_method became mat.surface_render_method, or that mesh.use_auto_smooth doesn't exist anymore. Without guidance, it confidently writes code that worked in 3.6 and fails on 4.2.

The fix is mundane: a chunk of API migration notes baked into the system prompt, plus runtime detection of the actual Blender/Python version so Claude knows what it's targeting:

Blender version: 4.2.3
Python version: 3.11.7
Critical 4.0+ migrations:
- Principled BSDF: "Subsurface" → "Subsurface Weight", "Specular" → "Specular IOR Level", ...
- Material: mat.blend_method → mat.surface_render_method
- Mesh: removed use_auto_smooth, use bpy.ops.object.shade_auto_smooth instead

Enter fullscreen mode Exit fullscreen mode

Boring, but it cut the failure rate on first-attempt scripts dramatically.

What I'd do differently

The CLI backend is the most popular path with users (subscription + zero setup), but it's also where I've spent the most debugging time. Sessions go stale. The CLI's NDJSON event format isn't documented as a public interface, so I had to read it empirically and add fallbacks for unknown event types. Bidirectional file sync is racy at the edges — if the user edits a text block while Claude is also editing the mirrored file, last write wins, and "last" depends on the poll interval.

If I were starting again I'd probably build the API backend first, ship it, and add the CLI later as the second backend rather than the default. The API path is more constrained but more honest about what's happening, and the agentic loop with narrow tools is genuinely good.

Try it

Available on Gumroad for $10. Works with Blender 4.2+ and Bforartists 4.2+. You'll need a Claude subscription (CLI backend) or API credits (API backend). Licensed GPL-3.0; the repo is private for now, but the package ships with full source — once installed you can read everything in blender_claude/ and modify it under the GPL terms.

If you build something with it — a procedural environment, a rigging tool, a render queue helper — I'd love to see it. The whole point of putting an AI in your DCC is that the boring scripting layer disappears. What you do with the time you get back is where the actual work happens.