Communitygithub.com

Blender Core(5.2 LTS+ 基础技能)

代理驱动任何 Blender 5.2+ 任务的基础技能——通过 MCP(实时)或命令行运行 bpy、上下文覆盖、区域安全的节点查找、枚举发现、5.x API 变更、验证。对任何 Blender、bpy、.blend 或 3D 资产请求优先使用;路由到专门的 blender-* 技能。

Blender Core(5.2 LTS+ 基础技能) 是什么?

Blender Core 是所有代理驱动 Blender 任务的基础技能,支持 5.2 LTS 及以上版本。它提供了执行 bpy 代码的核心机制——既可以通过 blender-mcp 工具“execute_blender_code”实时运行,也可以通过 run_in_blender.py 脚本在无头 CLI 中以固定步骤执行。该技能特别强调使用数据 API(如 bpy.data、bmesh、numpy 的 foreach_get/set)而非容易出错的算子操作;当算子不可避免时,提供 context.temp_override 的精确用法。在节点查找方面,要求按 type 而非 name 进行,以避免本地化问题;枚举值则通过 enum_items 或 try/except 动态获取。此外,它详细记录了 5.x API 的关键变更(如 action.fcurves → channelbags、material.use_nodes 废弃、骨骼层次 → 骨骼集合、bl_info 附加组件 → blender_manifest.toml 扩展等),帮助用户避免旧教程或 LLM 记忆中的错误。最后,该技能强制要求在确认完成前执行验证步骤(报告数字指标、运行资产 QA、生成预览图并检查输出文件),确保结果可靠。

兼容平台~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/kraivichldf/claude-workflow/tree/HEAD/skills/blender-core

在你喜欢的 AI 中提问

打开一个已预加载此 Agent Skill 的新对话。

文档

Blender Core(5.2 LTS+)

路由到专门技能

任务技能
单位、集合、命名、链接、资产库blender-scene-setup
硬表面建模、倒角、布尔运算、法线blender-hardsurface-modeling
雕刻、多级细分、重新网格化blender-sculpting
拓扑重构建、UV 展开、纹素密度blender-retopology-uv
PBR 材质、色彩空间、纹理集blender-pbr-materials
磨损、污渍、灰尘、贴花、修剪表、纹理绘制blender-texturing
高→低多边形贴图烘焙(法线、AO、曲率...)blender-texture-baking
几何节点、程序化建模blender-geometry-nodes
身体绑定、Rigify、权重绘制blender-character-rigging
面部绑定、形态键、ARKit、Visemesblender-facial-shapekeys
关键帧、动作、NLA、动作捕捉重定向、循环、根运动blender-animation
服装、分层衣物、身体穿模blender-clothing
头发、毛发、梳理、毛发卡片blender-hair-grooming
多边形预算、LOD、绘制调用、清理blender-game-optimization
导出:glTF/FBX/USD 到 Roblox、Unity、Unreal、Godot、Webblender-export-pipelines
Cycles/EEVEE 设置、合成器、批量渲染blender-rendering
光照、HDRI、摄像机、转盘blender-lighting-lookdev
卡通/赛璐珞/动漫着色、轮廓线、Line Art、油性笔blender-stylized-npr
地形、生物群落散布、模块化套件blender-environment-kits
视频编辑(VSE)、运动跟踪、摄像机解算blender-video-editing
一天中的时间、夜晚、日落、雾、氛围(赛博朋克、恐怖...)blender-time-of-day
雨、雪、湿表面、水坑、闪电、灰尘/余烬blender-weather-fx
布料、刚体、流体、头发、GN 物理blender-simulation
编写附加组件/扩展blender-addon-development
批量/无头管道、文件转换blender-pipeline-automation
交付前检查网格/资产(始终执行)blender-asset-qa
端到端操作手册(道具、角色、Roblox、产品展示)blender-workflow-recipes

执行

实时(blender-mcp execute_blender_code):小步工作,只输出所需内容。要调用技能脚本,请导入它:

import sys, importlib; sys.path.insert(0, r"<skills_dir>/blender-asset-qa/scripts")
import qa_check; importlib.reload(qa_check); print(qa_check.run(objects=["Chair"]))

每次 MCP 调用都在 全新命名空间 中运行:每次调用都需重新 import。这开销很小,因为模块会缓存在 sys.modules 中。仅在编辑脚本后才需要 reload。 无头模式(任何有 shell 的代理):这只输出脚本的 JSON(@@JSON@@ 行):

python <skills_dir>/blender-core/scripts/run_in_blender.py --blend in.blend <script.py> -- --objects Chair --save out.blend
python <skills_dir>/blender-core/scripts/run_in_blender.py --expr "import bpy; print(len(bpy.data.objects))"

原始形式:blender -b in.blend --factory-startup --python-exit-code 1 -P x.py -- args。此处的每个脚本都暴露了 run(**kw) -> dict 和 -- 后的相同标志。 会话中的首次调用:scripts/env_report.py,返回版本、引擎、GPU、附加组件、单位、色彩管理和场景计数。

