From 52f25e0bb1b112e3a730ef9da867932ad791b48c Mon Sep 17 00:00:00 2001 From: Olive Vaughn Date: Sun, 4 Oct 2026 02:11:17 -0400 Subject: [PATCH] Fix inspector automation clock for looped symbol instances --- frontend/src/arthur/ui/params.cljs | 8 +++++--- frontend/test/arthur/domain/nest_test.cljs | 15 +++++++++++++++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/frontend/src/arthur/ui/params.cljs b/frontend/src/arthur/ui/params.cljs index 7e2f50a..e20e3da 100644 --- a/frontend/src/arthur/ui/params.cljs +++ b/frontend/src/arthur/ui/params.cljs @@ -240,8 +240,8 @@ (let [[start end] (:span n) auto-key? @(rf/subscribe [::sub/auto-key?]) clip @(rf/subscribe [::render/clip]) - local @(rf/subscribe [::sub/selected-local]) - frame (:frame local) + placement @(rf/subscribe [::sub/selected-placement]) + frame (:frame placement) palette-id (or (get-in clip [:symbols sid :palette]) (pal/default-palette-id clip)) palette (get (pal/palettes clip) palette-id)] [section (str (name (:kind n)) " ยท in " (name sid)) @@ -259,7 +259,9 @@ #(rf/dispatch [::ui/rename-node sid id %])]] (when (:paint? n) [drawing-keys sid id n @(rf/subscribe [::sub/selected-local])]) [:div.row {:style {:margin-top "6px"}} [:span.dim "channels"]] - (let [{:keys [frame]} local] + ;; Channels belong to the placement, before its source playback clock. + ;; Entering the source would wrap keys on loops and pin them on holds. + (let [{:keys [frame]} placement] [:dl.facts (doall (for [[path ch] (sort-by (fn [[path]] diff --git a/frontend/test/arthur/domain/nest_test.cljs b/frontend/test/arthur/domain/nest_test.cljs index aba75ff..67c2f6f 100644 --- a/frontend/test/arthur/domain/nest_test.cljs +++ b/frontend/test/arthur/domain/nest_test.cljs @@ -16,6 +16,21 @@ (assoc-in [:symbols :loose] {:id :loose :frames 30 :nodes {}}) (clip/place-symbol nil :outer :inner 5 (random-uuid) nil))) +(deftest instance-channel-keys-use-placement-time-before-source-playback + (doseq [[speed end source-frame] [[2 :loop 3] [0 :stop 5]]] + (let [n {:id :insert :kind :instance :source {:symbol :inner} + :time {:at 5 :rate 1} :span [0 100] + :playback {:in 5 :speed speed :end end}} + c (-> (clip/blank) + (assoc-in [:symbols :inner] {:id :inner :frames 10 :fps 30 :nodes {}}) + (assoc-in [:symbols :main :nodes :insert] n)) + frame (:frame (nest/placement c nil :main [:insert] 29)) + keyed (node/set-keyed-channel n [:xform :rot] frame 1)] + (is (= source-frame (:frame (nest/inside c nil :main [:insert] 29)))) + (is (= 24 frame) "instance automation keeps advancing through loops and holds") + (is (= 1 (get-in keyed [:channels [:xform :rot] :keys 24]))) + (is (not (contains? (get-in keyed [:channels [:xform :rot] :keys]) source-frame)))))) + (deftest a-frame-is-carried-down-through-the-instances-a-row-path-names (let [c (nested) [id] (keys (get-in c [:symbols :outer :nodes]))