/blender-vfx:blender-api-compatibilityfrom blender-vfx
Diagnoses and migrates Blender Python API breakage across versions 4.2 to 5.1+ (EEVEE_NEXT, renamed modifier types and BSDF inputs, VSE strips). Use when a bpy script errors on a newer Blender.
Ships in blender-vfx. 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.
Version: 3.1.2 Last Updated: 2026-10-30 Dependencies: Blender 5.1+
All changes below are tested and confirmed. The Blender MCP has full context, so bpy.ops works normally - the old HTTP Bridge limitation of 80% operator failure no longer applies.
Step 1: Identify the error pattern
# Common error signatures:
# AttributeError involving 'BLENDER_EEVEE' -> Render engine renamed
# KeyError: 'GEOMETRY_NODES' -> Modifier type renamed
# KeyError/AttributeError on BSDF inputs -> Input names changed
# RuntimeError: "Cannot find node type" -> Node type removed/renamed
# TypeError: enum "FFMPEG" not found -> Set media_type = 'VIDEO' first (5.0+)
# AttributeError on 'sequences' -> VSE renamed to strips/strips_all (5.0+)
# all faces on material slot 0 -> mesh.materials.clear() resets material_index (see blender-materials-shaders)
Step 2: Apply the correct migration pattern (see workflows below)
Step 3: Verify in Blender
import bpy
# Quick test: check current render engine
print(bpy.context.scene.render.engine) # Should print BLENDER_EEVEE or CYCLES
Use When: Code references BLENDER_EEVEE or old EEVEE properties
import bpy
# Measured on Blender 5.1.2: render.engine enum = ['BLENDER_EEVEE', 'BLENDER_WORKBENCH', 'CYCLES'].
# 'BLENDER_EEVEE_NEXT' is NOT a member (TypeError). 4.2-4.4 used BLENDER_EEVEE_NEXT; 5.0+ renamed it back.
# scene.eevee.use_bloom = True
# scene.eevee.use_ssr = True
# scene.eevee.use_motion_blur = True
# [OK] Render engine (5.x)
bpy.context.scene.render.engine = 'BLENDER_EEVEE'
# [OK] Bloom -> Compositor Glare node
scene = bpy.context.scene
scene.use_nodes = True
nodes = scene.node_tree.nodes
links = scene.node_tree.links
glare = nodes.new(type='CompositorNodeGlare')
glare.glare_type = 'FOG_GLOW' # closest to old EEVEE bloom
glare.threshold = 0.8
# [OK] Motion blur -> render settings
scene.render.use_motion_blur = True
scene.render.motion_blur_shutter = 0.5
# [OK] Screen space reflections -> ray tracing
scene.eevee.use_raytracing = True
Use When: Creating geometry nodes modifiers
import bpy
# [FAIL] BROKEN in 4.5.0+ (KeyError)
# modifier = obj.modifiers.new(name="GeoNodes", type='GEOMETRY_NODES')
# [OK] WORKING in 4.5.0+
modifier = obj.modifiers.new(name="GeoNodes", type='NODES')
modifier.node_group = node_tree # Same property, still works
# Version-safe helper (for code that needs to run on older Blender too)
def add_geometry_nodes_safe(obj, name="GeoNodes"):
try:
return obj.modifiers.new(name=name, type='NODES') # 4.5+
except KeyError:
return obj.modifiers.new(name=name, type='GEOMETRY_NODES') # <4.5
Use When: Creating color ramp nodes in compositor
import bpy
# [FAIL] BROKEN in 4.5.0+ (RuntimeError: Cannot find node type)
# color_ramp = compositor.nodes.new('CompositorNodeColorRamp')
# [OK] WORKING - identical API
color_ramp = compositor.nodes.new('ShaderNodeValToRGB')
color_ramp.color_ramp.elements.new(0.5)
color_ramp.color_ramp.elements[0].color = (1.0, 0.0, 0.0, 1.0)
import bpy
# [FAIL] OLD (Blender 4.2-4.4)
# bsdf.inputs["Transmission"].default_value = 1.0
# bsdf.inputs["Subsurface"].default_value = 0.2
# bsdf.inputs["Emission"].default_value = (1,1,1,1)
# [OK] NEW (4.5.0+)
bsdf.inputs["Transmission Weight"].default_value = 1.0
bsdf.inputs["Subsurface Weight"].default_value = 0.2
bsdf.inputs["Emission Color"].default_value = (1, 1, 1, 1)
# Always use input names, not indices:
bsdf.inputs['Base Color'].default_value = (0.8, 0.2, 0.1, 1.0) # Safe
# bsdf.inputs[0].default_value = ... # Fragile - index order can change
import bpy
# [FAIL] BROKEN in 4.5.0+
# space.shading.type = 'MATERIAL_PREVIEW'
# [OK] WORKING (4.5.0+)
space.shading.type = 'MATERIAL'
# Valid shading modes in 5.1+:
# 'WIREFRAME', 'SOLID', 'MATERIAL', 'RENDERED'
Use When: Setting file_format fails with enum "..." not found (e.g. FFMPEG for video output)
Blender 5.0 added image_settings.media_type (IMAGE / MULTI_LAYER_IMAGE / VIDEO). The file_format enum is filtered by the active media_type - video formats are only valid in VIDEO mode, image formats only in IMAGE mode.
import bpy
scene = bpy.context.scene
# [X] BROKEN in 5.x - scene in default IMAGE mode
# scene.render.image_settings.file_format = 'FFMPEG'
# TypeError: enum "FFMPEG" not found in ('BMP', 'IRIS', 'PNG', ...)
# [OK] WORKING - set media_type FIRST (portable 4.x/5.x pattern)
if hasattr(scene.render.image_settings, "media_type"): # 5.0+
scene.render.image_settings.media_type = 'VIDEO'
scene.render.image_settings.file_format = 'FFMPEG'
# Same in reverse - scene configured for video, switching to stills:
if hasattr(scene.render.image_settings, "media_type"):
scene.render.image_settings.media_type = 'IMAGE'
scene.render.image_settings.file_format = 'PNG'
Save/restore gotcha: code that snapshots and restores image_settings must restore media_type BEFORE file_format, or the restore itself throws - keep the property keys in an ordered sequence with media_type first.
Use When: VSE code raises AttributeError on sequences / sequences_all
import bpy
se = bpy.context.scene.sequence_editor
# [X] BROKEN in 5.x - old names removed
# for strip in se.sequences: ...
# all_strips = se.sequences_all
# [OK] WORKING - portable via hasattr
strips = se.strips if hasattr(se, "strips") else se.sequences
all_strips = se.strips_all if hasattr(se, "strips_all") else se.sequences_all
CRITICAL - never use or fallbacks here:
# [X] SUBTLE BUG - an EMPTY strips collection is falsy, so this falls
# through to the missing 'sequences' attribute and returns None on a
# valid (but empty) 5.x sequence editor. Survives testing on non-empty
# scenes and only fails on empty ones.
strips = getattr(se, "strips", None) or getattr(se, "sequences", None)
Branch on attribute existence (hasattr), never on truthiness.
import bpy
def detect_blender_capabilities():
"""Detect API capabilities rather than version numbers."""
caps = {
'blender_version': bpy.app.version,
'has_eevee_next': False,
'geometry_nodes_type': None
}
# Test EEVEE_NEXT
try:
current = bpy.context.scene.render.engine
bpy.context.scene.render.engine = 'BLENDER_EEVEE'
caps['has_eevee_next'] = True
bpy.context.scene.render.engine = current
except Exception:
pass
# Test geometry nodes modifier type
test_mesh = bpy.data.meshes.new("_cap_test")
test_obj = bpy.data.objects.new("_cap_test", test_mesh)
try:
mod = test_obj.modifiers.new("test", type='NODES')
caps['geometry_nodes_type'] = 'NODES'
test_obj.modifiers.remove(mod)
except Exception:
try:
mod = test_obj.modifiers.new("test", type='GEOMETRY_NODES')
caps['geometry_nodes_type'] = 'GEOMETRY_NODES'
except Exception:
pass
finally:
bpy.data.objects.remove(test_obj, do_unlink=True)
bpy.data.meshes.remove(test_mesh)
return caps
import bpy
def set_render_engine_safe(preference):
engine_map = {
'EEVEE': 'BLENDER_EEVEE',
'BLENDER_EEVEE': 'BLENDER_EEVEE',
'CYCLES': 'CYCLES',
'WORKBENCH': 'BLENDER_WORKBENCH',
}
target = engine_map.get(preference, preference)
try:
bpy.context.scene.render.engine = target
return True
except TypeError:
return False
Cause: n/a on 5.1 - BLENDER_EEVEE is the ONLY EEVEE id; the error appears for BLENDER_EEVEE_NEXT
Fix: bpy.context.scene.render.engine = 'BLENDER_EEVEE'
Cause: Modifier type renamed in 4.5.0
Fix: obj.modifiers.new(name="GeoNodes", type='NODES')
Cause: Input names changed in 4.5.0
Fix: Use new names - "Transmission Weight", "Subsurface Weight", "Emission Color"
Cause: Blender 5.0+ filters the file_format enum by media_type; the scene is in IMAGE mode
Fix: scene.render.image_settings.media_type = 'VIDEO' before setting file_format = 'FFMPEG' (and 'IMAGE' before PNG/JPEG etc. if the scene was set up for video)
Cause: VSE sequences/sequences_all renamed to strips/strips_all in 5.0
Fix: se.strips if hasattr(se, "strips") else se.sequences - never getattr(...) or getattr(...) (empty collections are falsy)
BLENDER_EEVEE -> BLENDER_EEVEE (complete removal in 4.5.0)scene.eevee.use_bloom -> Compositor Glare node (FOG_GLOW)scene.eevee.use_ssr -> scene.eevee.use_raytracingscene.eevee.use_motion_blur -> scene.render.use_motion_blurscene.eevee.use_volumetric_lights -> RemovedGEOMETRY_NODES modifier type -> NODESCompositorNodeColorRamp -> ShaderNodeValToRGBCompositorNodeComposite -> Removed (no replacement - main output via scene.render.filepath)CompositorNodeMapRange -> Removed (use ShaderNodeMath with MINIMUM/MAXIMUM/etc.)ShaderNodeMath works in compositor context (shared node type)scene.node_tree -> scene.compositing_node_group (must create CompositorNodeTree if None)OPEN_EXR_MULTILAYER removed from main render format enum - only via File Output nodebase_path -> directory, file_slots -> file_output_itemsfile_name appends scene frame number - add trailing . to prevent (e.g., "out_0001.")file_output_items.new(socket_type, name) - required for node to produce output"Transmission" -> "Transmission Weight""Subsurface" -> "Subsurface Weight""Emission" -> "Emission Color"light.use_contact_shadow -> Removedspace.shading.type = 'MATERIAL_PREVIEW' -> 'MATERIAL'from bpy_types import CyclesRenderSettings -> Use bpy.context.scene.cycles directlyimage_settings.media_type (IMAGE / MULTI_LAYER_IMAGE / VIDEO) - file_format enum is filtered by it; set media_type BEFORE file_format (both directions), guard with hasattr for 4.xsequence_editor.sequences / sequences_all -> strips / strips_all - portable fallback must use hasattr, never or (empty collections are falsy)BLENDER_EEVEE references (use BLENDER_EEVEE)GEOMETRY_NODES modifier type (use NODES)CompositorNodeColorRamp (use ShaderNodeValToRGB)CompositorNodeComposite (removed in 5.1)CompositorNodeMapRange (use ShaderNodeMath)scene.node_tree (use scene.compositing_node_group)directory/file_name with trailing . for custom numberingscene.cycles used directly (not imported from bpy_types)'MATERIAL' not 'MATERIAL_PREVIEW'media_type set before file_format when changing render output format (5.0+)strips/strips_all with hasattr fallback (no or-chain fallbacks)v3.1.2 (2026-10-30) - Obs 244: one-line error signature for materials.clear() resetting material_index.
v3.1.0 (2026-09-02) - Blender 5.x render output + VSE gotchas (ported from a stranded July worktree edit)
image_settings.media_type gates the file_format enum (5.0+) - set media_type before file_format, hasattr-guarded portable patternsequences/sequences_all -> strips/strips_all rename, with the falsy-fallback hazard (or-chains break on empty collections)v2.0.0 (2026-06-10) - MCP migration
v1.0.0 (2025-10-24) - Initial release
Status: Production Ready Maintainer: VFX Pipeline Team Dependencies: Blender 5.1+
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
npx claudepluginhub sideshowroberto/vfx-agent-toolkit --plugin blender-vfx11 skills in this plugin
/blender-addon-developmentVerified Blender 4.2+/5.1 add-on and extension traps - bl_info-only zips fail extension validate without blender_manifest.toml, assignment-style bpy.props register silently and do not exist, BLENDER_EEVEE_NEXT raises TypeError. Use when writing or packaging a Blender add-on, extension, operator or panel./blender-animationKeyframe animation, rigging, constraints, and armatures in Blender. Use for animation, rigging, camera movement, or when user mentions "animate," "keyframe," "rig," or "armature."/blender-compositingCompositor nodes, post-processing, and color grading in Blender. Use for compositing workflows, render pass integration, post-processing, color correction, or when user mentions "compositor," "post-process," "color grade," or "render passes."/blender-controlnet-passesRenders ControlNet conditioning passes from a Blender scene for AI image and video generation - grey clay, normalized depth, cryptomatte EXR, optional wireframe. Use when preparing depth, edge or clay inputs for video models, or crypto mattes for comp./blender-geometry-nodesProcedural modeling using Geometry Nodes in Blender. Use for scattering systems, node trees, parametric design, or when user mentions "procedural," "geometry nodes," "scattering," or "instances."/blender-grease-pencilVerified Grease Pencil v3 traps on Blender 4.3+/5.1 - legacy frame.strokes, points.add, line_width and GP_* modifier ids raise errors, and Line Art silently makes 0 strokes without target layer, material and camera. Use when scripting Grease Pencil strokes, GP modifiers or Line Art.Other plugins' skills for the same job