Viewer: a straight motion path has Bezier handles to curve it (#290)
The Position motion path drew a key's spatial handles only where its tangent wasn't zero, and auto-Bezier keys have none at the path's ends, so a two-key path (the usual start) had no handles to pull it into a curve. Auto-Bezier keys now show a handle on such a side too, pointing where the path leaves the key, a third of the way to the next key; dragging it makes the key Bezier with that tangent. Linear keys still show none. Keyframe Interpolation > Spatial Bezier copied those zero tangents, so the keys stayed straight with no handles (and read back as Linear); it now gives them the same handles. The path keeps its shape and timing. The handles come from the new keyframe::spatial_handles. Tests: spatial_bezier_gives_a_straight_path_handles (engine), a_straight_motion_path_has_handles_to_curve_it (ui_viewer). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
5b05a5ae80
commit
ed5ad56eb5
@@ -292,7 +292,13 @@ pub(crate) fn motion_path(app: &mut EffectcraftApp, painter: &egui::Painter, map
|
||||
}
|
||||
let v = k.value.as_vec3();
|
||||
let s = to_scr(v);
|
||||
let (tin, tout) = effectcraft_engine::keyframe::spatial_tangents(&pos.keys, i);
|
||||
// Auto-Bezier keys show handles on a side the path leaves straight too (a two-key path's
|
||||
// ends), to drag it into a curve; Linear keys (no tangents) show none.
|
||||
let (tin, tout) = if k.spatial_auto {
|
||||
effectcraft_engine::keyframe::spatial_handles(&pos.keys, i)
|
||||
} else {
|
||||
effectcraft_engine::keyframe::spatial_tangents(&pos.keys, i)
|
||||
};
|
||||
for (out, tg) in [(false, tin), (true, tout)] {
|
||||
let has = (out && i + 1 < pos.keys.len()) || (!out && i > 0);
|
||||
if !has || (tg[0] == 0.0 && tg[1] == 0.0) {
|
||||
|
||||
Reference in New Issue
Block a user