Communitygithub.com

ComeOnOliver/skillshub

Importez, traitez et retargetez des données de capture de mouvement dans Blender en utilisant Python. Travaillez avec des fichiers BVH/FBX, suivez le mouvement de la caméra et d'objets à partir de vidéos, résolvez des trajectoires 3D et nettoyez les données d'animation — le tout scriptable depuis le terminal.

Qu'est-ce que skillshub ?

Cette compétence permet aux agents IA d’interagir avec des données de capture de mouvement (mocap) dans Blender de manière programmatique via Python. Elle couvre l’import de fichiers BVH et FBX, le retargeting d’animation entre des armatures (par exemple Mixamo vers Rigify), le nettoyage par décimation de courbes, le suivi vidéo avec résolution de caméra 3D, et l’export vers BVH ou FBX. Utile pour les développeurs et artistes techniques, elle s’exécute entièrement en mode headless (`blender --background`) et prend en charge le traitement par lots de bibliothèques entières de mocap. La compétence fournit des extraits de code prêts à l’emploi et des conseils sur la mise à l’échelle, la correspondance des noms d’os et la qualité de suivi.

Compatible avec~Claude Code~Codex CLI~Cursor
npx skills add https://github.com/ComeOnOliver/skillshub/tree/HEAD/skills/TerminalSkills/skills/blender-motion-capture

Demander à votre IA préférée

Ouvre une nouvelle conversation avec cette compétence d'agent déjà préchargée.

Documentation

Capture de mouvement Blender

Aperçu

Importez, traitez et retargetez des données de capture de mouvement dans Blender en utilisant Python. Travaillez avec des fichiers BVH/FBX, suivez le mouvement de la caméra et d'objets à partir de vidéos, résolvez des trajectoires 3D et nettoyez les données d'animation — le tout scriptable depuis le terminal.

Instructions

1. Importer des fichiers de capture de mouvement BVH

import bpy

bpy.ops.import_anim.bvh(
    filepath="/chemin/vers/mocap.bvh",
    target='ARMATURE',
    global_scale=1.0,
    frame_start=1,
    use_fps_scale=False,
    rotate_mode='NATIVE',
    axis_forward='-Z', axis_up='Y'
)

armature = bpy.context.active_object
action = armature.animation_data.action
print(f"Importé : {armature.name}, Os : {len(armature.data.bones)}, Images : {action.frame_range}")

2. Importer FBX avec animation

bpy.ops.import_scene.fbx(
    filepath="/chemin/vers/mocap.fbx",
    use_anim=True,
    ignore_leaf_bones=True,
    automatic_bone_orientation=True,
    primary_bone_axis='Y', secondary_bone_axis='X'
)

3. Retargeter le mouvement entre armatures

from mathutils import Matrix

def retarget_motion(source_armature, target_armature, bone_mapping):
    """Retargete une animation en utilisant un dictionnaire de correspondance : {os_cible : os_source}"""
    source_action = source_armature.animation_data.action
    frame_start, frame_end = int(source_action.frame_range[0]), int(source_action.frame_range[1])

    if not target_armature.animation_data:
        target_armature.animation_data_create()
    new_action = bpy.data.actions.new(f"{source_action.name}_retarget")
    target_armature.animation_data.action = new_action

    for frame in range(frame_start, frame_end + 1):
        bpy.context.scene.frame_set(frame)
        for tgt_name, src_name in bone_mapping.items():
            src = source_armature.pose.bones.get(src_name)
            tgt = target_armature.pose.bones.get(tgt_name)
            if not src or not tgt:
                continue
            tgt.rotation_quaternion = src.rotation_quaternion
            tgt.keyframe_insert(data_path="rotation_quaternion", frame=frame)
            # Copier la position uniquement pour l'os racine
            if src_name == list(bone_mapping.values())[0]:
                tgt.location = src.location
                tgt.keyframe_insert(data_path="location", frame=frame)

# Exemple de correspondance Mixamo → Rigify
mapping = {
    "spine": "mixamorig:Hips", "spine.001": "mixamorig:Spine",
    "spine.004": "mixamorig:Neck", "spine.006": "mixamorig:Head",
    "upper_arm.L": "mixamorig:LeftArm", "forearm.L": "mixamorig:LeftForeArm",
    "upper_arm.R": "mixamorig:RightArm", "forearm.R": "mixamorig:RightForeArm",
    "thigh.L": "mixamorig:LeftUpLeg", "shin.L": "mixamorig:LeftLeg",
    "thigh.R": "mixamorig:RightUpLeg", "shin.R": "mixamorig:RightLeg",
}

4. Nettoyer les données de capture de mouvement

def decimate_fcurve(fcurve, factor=0.5):
    """Supprime des images clés pour réduire les données tout en conservant la forme."""
    points = fcurve.keyframe_points
    total = len(points)
    keep_every = max(1, int(1.0 / factor))
    remove_indices = [i for i in range(total) if i % keep_every != 0 and i != 0 and i != total - 1]
    for i in reversed(remove_indices):
        points.remove(points[i])

