Logo: Slotted Actions Animation

Slotted Actions Animation

Communautéit
TMHSDigital
slotted-actions-animation

Create and edit animation from Python under Slotted Actions (Blender 4.4+): Action, slots, layers, strips, channelbags. Bind the action slot, then reach F-curves through a channelbag; action_ensure_channelbag_for_slot exists only on 5.0+, so use strip.channelbag(slot, ensure=True) on 4.5 LTS. Use when the user inserts keyframes or builds F-curves in a script, hits AttributeError on action.fcurves in 5.x, or has keys that exist but never play back. Targets 5.2 LTS with 4.5 LTS fallback.

Iwwersiicht

EditeurTMHSDigital
RepositoryBlender-Developer-Tools
Skill-Nummslotted-actions-animation
Stären
20
Forks
5
Matgeliwwert Dateien
Nëmmen Instruktiounen
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • Alles an den Instruktiounen

    Alles, wat de Modell brauch, steet an den Instruktiounen — keng zousätzlech Dateien ze synchroniséieren.

  • Open Source

    TMHSDigital huet de Skill op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Slotted Actions Animation an TypingMind, fir e mat all LLM ze benotzen, oder setzt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vu GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier, déi hei drënner steet, an a bestätegt d'Installatioun.
    https://github.com/TMHSDigital/Blender-Developer-Tools/tree/main/skills/slotted-actions-animation
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill derbäisetzen → Iwwer eng GitHub-URL. Pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an d'Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/TMHSDigital/Blender-Developer-Tools.git /tmp/Blender-Developer-Tools
mkdir -p .claude/skills
cp -r /tmp/Blender-Developer-Tools/skills/slotted-actions-animation .claude/skills/slotted-actions-animation
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Slotted Actions Animation an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Slotted Actions Animation automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Slotted Actions Animation net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Schlësselen.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Slotted Actions Animation

Trigger

Use this skill when the user:

  • Wants to create or edit animation from Python in Blender 5.x
  • Mentions Action, slot, channelbag, keyframe_insert, fcurves
  • Has older 4.x animation code (action.fcurves.new(...)) that no longer works in 5.x
  • Asks how to insert keyframes programmatically and have them persist

What changed and why

