geometry-script README

项目的 README,来自 github.com/carson-katri/geometry-script。合并为一个 markdown 文件:README.md。

Geometry Script wordmark

A scripting API for Blender's Geometry Nodes, shaders and compositor:

from geometry_script import *

@tree("Repeat Grid")
def repeat_grid(geometry: Geometry, width: int = 3, height: int = 3):
    mesh = grid(
        size_x=width, size_y=height,
        vertices_x=width, vertices_y=height,
    ).mesh
    points = mesh_to_points(mesh=mesh).points
    return instance_on_points(points=points, instance=geometry).instances

Generated node tree

Installation

Geometry Script is a Blender extension and requires Blender 5.2 or newer.

Drag the box for your Blender version into Blender to install it:

Geometry Script for Blender 5.2 Geometry Script for Blender 5.3 Geometry Script for Blender 5.4

Blender asks to allow online access if it's off, then to add the Geometry Script repository, then confirms the install. The nightly release always lists the links for every Blender version with a build.

To install manually instead:

  1. Download the ZIP matching your Blender version from the nightly release, e.g. geometry_script-1.0.0-blender-5.2.zip
  2. Open Blender > Preferences > Get Extensions
  3. Open the dropdown at the top right, choose Install from Disk... and select the downloaded ZIP file

Claude Code skill

The repository is also a Claude Code plugin marketplace with a skill for building node trees with Geometry Script. Install it with:

/plugin install geometry-script --marketplace carson-katri/geometry-script

On Claude Code versions before 2.1.275, add the marketplace first:

/plugin marketplace add carson-katri/geometry-script
/plugin install geometry-script@geometry-script

The skill runs scripts through Blender's MCP server when it's connected, or in background Blender otherwise. Run /plugin marketplace update geometry-script to get the latest version, or turn on auto-update for the marketplace in /plugin.

What is Geometry Script?

Geometry Script is a robust yet easy to use Python API for creating Geometry Nodes with code.

At a certain point, Geometry Node trees become unmanagably large. Creating node trees in Python enables quicker editing and reorganization of large, complex trees.

Geometry Script has all of the performance and capabilities of Geometry Nodes, but in a more managable format. The scripts are converted directly to Geometry Node trees making them easy to tweak for others unfamiliar with scripting.

Every node in your Blender version is available as a typed Python function, generated from Blender itself, so your editor can complete node names, inputs, outputs and enum values.

Shader node groups, materials, worlds and compositor node groups can be scripted the same way, with geometry_script.shader and geometry_script.compositor:

from geometry_script.shader import *

@material("Gold")
def gold():
    return principled_bsdf(base_color=(1.0, 0.77, 0.34, 1.0), metallic=1.0, roughness=0.2).bsdf

Documentation

Read the documentation for more information on installation, syntax, and tutorials.

Contributing

Use uv to get fake-bpy-module and some pyright settings.

uv sync

The node modules (api/nodes.py, api/shader_nodes.py and api/compositor_nodes.py) are generated from Blender and aren't checked in. Loading the add-on from a checkout generates them with that Blender, or you can generate them yourself, e.g. for editor completions:

blender -b --factory-startup --python code_generator/node_functions_generator.py

To build an installable package for a specific Blender version, which generates the node modules with that Blender and runs the smoke test:

python tools/build.py --blender /path/to/blender  # writes dist/geometry_script-<version>-blender-<major>.<minor>.zip

Then you can follow Blender's steps to setup a symlink for a local repository.

geometry-script (carson-katri/geometry-script)

正在搜索数据库…

这是什么?Geometry Script 是一个 Python 脚本接口(API),让你可以用代码而不是节点编辑器来构建 Blender 的几何节点、着色器节点和合成器节点树。
这是独立应用,还是运行在 Blender 内部的?它是一个 Blender 扩展(插件):你编写 Python 代码,脚本会直接转换为 Blender 内部实际的几何节点树。
运行它需要什么?你需要 Blender 5.2 或更高版本,它是专门为该版本 Blender 构建的扩展。
从源码构建时有什么需要注意的坑吗?节点模块(api/nodes.py、shadernodes.py、compositornodes.py)没有提交到仓库中,需要从你自己安装的 Blender 重新生成。
Claude Code 技能是做什么的?该仓库同时也是一个 Claude Code 插件市场,其中包含一个技能,可以替你编写 Geometry Script 几何节点树;连接了 Blender 的 MCP 服务器时通过它运行脚本,否则在后台运行的 Blender 实例中运行。
它也能用脚本编写着色器节点和合成器节点吗?可以,着色器节点组、材质、世界以及合成器节点组都可以用同样的方式,通过 geometryscript.shader 和 geometryscript.compositor 编写脚本。
我的编辑器能自动补全节点名称吗?你安装的 Blender 版本中的每个节点,都由 Blender 本身生成为带类型的 Python 函数,因此你的编辑器可以自动补全节点名称、输入、输出和枚举值。
为什么要用脚本编写节点,而不是用可视化编辑器?在可视化编辑器里,几何节点树会变得难以管理;把它们写成 Python 脚本,编辑和重新组织复杂的节点树会快得多。
大小
21.7 MB
星标
388
更新
提交Oct 13
时长
4年
提交 · 90 天