Command Palette

Search for a command to run...

Назад к скиллам
скилл № 91509

blender-animation

Animates 3D objects and characters in Blender with Python (bpy): keyframes, armatures and IK rigs, shape keys, F-Curves, the NLA editor and drivers. Use when…

БесплатноБез исполняемых скриптов
TerminalSkillsот TerminalSkills★ 221 звезда на GitHub33 установки в других каталогах

Установить blender-animation в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Об этом скилле

Blender Animation

Overview

Create and control animations in Blender using Python: keyframe object and bone transforms, build armatures with IK rigs, animate shape keys, edit F-Curves, layer actions in the NLA editor and wire up drivers, all from a script.

Since Blender 4.4 an Action is layered and has slots: a slot says which data-block an Action animates, and the F-Curves live in a channelbag on a keyframe strip inside a layer. Blender 5.0 removed the old shortcuts action.fcurves, action.groups and action.id_root, so code from older tutorials raises AttributeError: 'Action' object has no attribute 'fcurves'. obj.keyframe_insert(...) still works unchanged and creates the action, slot and channelbag for you. Run scripts in the background:

blender --background --factory-startup --python animate.py

A factory-startup scene contains Cube, Camera and Light.

Instructions

1. Keyframe object properties

import bpy
obj = bpy.data.objects["Cube"]
for loc, frame in [((0, 0, 0), 1), ((5, 0, 3), 30), ((5, 4, 0), 60)]:
    obj.location = loc
    obj.keyframe_insert(data_path="location", frame=frame)
obj.rotation_euler = (0, 0, 3.14159)
obj.keyframe_insert(data_path="rotation_euler", frame=60)
obj.scale = (2, 2, 2)
obj.keyframe_insert(data_path="scale", frame=60)
obj["intensity"] = 1.0                                        # custom property
obj.keyframe_insert(data_path='["intensity"]', frame=30)
obj.keyframe_insert(data_path="location", index=2, frame=45)  # one axis only (Z)
bpy.context.scene.frame_start, bpy.context.scene.frame_end = 1, 60

The created action is obj.animation_data.action and its slot is obj.animation_data.action_slot.

2. Control F-Curve interpolation and modifiers

F-Curves are reached through the channelbag of the slot:

import bpy
from bpy_extras import anim_utils
obj = bpy.data.objects["Cube"]
anim = obj.animation_data
channelbag = anim_utils.action_get_channelbag_for_slot(anim.action, anim.action_slot)
for fcurve in channelbag.fcurves:
    for kp in fcurve.keyframe_points:
        kp.interpolation = 'BEZIER'   # CONSTANT, LINEAR, BEZIER, SINE, EXPO, BOUNCE, ELASTIC
        kp.easing = 'EASE_IN_OUT'     # AUTO, EASE_IN, EASE_OUT, EASE_IN_OUT
    mod = fcurve.modifiers.new(type='CYCLES')   # loop the animation
    mod.mode_before = mod.mode_after = 'REPEAT'  # NONE, REPEAT, REPEAT_OFFSET, MIRROR
z_curve = channelbag.fcurves.find("location", index=2)
if z_curve:
    noise = z_curve.modifiers.new(type='NOISE')
    noise.strength, noise.scale = 0.3, 5.0
# Get-or-create a curve in a named channel group
fc = channelbag.fcurves.ensure("location", index=0, group_name="Object Transforms")

anim_utils.action_ensure_channelbag_for_slot(action, slot) creates the layer, strip and channelbag when none exist.

3. Create armatures and bones

import bpy
arm_data = bpy.data.armatures.new("Rig")
arm_obj = bpy.data.objects.new("Rig", arm_data)
bpy.context.collection.objects.link(arm_obj)
bpy.context.view_layer.objects.active = arm_obj
bpy.ops.object.mode_set(mode='EDIT')
# (name, head, tail, parent_name, connected)
bone_defs = [
    ("Spine",      (0, 0, 1.0),   (0, 0, 1.4),    None,         False),
    ("Chest",      (0, 0, 1.4),   (0, 0, 1.8),    "Spine",      False),
    ("UpperArm.L", (0.2, 0, 1.7), (0.5, 0, 1.4),  "Chest",      False),
    ("Forearm.L",  (0.5, 0, 1.4), (0.8, 0, 1.1),  "UpperArm.L", True),
    ("Thigh.L",    (0.1, 0, 1.0), (0.1, 0, 0.5),  "Spine",      False),
    ("Shin.L",     (0.1, 0, 0.5), (0.1, 0, 0.05), "Thigh.L",    True),
]
for name, head, tail, parent, connected in bone_defs:
    b = arm_data.edit_bones.new(name)
    b.head, b.tail = head, tail
    if parent:
        b.parent = arm_data.edit_bones[parent]
        b.use_connect = connected
bpy.ops.object.mode_set(mode='OBJECT')

4. Constraints on bones

import bpy
arm_obj = bpy.data.objects["Rig"]
for name, loc in (("IK_Target", (0.8, 0, 1.1)), ("IK_Pole", (0.5, -1, 1.4)), ("ChestCtrl", (0, 0, 2))):
    empty = bpy.data.objects.new(name, None)          # an Empty: object data is None
    empty.location = loc; bpy.context.collection.objects.link(empty)
bpy.context.view_layer.objects.active = arm_obj
bpy.ops.object.mode_set(mode='POSE')
ik = arm_obj.pose.bones["Forearm.L"].constraints.new('IK')
ik.target = bpy.data.objects["IK_Target"]
ik.pole_target = bpy.data.objects["IK_Pole"]
ik.chain_count = 2                                    # 0 = whole chain up to the root
cr = arm_obj.pose.bones["Chest"].constraints.new('COPY_ROTATION')
cr.target = bpy.data.objects["ChestCtrl"]

5. Keyframe bone poses

Pose bones default to quaternion rotation, so set rotation_mode = 'XYZ' before keying rotation_euler. Keying creates the action; rename it afterwards:

import bpy, math
arm_obj = bpy.data.objects["Rig"]
bpy.context.view_layer.objects.active = arm_obj
bpy.ops.object.mode_set(mode='POSE')
thigh = arm_obj.p
Полный SKILL.md на GitHub

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

  • _scores.json

FAQ

Что делает скилл blender-animation?

Animates 3D objects and characters in Blender with Python (bpy): keyframes, armatures and IK rigs, shape keys, F-Curves, the NLA editor and drivers. Use when the user wants to keyframe properties, create armatures and rigs, set up IK/FK chains, animate shape keys for facial animation, edit F-Curves, blend actions with NLA strips, add drivers, or script any animation workflow in Blender from the terminal.

Как установить скилл blender-animation?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл blender-animation запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить blender-animation с