Blender 4.4 introduced the Slotted Actions data model to support non-linear, multi-target animation. The old model was a flat list of F-curves owned directly by the Action, which made it impossible for one Action to drive two different IDs (e.g. an armature pose and the armature's custom property channels at the same time) without overwriting each other.

Two version boundaries matter:

  • Blender 4.4 / 4.5 LTS: the slotted data model (action.slots, action.layers, strip.channelbag) is present alongside the legacy flat API (action.fcurves, action.groups, action.id_root), which still works as a proxy. The helper bpy_extras.anim_utils.action_get_channelbag_for_slot(action, slot) exists; action_ensure_channelbag_for_slot does not.
  • Blender 5.0+: the legacy flat API was removed (action.fcurves raises AttributeError). The new helper bpy_extras.anim_utils.action_ensure_channelbag_for_slot(action, slot) is added.

The slotted model:

Action
  Slots[]           # one per ID being driven
  Layers[]          # animation layers, blendable
    Strips[]        # time ranges within a layer
      Channelbags[] # one per slot, holds the actual F-curves
        FCurves[]

On 5.0+, code that walks action.fcurves directly raises AttributeError because that property was removed; the F-curves live inside a Channelbag inside a Strip inside a Layer. On 4.4 / 4.5 LTS action.fcurves still works as a proxy.

Getting a channelbag across versions

bpy_extras.anim_utils.action_ensure_channelbag_for_slot(action, slot) is new in Blender 5.0. It ensures the Action has a Layer, a Strip in that Layer, and a Channelbag for the given Slot, then returns the Channelbag. It does not exist on 4.4 / 4.5 LTS — there is no auto-detecting shim, and importing-and-calling it on 4.5 raises AttributeError.

On 4.4 / 4.5 LTS, ensure the channelbag yourself with strip.channelbag(slot, ensure=True) (the slotted model is present there). The still-present legacy action.fcurves is a trap on a fresh Action: it creates a slot but does not bind it (see the legacy section below). So a genuinely cross-version helper must branch on bpy.app.version:

Import path (5.0+) verified against the Blender 5.1 API reference: bpy_extras.anim_utils.action_ensure_channelbag_for_slot(action, slot). See bpy_extras.anim_utils.

python
import bpy


def get_channelbag_for_slot(action, slot):
    """Return the Channelbag for `slot`, creating layer/strip/channelbag as needed.

    Verified on Blender 4.5.10 LTS and 5.1.1.
    """
    if bpy.app.version >= (5, 0, 0):
        from bpy_extras.anim_utils import action_ensure_channelbag_for_slot
        return action_ensure_channelbag_for_slot(action, slot)
    # 4.4 / 4.5 LTS: the ensure-helper does not exist; build the path explicitly.
    layer = action.layers[0] if action.layers else action.layers.new("Layer")
    strip = layer.strips[0] if layer.strips else layer.strips.new(type='KEYFRAME')
    return strip.channelbag(slot, ensure=True)


def get_channelbag_for_object(obj):
    """Return the Channelbag for obj's animation, creating Action and Slot if needed."""
    if obj.animation_data is None:
        obj.animation_data_create()

    action = obj.animation_data.action
    if action is None:
        action = bpy.data.actions.new(name=f"{obj.name}_Action")
        obj.animation_data.action = action

    # Slots exist on 4.4+; create and bind one for this ID if not set.
    slot = obj.animation_data.action_slot
    if slot is None:
        slot = action.slots.new(id_type='OBJECT', name=obj.name)
        obj.animation_data.action_slot = slot

    return get_channelbag_for_slot(action, slot)

# Usage: every F-curve write goes through the slot's channelbag, on 4.5 and 5.x.
cbag = get_channelbag_for_object(bpy.context.active_object)
fc = cbag.fcurves.new(data_path="location", index=2)
fc.keyframe_points.insert(1, 0.0)
assert bpy.context.active_object.animation_data.action_slot is not None

The version boundary that matters is bpy.app.version >= (5, 0, 0) (legacy removed / ensure-helper added), not hasattr(action, "slots") — action.slots is present on 4.4 and 4.5 too, so that check does not distinguish 4.5 from 5.x.

Inserting keyframes the cross-version way

The high-level obj.keyframe_insert(data_path, frame=...) works on both 4.5 LTS and 5.x and is the preferred entry point for most cases. Blender takes care of the slot/layer/strip/channelbag plumbing internally.

python
import bpy

obj = bpy.context.active_object
obj.location = (0.0, 0.0, 0.0)
obj.keyframe_insert(data_path="location", frame=1)

obj.location = (5.0, 0.0, 0.0)
obj.keyframe_insert(data_path="location", frame=24)

Each keyframe_insert adds keys for all three components of location (since it's a vector). index=0 would key only X.

This works on 4.5 LTS and 5.x without any version branching.

When you need direct F-curve access

For programmatic curve construction (importing motion capture, writing a curve solver, building a baked animation track), you need the F-curves directly:

python
import bpy
# get_channelbag_for_slot is the cross-version helper defined above.


def get_or_create_fcurve(obj, data_path, index):
    if obj.animation_data is None:
        obj.animation_data_create()

    action = obj.animation_data.action
    if action is None:
        action = bpy.data.actions.new(f"{obj.name}_Action")
        obj.animation_data.action = action

    slot = obj.animation_data.action_slot
    if slot is None:
        slot = action.slots.new(id_type='OBJECT', name=obj.name)
        obj.animation_data.action_slot = slot

    cbag = get_channelbag_for_slot(action, slot)

    fcurve = next(
        (fc for fc in cbag.fcurves if fc.data_path == data_path and fc.array_index == index),
        None,
    )
    if fcurve is None:
        fcurve = cbag.fcurves.new(data_path=data_path, index=index)
    return fcurve


def bake_translation(obj, frame_value_pairs):
    """frame_value_pairs is an iterable of ((frame, x, y, z), ...)."""
    fcs = [get_or_create_fcurve(obj, "location", i) for i in range(3)]

    for frame, x, y, z in frame_value_pairs:
        fcs[0].keyframe_points.insert(frame, x, options={'FAST'})
        fcs[1].keyframe_points.insert(frame, y, options={'FAST'})
        fcs[2].keyframe_points.insert(frame, z, options={'FAST'})

    for fc in fcs:
        fc.update()

Notes:

  • options={'FAST'} skips per-insertion sorting and curve update; call fc.update() once at the end.
  • cbag.fcurves is the unified access point on both 4.4/4.5 LTS and 5.x. The get_channelbag_for_slot helper above returns the slot's real Channelbag on every version (via strip.channelbag(slot, ensure=True) on 4.4/4.5, the ensure-helper on 5.0+).

The legacy action.fcurves path (4.4 / 4.5 LTS only)

On 4.4 and 4.5 LTS the legacy flat API is still present, but on a fresh Action it does not bind a slot. action.fcurves.new(...) creates a slot named Legacy Slot and leaves obj.animation_data.action_slot as None, so the keys exist and the object never animates. Bind the slot yourself after the first legacy write:

python
import bpy

obj = bpy.context.active_object
if obj is None:
    raise RuntimeError("no active object")
if obj.animation_data is None:
    obj.animation_data_create()
if obj.animation_data.action is None:
    obj.animation_data.action = bpy.data.actions.new(name=f"{obj.name}_Action")

action = obj.animation_data.action
fcurve = action.fcurves.new(data_path="location", index=0)
if obj.animation_data.action_slot is None:
    # The legacy write created the slot but did not assign it.
    obj.animation_data.action_slot = action.slots[0]
fcurve.keyframe_points.insert(1, 0.0)
fcurve.keyframe_points.insert(24, 5.0)

Measured on 4.5.11 LTS: without the action_slot line, frame_set(24) leaves the object at its rest value. Prefer the channelbag path (get_channelbag_for_slot above), which binds the slot before writing on every version. On 5.0+ the action.fcurves attribute was removed entirely, so action.fcurves.new(...) raises AttributeError.

Detecting the version boundaries

python
import bpy

def has_slotted_model():
    # action.slots / layers / strip.channelbag: shipped in Blender 4.4.
    return bpy.app.version >= (4, 4, 0)

def legacy_fcurves_removed():
    # action.fcurves / groups / id_root removed, and
    # action_ensure_channelbag_for_slot added: Blender 5.0.
    return bpy.app.version >= (5, 0, 0)

The slotted data model (and action.slots) is meaningful on 4.4 and 4.5 too, so do not gate slot code behind >= (5, 0). The boundary that decides legacy-removal and which channelbag helper exists is >= (5, 0, 0) — that is the check get_channelbag_for_slot uses above.

Common AI mistakes

  1. Using legacy action.fcurves.new(...) in 5.x code. On Blender 5.0+ the action.fcurves property was removed, so this raises AttributeError: 'Action' object has no attribute 'fcurves'. Go through a channelbag instead.

  2. Forgetting the slot binding:

    python
    action = bpy.data.actions.new("A")
    obj.animation_data.action = action
    # Missing: setting obj.animation_data.action_slot

    Without a slot binding, the Action has no idea which datablock it drives. Symptom: animation plays back as if it isn't there. On 4.5 LTS the legacy action.fcurves.new(...) path hits this silently: it creates a slot but never assigns it.

  3. Hardcoding the import path to where it was in some older 5.x. Verify against current docs:

    • 5.1+: from bpy_extras.anim_utils import action_ensure_channelbag_for_slot
  4. Not calling fcurve.update() after bulk inserts with options={'FAST'}. The curve is internally sorted and analytically prepared by update().

  5. Treating obj.animation_data as always present. It is None on a fresh object. Call obj.animation_data_create() first.

  6. Using keyframe_insert for high-volume baking. It is convenient but slow for thousands of frames. Use direct F-curve access with options={'FAST'} for performance.

Compatibility paths summary

Operation4.4 / 4.5 LTS5.xCross-version
Insert a single keyframeobj.keyframe_insert("location", frame=1)SameHigh-level API works on both
Get the F-curves for an Action+Slotstrip.channelbag(slot, ensure=True) (legacy action.fcurves only with an explicit action_slot bind)action_ensure_channelbag_for_slot(action, slot)get_channelbag_for_slot(action, slot) (branches on version)
Create an Actionbpy.data.actions.new(...)SameSame
Bind Action to IDobj.animation_data.action = action + action_slotSameaction_slot is settable on 4.4+; set both

Related

  • addon-scaffolding for the registration of animation-driving operators
  • Snippet action-ensure-channelbag-for-slot.py for a minimal copy-paste

Runnable examples

Each 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.

  • turntable: A slotted-actions Z-rotation turntable keyed through the cross-version channelbag path (get_channelbag_for_slot). Falsify: --no-keys (exit 3).

Snippets

Short standalone patterns to copy. Each one runs in CI on 5.2 and 4.5 with a check and a falsifier.

References

Heefeg gestallte Froen

Wat mécht de KI-Skill Slotted Actions Animation?

Create and edit animation from Python under Slotted Actions (Blender 4.4+): Action, slots, layers, strips, channelbags. Bind the action slot, then reach F-curves through a channelbag; action_ensure_channelbag_for_slot exists only on 5.0+, so use strip.channelbag(slot, ensure=True) on 4.5 LTS. Use when the user inserts keyframes or builds F-curves in a script, hits AttributeError on action.fcurves in 5.x, or has keys that exist but never play back. Targets 5.2 LTS with 4.5 LTS fallback.

Firwat Slotted Actions Animation op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Slotted Actions Animation besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt, amplaz en Abonnement pro Benotzerplaz ze bezuelen. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Slotted Actions Animation an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/TMHSDigital/Blender-Developer-Tools/tree/main/skills/slotted-actions-animation an. TypingMind liest d'Datei SKILL.md an installéiert de Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Slotted Actions Animation benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Slotted Actions Animation benotzen?

Esou vill wéi Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Slotted Actions Animation domat benotzen – zum Beispill mat GPT, Claude, Gemini, Grok, DeepSeek, Mistral oder Llama – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Slotted Actions Animation gratis?

TMHSDigital huet de Skill op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbare Pak vun Instruktiounen, deen engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt e maache soll a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a kee Lafzäitëmfeld a funktionéiere mat all Modell.

Alleguer weisen

Elo Ären eegene KI-Aarbechtsberäich ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