armature = bpy.context.active_object
action = armature.animation_data.action
for fcurve in action.fcurves:
    decimate_fcurve(fcurve, factor=0.5)
    fcurve.update()

5. Suivi vidéo et résolution de caméra

# Charger la vidéo
clip = bpy.data.movieclips.load("/chemin/vers/video.mp4")
scene = bpy.context.scene
scene.active_clip = clip

# Configurer le suivi
tracking = clip.tracking
settings = tracking.settings
settings.default_pattern_size = 21
settings.default_search_size = 71
settings.default_motion_model = 'AFFINE'

# Paramètres de la caméra pour la résolution
camera = tracking.camera
camera.sensor_width = 36.0
camera.focal_length = 50.0

# Résoudre le mouvement de la caméra
bpy.ops.clip.solve_camera()
solve_error = tracking.reconstruction.average_error
print(f"Erreur de résolution : {solve_error:.4f} px ({'Bon' if solve_error < 0.5 else 'Nécessite un affinage'})")

# Configurer la scène à partir des données résolues
bpy.ops.clip.setup_tracking_scene()

6. Appliquer le mouvement suivi à des objets

obj = bpy.data.objects["MonObjet"]
constraint = obj.constraints.new(type='FOLLOW_TRACK')
constraint.clip = clip
constraint.track = tracking.tracks["Marqueur_01"]
constraint.use_3d_position = True
constraint.camera = scene.camera

# Cuire la contrainte en images clés
bpy.context.view_layer.objects.active = obj
obj.select_set(True)
bpy.ops.nla.bake(
    frame_start=1, frame_end=clip.frame_duration,
    only_selected=True, visual_keying=True,
    clear_constraints=True, bake_types={'OBJECT'}
)

7. Exporter les données d'animation

# Exporter en BVH
bpy.ops.export_anim.bvh(
    filepath="/tmp/mocap_sortie.bvh",
    frame_start=int(action.frame_range[0]),
    frame_end=int(action.frame_range[1]),
    rotate_mode='NATIVE'
)

# Exporter en FBX avec animation cuite
bpy.ops.export_scene.fbx(
    filepath="/tmp/anim_sortie.fbx",
    use_selection=True, bake_anim=True,
    bake_anim_use_all_bones=True, add_leaf_bones=False
)

Exemples

Exemple 1 : Parcourir en lot une bibliothèque de mocap

Demande de l'utilisateur : "Importer tous les fichiers BVH d'un dossier, lister le nombre d'os et les plages d'images"

import bpy, glob, os

for filepath in sorted(glob.glob("/chemin/vers/bibliotheque_mocap/*.bvh")):
    bpy.ops.object.select_all(action='SELECT')
    bpy.ops.object.delete()
    bpy.ops.import_anim.bvh(filepath=filepath, target='ARMATURE', global_scale=0.01, frame_start=1)
    arm = bpy.context.active_object
    if arm and arm.animation_data:
        action = arm.animation_data.action
        duree = (action.frame_range[1] - action.frame_range[0]) / bpy.context.scene.render.fps
        print(f"{os.path.basename(filepath)} : {len(arm.data.bones)} os, {duree:.1f}s")

Exécutez : blender --background --python scan_mocap.py

Exemple 2 : Appliquer une mocap à un personnage et rendre

Demande de l'utilisateur : "Importer un fichier BVH, l'appliquer à mon personnage riggé et rendre un aperçu"

import bpy

bpy.ops.wm.open_mainfile(filepath="/chemin/vers/personnage.blend")
char_armature = bpy.data.objects["Armature"]

bpy.ops.import_anim.bvh(filepath="/chemin/vers/cycle_marche.bvh", target='ARMATURE', global_scale=0.01)
mocap_armature = bpy.context.active_object
mocap_action = mocap_armature.animation_data.action

# Transférer l'action (fonctionne si les noms d'os correspondent)
if not char_armature.animation_data:
    char_armature.animation_data_create()
char_armature.animation_data.action = mocap_action

# Supprimer l'armature temporaire, définir la plage d'images, ajouter une caméra, rendre
bpy.data.objects.remove(mocap_armature)
scene = bpy.context.scene
scene.frame_start, scene.frame_end = int(mocap_action.frame_range[0]), int(mocap_action.frame_range[1])
scene.render.filepath = "/tmp/apercu_mocap/image_"
bpy.ops.render.render(animation=True)

Directives

  • Le BVH est le plus simple (texte brut avec hiérarchie + mouvement). Le FBX supporte des données plus riches (formes de mélange, prises multiples).
  • L'échelle compte : les fichiers BVH utilisent souvent les centimètres. Définissez global_scale=0.01 pour les fichiers en cm.
  • La correspondance des noms d'os est cruciale pour le retargeting. Construisez un dictionnaire de correspondance pour chaque format source.
  • Pour le retargeting, copiez les rotations pour tous les os mais seulement la position pour l'os racine/hanche.
  • Nettoyez les mocap importées en décimant les images clés — la mocap brute a des clés à chaque image, ce qui rend l'édition difficile.
  • La qualité de la résolution de caméra dépend du nombre et de la distribution des marqueurs. Utilisez 8+ marqueurs bien répartis, gardez l'erreur en dessous de 0.5 px.
  • Utilisez bpy.ops.nla.bake() pour convertir les contraintes en images clés pour l'export.
  • Exportez toujours avec bake_anim=True dans FBX pour aplatir les bandes NLA et les contraintes.

