Fix inspector automation clock for looped symbol instances

This commit is contained in:
Olive Vaughn 2026-10-04 02:11:17 -04:00
parent 4d441ae606
commit 52f25e0bb1
2 changed files with 20 additions and 3 deletions

View file

@ -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]]

View file

@ -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]))