M7.3: Auto-Orient (along path, towards camera), Draft 3D, 3D switch off drops Z

- layer.autoOrient {mode: off|alongPath|towardsCamera|towardsPointOfInterest}
  (Layer > Transform > Auto-Orient…, Cmd+Alt+O); render support for Orient
  Along Path (2D and 3D) and Orient Towards Camera (with recursion guard).
- Layers parented to cameras/lights follow their full rotation.
- Draft 3D turns off lights and shadows (and DOF).
- Turning the 3D switch off discards Z values, Orientation and X/Y Rotation.
- Tests for all of the above.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Brandon Thomas
2026-10-01 22:42:27 -04:00
co-authored by Claude Opus 5.5
parent 16a5fa7a83
commit 37c07ba5b1
8 changed files with 311 additions and 18 deletions
+31 -1
View File
@@ -363,13 +363,43 @@ fn set_switch_value(l: &mut Layer, name: &str, v: bool) {
"frameBlend" => sw.frame_blend = if v { FrameBlend::FrameMix } else { FrameBlend::Off },
"motionBlur" => sw.motion_blur = v,
"adjustment" => sw.adjustment = v,
"threeD" | "3d" | "3D" => sw.three_d = v,
"threeD" | "3d" | "3D" => {
if sw.three_d && !v {
drop_3d_values(l);
}
l.switches.three_d = v;
}
"guide" => sw.guide = v,
"preserveTransparency" => l.preserve_transparency = v,
_ => {}
}
}
/// Turning the 3D switch off discards Z values, Orientation and X/Y Rotation (as in AE).
fn drop_3d_values(l: &mut Layer) {
let Some(tr) = l.transform_mut() else { return };
for (m, keep) in [("position", 0.0), ("anchor", 0.0), ("scale", 100.0)] {
if let Some(pr) = tr.get_mut(m) {
let flat = |v: &mut KV| {
if let KV::Vec3(a) = v {
a[2] = keep;
}
};
flat(&mut pr.value);
for k in &mut pr.keys {
flat(&mut k.value);
}
}
}
for (m, zero) in [("orientation", KV::Vec3([0.0; 3])), ("rotationX", KV::Scalar(0.0)), ("rotationY", KV::Scalar(0.0))] {
if let Some(pr) = tr.get_mut(m) {
pr.keys.clear();
pr.expr = None;
pr.value = zero;
}
}
}
fn rename(s: &mut Session, p: &Value) -> Result<Value> {
let (cid, lid) = layer_p(s, p, "layer.rename")?;
let name = str_p(p, "name").ok_or_else(|| bad("layer.rename", "missing `name`"))?.to_string();