/blender-developer-tools:uv-and-mesh-attributesfrom blender-developer-tools
Authors per-loop and per-vertex mesh data from Python: UV layers, lightmap channels, loop tangents, color attributes, shape keys, and vertex-group weights. Re-fetch layers by name after CustomData-reallocating calls.
Ships in blender-developer-tools. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Use this skill when the user:
mesh.uv_layers, bm.loops.layers.uv, calc_uvs=True)uv.lightmap_pack / uv.smart_project on itcalc_tangents, bitangent_sign)color_attributes, the deprecated vertex_colors)calc_tangents, or weights that sum short of oneEvery one of these lives in the mesh's CustomData. Three rules cover most bugs: create the layer before anything that fills it, address layers by name, and re-fetch a layer by name after any call that can reallocate CustomData.
import bmesh
import bpy
me = bpy.data.meshes.new("Panel")
bm = bmesh.new()
try:
bm.loops.layers.uv.new("UVMap") # first: calc_uvs only fills an existing layer
bmesh.ops.create_grid(bm, x_segments=4, y_segments=4, size=1.0, calc_uvs=True)
bm.to_mesh(me)
finally:
bm.free()
me.uv_layers.new(name="UVLight") # a second channel does NOT become active
assert me.uv_layers.active.name == "UVMap"
assert me.uv_layers["UVMap"].active_render
me.calc_tangents(uvmap="UVMap") # reallocates loop CustomData
uv = me.uv_layers["UVMap"].data # so re-fetch by name after it
co = [0.0] * (len(me.loops) * 2)
uv.foreach_get("uv", co)
assert len(me.loops) == 64 and min(co) >= -1e-6 and max(co) <= 1.0 + 1e-6
col = me.color_attributes.new("Tint", 'FLOAT_COLOR', 'CORNER')
assert len(col.data) == len(me.loops) # CORNER is per loop, not per vertex
mesh.uv_layers.new(name="UVMap") on a Mesh, bm.loops.layers.uv.new("UVMap") on a BMesh. Look layers up with mesh.uv_layers["UVMap"], never by index or "the first one".calc_uvs=True is a silent no-op without a layer. bmesh.ops.create_grid (and the other primitive ops) only fill a UV layer that already exists on the BMesh. With none, the flag does nothing, to_mesh leaves mesh.uv_layers empty, and an Image Texture samples texel (0, 0) everywhere: the mesh renders one flat color. Create the layer first, or assign UVs yourself.uv_layer.data.foreach_get("uv", flat) / foreach_set, sized len(mesh.loops) * 2. UVs are per loop (face corner), not per vertex.Engines bake lighting into UV1. Two flags decide which channel a tool touches:
| Flag | Meaning |
|---|---|
uv_layer.active (mesh.uv_layers.active) | the layer edit-mode UV operators read and write |
uv_layer.active_render | the layer the renderer and exporters treat as the primary UV |
uv_layers.new() does not move either flag. The first layer keeps both, so an unwrap or pack after adding UVLight runs on channel 0 and destroys it (measured drift 2.068 in lightmap-uv-channel). Set mesh.uv_layers.active = mesh.uv_layers["UVLight"] before the UV op.active on the channel you edit, active_render on UVMap.bpy.ops.uv.lightmap_pack exits OK while packing nothing when its context is wrong; check the result (bounds in [0, 1], non-overlap), not the return value.A MeshUVLoopLayer, attribute or color-attribute object is a view into CustomData. Calls that reallocate CustomData leave held views dangling:
mesh.calc_tangents(), VertexGroup.add(), adding or removing modifiers or layers, edit-mode UV operatorscalc_tangents returns tangent floats instead of UVs: exit 0, silently wrong (measured in triangulate-tangents). Iterating a held uv_layer.data after edit-mode UV ops segfaulted 4.5.11 headless (5 of 5 runs). On 5.1 and 5.2 the same stale read survives by memory-layout luck, which hides the bug.Fetch the layer by name again after each such call, as the block above does.
mesh.calc_tangents(uvmap="UVMap") fills loop.tangent and loop.bitangent_sign; the bitangent is bitangent_sign * normal.cross(tangent).mesh.color_attributes.new(name, type, domain). mesh.vertex_colors is the deprecated alias.'CORNER' is per loop (len(mesh.loops)), 'POINT' is per vertex. Per-vertex data written to a CORNER attribute must be expanded across each vertex's corners.attribute_type='GEOMETRY', attribute_name set) wired into Base Color. Without that node the mesh stays gray even when the data is right.obj.shape_key_add(name="Basis", from_mix=False) first, then the target key. Write the target with key_blocks["Tall"].data.foreach_set("co", flat).mesh.vertices: those stay at Basis. Read the blended shape from the evaluated mesh (obj.evaluated_get(depsgraph).to_mesh(), then to_mesh_clear()), where each vertex is basis + value * (key - basis).bpy.ops.object.vertex_group_limit_total: read v.groups, keep the four heaviest, VertexGroup.remove([v.index]) the rest, then renormalize the survivors to sum to one. Dropping without renormalizing shrinks the mesh toward the origin under load.v.groups) are the contract, not the weights you meant to write: read them back to check.calc_uvs=True on a BMesh with no UV layer.UVLight and unwrapping without moving active, or forgetting that edit-mode UV ops cleared active_render.uv = mesh.uv_layers.active.data across calc_tangents() or other reallocating calls.calc_tangents on a mesh with an n-gon.CORNER color data by vertex count, or never adding the Attribute node.mesh.vertices.mesh-editing-and-bmesh: bmesh ownership, foreach_get / foreach_set, evaluated meshesdepsgraph-and-evaluated-data: the to_mesh / to_mesh_clear lifetimeengine-export-presets: exporting UV1, tangents and weights to Unity, Godot and UnrealEach example runs headless, asserts the contract, and exits non-zero when it breaks. Run one with blender --background --python <script> --; pass a falsifier flag to watch the check fail.
color-attribute-wheel: The modern color-attributes API — mesh.color_attributes.new() on the CORNER domain. Falsify: --point-domain (exit 6).lightmap-uv-channel: A market cart carrying the two-channel UV contract for baked lighting: UV0 untouched, UVLight packed with no overlaps and a respected margin. Falsify: --overlap-islands (exit 7).shape-key-blend: A relative Tall shape key that turns a squat ceramic jar into a trumpet vase. Falsify: --zero-blend (exit 5).triangulate-tangents: A machined buckler verifying the tangent-space contract a game engine's normal mapping depends on. Falsify: --zero-uv (exit 4).uv-layer-grid: The UV-layer authoring hazard — bmesh.ops.create_grid(..., calc_uvs=True) is a silent no-op unless a UV layer already exists; without one an Image Texture samples texel (0,0) everywhere. Falsify: --precreate-on-hazard (exit 3).vertex-weight-limit: A rigged industrial robot arm pruned to the game-engine cap of four bone influences per vertex, through the data API. Falsify: --skip-limit (exit 4).What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
blender-python, mesh-attributes, uv-layers, bmesh, shape-keys, vertex-groups
npx claudepluginhub tmhsdigital/blender-developer-tools --plugin blender-developer-tools27 skills in this plugin
/addon-scaffoldingScaffold a Blender add-on as an Extensions Platform package: blender_manifest.toml, modular file layout, register_classes_factory, symmetric register/unregister. Use when the user starts a new add-on or extension, writes or fixes blender_manifest.toml, asks which layout or registration pattern to use on Blender 4.5 LTS or 5.x, or has classes that fail to register or unregister cleanly. Targets 5.2 LTS with 4.5 LTS fallback./ai-mesh-cleanupOrdered cleanup for an imported generated or scanned mesh before it goes to an engine: scene units, apply rotation and scale, origin to base, recalculate normals, evaluated triangle count, decimate to a budget, convex collider. Use when the user has a GLB, glTF or FBX that is not engine-ready, mentions unit scale, unapplied transforms, triangle budget, LODs or a collision hull, or is about to run mesh operations on an import without checking its scale. Targets 5.2 LTS with 4.5 LTS fallback./bake-high-to-lowCage-bake high-poly surface detail onto a low-poly target as a tangent-space normal map with bpy.ops.object.bake (Cycles, selected-to-active, active Image Texture node, UV layer, save_render). Use when the user wants a normal map from a dense mesh onto a game-resolution or decimated LOD, mentions cage_extrusion or use_selected_to_active, or gets a bake that returns CANCELLED, comes out black or flat, or fails with 'No active UV layer found'. Targets 5.2 LTS with 4.5 LTS fallback.Other plugins' skills for the same job