Individual skills in this repo

This repo contains 20 individual skills — each has its own dedicated page.

ComeOnOliver/skillshub

Create stunning, animation-rich HTML presentations from scratch or by converting PowerPoint files. Use when the user wants to build a presentation, convert a PPT/PPTX to web, or create slides for a talk/pitch. Helps non-designers discover their aesthetic through visual exploration rather than abstract choices.

ComeOnOliver/skillshub

Next.js 16+ 和 Turbopack — 增量打包、文件系统缓存、开发速度,以及何时使用 Turbopack 与 webpack。

ComeOnOliver/skillshub

SwiftUI architecture patterns, state management with @Observable, view composition, navigation, performance optimization, and modern iOS/macOS UI best practices.

ComeOnOliver/skillshub

See, Understand, Act on video and audio. See- ingest from local files, URLs, RTSP/live feeds, or live record desktop; return realtime context and playable stream links. Understand- extract frames, build visual/semantic/temporal indexes, and search moments with timestamps and auto-clips. Act- transcode and normalize (codec, fps, resolution, aspect ratio), perform timeline edits (subtitles, text/image overlays, branding, audio overlays, dubbing, translation), generate media assets (image, audio, video), and create real time alerts for events from live streams or desktop capture.

ComeOnOliver/skillshub

AI-assisted video editing workflows for cutting, structuring, and augmenting real footage. Covers the full pipeline from raw capture through FFmpeg, Remotion, ElevenLabs, fal.ai, and final polish in Descript or CapCut. Use when the user wants to edit video, cut footage, create vlogs, or build video content.

ComeOnOliver/skillshub

Next.js 15 애플리케이션을 위한 프론트엔드 개발 가이드라인. React 19, TypeScript, Shadcn/ui, Tailwind CSS를 사용한 모던 패턴. Server Components, Client Components, App Router, 파일 구조, Shadcn/ui 컴포넌트, 성능 최적화, TypeScript 모범 사례 포함. 컴포넌트, 페이지, 기능 생성, 데이터 페칭, 스타일링, 라우팅, 프론트엔드 코드 작업 시 사용.

ComeOnOliver/skillshub

Provides Tamagui patterns for config v4, compiler optimization, styled context, and cross-platform styling. Must use when working with Tamagui projects (tamagui.config.ts, @tamagui imports).

ComeOnOliver/skillshub

Create distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.

ComeOnOliver/skillshub

Create high-converting, visually distinctive landing pages. Use when building marketing pages, product launches, SaaS homepages, or any single-page conversion-focused website. Guides section-by-section composition with anti-AI-slop principles.

ComeOnOliver/skillshub

Auto-loaded context for Portfolio Buddy 2 development. Use for ANY task involving: React 19 development, TypeScript, portfolio analysis features, metrics calculations, trading strategy comparison, or working with the Portfolio Buddy 2 codebase. Contains tech stack, known issues, and architectural constraints.

ComeOnOliver/skillshub

Next.js development tooling via MCP. Inspect routes, components, build info, and debug Next.js apps. Use when working on Next.js applications, debugging routing, or inspecting app structure. NOT for general React or non-Next.js projects.

ComeOnOliver/skillshub

Implement UI using Shadcn MCP (atoms/theme) and 21st.dev MCP (complex sections). Use when adding buttons, layouts, or generating landing pages.

ComeOnOliver/skillshub

A conceptual skill for building an API client in Next.js that handles JWT tokens

ComeOnOliver/skillshub

Best practices and patterns for Next.js App Router, Server Actions, and Routing in this project.

ComeOnOliver/skillshub

The Design System, Theme, and UX rules for the Physical AI Hub.

ComeOnOliver/skillshub

Comprehensive frontend development skill for building modern, performant web applications using ReactJS, NextJS, TypeScript, Tailwind CSS. Includes component scaffolding, performance optimization, bundle analysis, and UI best practices. Use when developing frontend features, optimizing performance, implementing UI/UX designs, managing state, or reviewing frontend code.

ComeOnOliver/skillshub

This document captures learnings from fixing keyboard navigation issues when floating components (Select, DropdownMenu, Popover) have CSS open/close animations.

ComeOnOliver/skillshub

Build Next.js 16 applications with correct patterns and distinctive design. Use when creating pages, layouts, dynamic routes, upgrading from Next.js 15, or implementing proxy.ts. Covers breaking changes (async params/searchParams, Turbopack, cacheComponents) and frontend aesthetics. NOT when building non-React or backend-only applications.

ComeOnOliver/skillshub

Comprehensive Framer Motion animation library for React. Covers motion components, variants, gestures, page transitions, and scroll animations. Use when adding animations to React/Next.js applications.

ComeOnOliver/skillshub

Build interfaces that resonate, not just render. This skill enforces bold, intentional

Skills associés