Skip to content

addKeyframe captures live bone pose + auto-key wiring #383

Description

@fernandotonon

Overview

Two related improvements that build toward #358 (bone manipulation gizmo) without requiring the full gizmo first:

1. addKeyframe should capture the live bone pose

Currently AnimationControlController::addKeyframe() calls getInterpolatedKeyFrame() which samples the existing animation curve at the scrub time. If the curve is identity at that moment (or empty), the new keyframe is identity TRS — the user reports it as "adding a blank registry".

The right behavior: read the bone's current local TRS via bone->getPosition()/getOrientation()/getScale() relative to its initial pose. Same math the blender's bake (slice B) and dope sheet's MoveKeyframeCommand TRS preservation already use.

2. Re-add the autoKey toggle, wired to scene-node end-of-drag

Slice A originally shipped this and we ripped it out (see #358's history) because it was meaningless without a bone gizmo. With the addKeyframe fix above, auto-key on any transform commit becomes useful: scrub to a time, drag the entity, release → a keyframe lands on the active bone with its current pose.

Restore:

  • autoKey Q_PROPERTY on AnimationControlController.
  • Auto Key toggle in qml/AnimationControlPanel.qml.
  • TransformOperator end-of-drag → if autoKey is on and a bone-track is selected, call addKeyframe().

This isn't a full bone gizmo — that lives in #358 as the proper solution — but it's the simplest thing that gives users the "drag and capture pose" workflow today.

Out of scope (still in #358)

  • Click bones in viewport (vs. selecting the entity)
  • Bone-direct gizmo (gizmo anchored to bone derived position rather than scene node)
  • BoneTransformCommand for bone-only undo

The bone gizmo work is bigger than this issue — ray-pick against SkeletonDebug bone entities, add/wire a per-bone gizmo target, new command class. Tracking it separately under #358 keeps that PR reviewable.

Tests

  • AddKeyframeCapturesBonePose: drag the scene node, scrub to a fresh time, addKeyframe, verify the new keyframe's TRS matches the bone's current local pose.
  • AutoKeyOnTransformPushesKeyframe: enable auto-key, drag, release → a keyframe is added at the current scrub time. Disable → no keyframe.

Acceptance

  • Adding a keyframe with the +KF button captures the bone's actual pose, not identity
  • Auto Key toggle visible in Animation Control panel; persists via Q_PROPERTY
  • With Auto Key on, transforming the entity creates keyframes on the active bone-track
  • Linux CI: 2 new tests pass

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions