depsgraph-and-evaluated-datalisted
Install: claude install-skill TMHSDigital/Blender-Developer-Tools
# Depsgraph and Evaluated Data
## Trigger
Use this skill when the user:
- Is writing an exporter, measurement script, or inspection tool
- Reports that "modifiers are missing from my export" or "the vertex positions don't match what I see"
- Mentions `evaluated_depsgraph_get`, `evaluated_get`, `to_mesh`, `to_mesh_clear`
- Reads from `obj.data.vertices` and gets unexpectedly raw geometry
- Needs final positions after armature deformation, shape keys, modifiers, or geometry nodes
## The core misunderstanding
`bpy.data.objects['Cube'].data.vertices` does not return what the user sees in the viewport. It returns the **mesh datablock as authored**, before any modifier, armature, shape key, or geometry nodes evaluation.
The viewport shows **evaluated** geometry: the result of running the full dependency graph. Anything that downstream code consumes (renderers, exporters, measurement tools) almost always wants the evaluated form, not the raw form.
```
authored mesh (obj.data)
|
v
modifier stack
shape keys
armature deform
geometry nodes
|
v
evaluated mesh (what you see)
```
## The canonical pattern
```python
import bpy
def get_evaluated_mesh(obj):
"""Return a temporary mesh datablock with all modifiers applied.
The caller must call obj_eval.to_mesh_clear() when done to free the
temporary mesh. Do not store this mesh; treat it as read-only and
short-lived.
"""
depsgraph = bpy.context.evaluated_depsgraph_get()