规则

  • 优先使用数据 API 而非算子:使用 bpy.data、bmesh、mesh.attributes 以及配合 numpy 的 foreach_get/set。算子依赖于上下文和选择,且许多算子需要 3D 视图,而后台模式没有。
  • 如果算子不可避免:with bpy.context.temp_override(object=ob, active_object=ob, selected_objects=[ob], selected_editable_objects=[ob]): bpy.ops...。检查结果是否为 {'FINISHED'}。
  • 编辑模式隔离:ob.data 在编辑模式下不会更新。使用 bmesh.from_edit_mesh + bmesh.update_edit_mesh,或在读取前切换到 OBJECT 模式。
  • 节点:按 type(n.type == "BSDF_PRINCIPLED")查找节点,绝不按 name,因为名称是本地化的。按英文名称或 identifier 访问插槽是安全的。
  • 枚举:通过 [i.identifier for i in T.bl_rna.properties[p].enum_items] 读取有效值。动态枚举(render.engine、view_transform、look)会报告不全,因此在 try/except TypeError 中赋值它们(错误信息会列出有效值)。
  • 引擎:BLENDER_EEVEE、CYCLES、BLENDER_WORKBENCH。Cycles 设备:scene.cycles.device = "GPU" + 偏好设置 compute_device_type。
  • 求值数据:使用 ob.evaluated_get(depsgraph),然后 .to_mesh(),最后务必 .to_mesh_clear()。在修改后读取 matrix_world 前调用 view_layer.update()。
  • 已释放数据:应用或移除修改器、移除物体或 ID 会释放它们。先收集名称([m.name for m in ob.modifiers]),之后切勿触碰旧的 Python 引用,否则会返回垃圾数据或导致崩溃。
  • 切勿信任默认名称("Cube.001")。保留对象引用,显式重命名,并通过 bpy.data.objects[name] 查找对象。
  • 比例:1 单位 = 1 米。在倒角、含距离的修改器、绑定、物理、烘焙和导出之前应用旋转/缩放(transform_apply)。
  • 路径:bpy.path.abspath("//textures/x.png") 解析相对于 .blend 的路径。显式保存;使用 save_as_mainfile(filepath=..., copy=True) 进行备份。
  • 实时会话是用户的工作:绝不 read_factory_settings,绝不删除你未创建的数据,并在破坏性批量编辑前保存备份副本。
  • 后台中的 GPU 模块:先调用 gpu.init()(5.2+)。bgl 已不存在。
  • 大型网格:不使用逐顶点的 bpy.ops。改用 numpy foreach_get(参见 references/bpy-patterns.md)。

5.x API 变更(会破坏旧教程/LLM 记忆)

action.fcurves → channelbags · scene.node_tree → scene.compositing_node_group · material.use_nodes 已弃用(新材料已有节点) · mod["Socket_2"] → mod.properties.inputs.Socket_2.value(5.2) · BLENDER_EEVEE_NEXT → BLENDER_EEVEE · 布尔 FAST → FLOAT · 骨骼层级 → 骨骼集合 · bl_info 附加组件 → 扩展(blender_manifest.toml) · bpy.props 值不再能通过字典访问(scene["cycles"])。完整表:references/api-changes-5x.md。

验证(说“完成”前必须执行)

  1. 数字而非形容词:报告三角面数、物体数、材质数、尺寸(ob.dimensions)以及写入的输出文件。
  2. 几何体已更改 → 运行 blender-asset-qa 的 qa_check.py(Z 轴冲突、分离部分、非流形、法线翻转、缩放)。
  3. 查看它:MCP look(mode="angles",着色 material/wireframe)。无头模式:blender-asset-qa/scripts/review_shots.py 渲染联系表。
  4. 重新阅读自己的输出:确认导出的文件存在且大小非零。

参考

  • references/api-changes-5x.md:4.x→5.2 迁移表。当代码因 AttributeError/KeyError 失败时加载它。
  • references/bpy-patterns.md:经验证的代码段,涉及 bmesh、属性、numpy、temp_override、依赖图、驱动、附加/链接、处理器和定时器。

Individual skills in this repo

This repo contains 4 individual skills — each has its own dedicated page.

blender-animation

Animation in Blender 5.2 - slotted/layered actions and the channelbag API, Python keyframing, F-curves, game loops with pop/hitch checks, NLA clips, pose library, mocap/BVH/Mixamo retargeting with auto bone maps, baking control rigs to export skeletons, root motion, per-clip export. Use for any keyframe, action, NLA, mocap, or animation-export task.

blender-character-rigging

Character rigging in Blender 5.2 - Rigify metarig fit/generate, bone naming/roll/collections, DEF/MCH/control layers, IK/FK, robust skinning (heat + proxy fallback), weight-painting rules, correctives, engine game skeletons (Unity, Unreal, Roblox R15), rig validation and deformation stress tests. Use for armature, skinning or weights tasks.

blender-hardsurface-modeling

Hard-surface and prop modeling in Blender 5.2 - blockout-to-detail flow, non-destructive modifier stacks (Mirror, Boolean Exact/Manifold, Bevel, Weighted Normal, Smooth by Angle), mid-poly vs subdivision vs high-to-low workflows, shading/custom normals, cylinder segment budgets, edge attributes from Python. Use for weapons, vehicles, props, architecture, mechanical parts.

blender-texture-baking

Bake texture maps in Blender 5.2 Cycles - high-to-low normal maps with cage/extrusion, AO, curvature, ID, thickness, base color/roughness/metallic from procedurals, ORM packing, OpenGL vs DirectX, margins, GPU baking, fixing skewing/waviness/seams. Use when transferring sculpt or high-poly detail to game meshes or converting procedural materials to textures.

相关技能