| name | blender-core-versions |
| description | Use when writing Blender Python code that must work across multiple versions (3.x/4.x/5.x), or when migrating scripts between Blender versions. Prevents breakage from renamed APIs, removed modules (bgl in 5.0), and changed function signatures. Provides the complete breaking changes matrix, deprecation timeline, and version-safe coding patterns. Keywords: Blender version, migration, deprecated, breaking change, bgl removal, bpy.app.version, version compatibility, 3.x, 4.x, 5.x, API changes, which Blender version, what changed in Blender 4.
|
| license | MIT |
| compatibility | Designed for Claude Code. Requires Blender 3.x/4.x/5.x with Python. |
| metadata | {"author":"OpenAEC-Foundation","version":"1.0"} |
Blender Core Versions: Python API Version Matrix
1. Quick Reference
Version Detection
import bpy
major, minor, patch = bpy.app.version
if bpy.app.version >= (4, 0, 0):
pass
else:
pass
See references/methods.md for complete version detection API.
Python Version Matrix
| Blender | Python | VFX Platform |
|---|
| 3.x | 3.10 | 2023 |
| 4.0 | 3.10 | 2023 |
| 4.1 | 3.11 | 2024 |
| 4.2 LTS | 3.11 | 2024 |
| 4.3 | 3.11 | 2024 |
| 4.4 | 3.11 | 2024 |
| 4.5 LTS | 3.11 | 2024 |
| 5.0 | 3.11 | 2025 |
| 5.1 | 3.13 | 2026 |
Critical Breaking Changes Summary
| Change | Removed In | Migration |
|---|
Context override dicts on bpy.ops | 4.0 | context.temp_override() |
MeshEdge.bevel_weight / .crease | 4.0 | mesh.attributes.get("bevel_weight_edge") |
obj.face_maps | 4.0 | Integer face attributes |
bone.layers[i] / pose.bone_groups | 4.0 | bone.collections |
NodeTree.inputs/outputs.new() | 4.0 | NodeTree.interface.new_socket() |
| Principled BSDF socket names | 4.0 | Renamed: Subsurface Weight, Specular IOR Level, etc. |
3D_UNIFORM_COLOR shader name | 4.0 | POLYLINE_UNIFORM_COLOR |
| Python OBJ/PLY importers | 4.0 | bpy.ops.wm.obj_import/export |
Mesh.use_auto_smooth | 4.1 | Mesh.corner_normals + Smooth by Angle modifier |
Light probe CUBEMAP/PLANAR/GRID | 4.1 | SPHERE / PLANE / VOLUME |
mat.cycles.displacement_method | 4.1 | mat.displacement_method |
blender_manifest.toml required | 4.2 | Replace bl_info dict with TOML manifest |
EEVEE → BLENDER_EEVEE_NEXT | 4.2 | Check identifier string |
bpy.types.AttributeGroup | 4.3 | AttributeGroupMesh, AttributeGroupPointCloud, etc. |
| Grease Pencil API rewrite | 4.3 | Complete API rewrite; see migration guide |
| EEVEE legacy properties | 4.3 | 40+ properties removed |
Subclass __init__ must call super() | 4.4 | Forward *args, **kwargs to parent |
bpy.types.Sequence → bpy.types.Strip | 4.4 | Rename all Sequence references |
| Slotted Actions system | 4.4 | action.layers[0].strips[0].channelbag() |
bgl module | 5.0 | gpu module (MANDATORY) |
scene['cycles'] dict access | 5.0 | Attribute access on RNA properties |
scene.node_tree (compositor) | 5.0 | scene.compositing_node_group |
brush.sculpt_tool | 5.0 | brush.sculpt_brush_type |
action.fcurves legacy API | 5.0 | Slotted Actions channelbag API |
VSE end_frame | 5.0 | length property |
| VSE strip time property renames | 5.1 | frame_final_duration → duration, etc. (removal in 6.0) |
| Python 3.13 | 5.1 | Check stdlib changes |
2. Essential Patterns
Version-Safe Conditionals
ALWAYS use bpy.app.version tuple comparison. NEVER parse bpy.app.version_string.
import bpy
if bpy.app.version >= (5, 0, 0):
comp_tree = scene.compositing_node_group
elif bpy.app.version >= (4, 0, 0):
comp_tree = scene.node_tree
else:
comp_tree = scene.node_tree
Feature Detection Pattern
ALWAYS prefer hasattr() checks over version comparisons when testing for a specific API.
import bpy
if hasattr(bpy.types, "AttributeGroupMesh"):
pass
else:
pass
mesh = bpy.context.active_object.data
if hasattr(mesh, "corner_normals"):
normals = mesh.corner_normals
else:
mesh.use_auto_smooth = True
Context Override Pattern
override = {"object": obj, "active_object": obj}
bpy.ops.object.modifier_apply(override, modifier="Boolean")
with bpy.context.temp_override(object=obj, active_object=obj):
bpy.ops.object.modifier_apply(modifier="Boolean")
def apply_modifier(obj, modifier_name):
if bpy.app.version >= (4, 0, 0):
with bpy.context.temp_override(object=obj, active_object=obj):
bpy.ops.object.modifier_apply(modifier=modifier_name)
else:
override = {"object": obj, "active_object": obj}
bpy.ops.object.modifier_apply(override, modifier=modifier_name)
Node Group Interface Pattern
node_group.inputs.new("NodeSocketFloat", "Width")
node_group.outputs.new("NodeSocketGeometry", "Geometry")
node_group.interface.new_socket(
name="Width", in_out='INPUT', socket_type='NodeSocketFloat'
)
node_group.interface.new_socket(
name="Geometry", in_out='OUTPUT', socket_type='NodeSocketGeometry'
)
EEVEE Identifier Pattern
import bpy
def get_eevee_identifier():
if bpy.app.version >= (5, 0, 0):
return 'BLENDER_EEVEE'
elif bpy.app.version >= (4, 2, 0):
return 'BLENDER_EEVEE_NEXT'
else:
return 'BLENDER_EEVEE'
scene = bpy.context.scene
scene.render.engine = get_eevee_identifier()
Extension Manifest Pattern
bl_info = {
"name": "My Addon",
"blender": (4, 0, 0),
"category": "Object",
"version": (1, 0, 0),
"description": "My addon description",
}
GPU Drawing Pattern (BGL → gpu Migration)
import bgl
bgl.glEnable(bgl.GL_BLEND)
bgl.glLineWidth(2)
shader = gpu.shader.from_builtin('3D_UNIFORM_COLOR')
import gpu
gpu.state.blend_set('ALPHA')
gpu.state.line_width_set(2.0)
shader = gpu.shader.from_builtin('POLYLINE_UNIFORM_COLOR')
gpu.state.blend_set('NONE')
gpu.state.line_width_set(1.0)
Compositor Access Pattern
scene = bpy.context.scene
scene.use_nodes = True
comp_tree = scene.node_tree
scene = bpy.context.scene
comp_tree = bpy.data.node_groups.new("MyComp", 'CompositorNodeTree')
scene.compositing_node_group = comp_tree
Slotted Actions Pattern (4.4+)
action = bpy.data.actions.new("MyAction")
fcurve = action.fcurves.new(data_path="location", index=0)
action = bpy.data.actions.new("MyAction")
slot = action.slots.new()
layer = action.layers.new(name="Layer")
strip = layer.strips.new(type='KEYFRAME')
channelbag = strip.channelbags.new(slot=slot)
fcurve = channelbag.fcurves.new(data_path="location", index=0)
3. Common Operations: Migration Checklists
3.x → 4.0 Migration Checklist
4.0 → 4.1 Migration Checklist
4.1 → 4.2 Migration Checklist
4.2 → 4.3 Migration Checklist
4.3 → 4.4 Migration Checklist
4.x → 5.0 Migration Checklist
5.0 → 5.1 Migration Checklist
4. Reference Links
Official Documentation