Open the palette lane onto its selected transition, like any lane

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Olive Vaughn 2026-10-10 19:52:34 -04:00
parent 1a6d6564c5
commit c359ac650f
2 changed files with 53 additions and 17 deletions

View file

@ -365,26 +365,39 @@
(walk sid [] 0 identity) (walk sid [] 0 identity)
[]))))) [])))))
(defn palette-track-row (defn palette-track-rows
"`sid`'s palette row: ONE LANE ROW WHETHER OR NOT THE LANE EXISTS YET, because "`sid`'s palette rows. Its row: ONE LANE ROW WHETHER OR NOT THE LANE EXISTS YET, because
a person putting a palette transition somewhere is doing the same thing in a person putting a palette transition somewhere is doing the same thing in
either case. Empty, it names the symbol whose palette it would be; filled, it either case. Empty, it names the symbol whose palette it would be; filled, it
is the lane symbol's own row under this pane's name for it." is the lane symbol's own row under this pane's name for it, and opens as any
lane does: onto the selected transition, its keys and channels."
[clip sid frames expanded chosen] [clip sid frames expanded chosen]
(let [track-id (get-in clip [:symbols sid :palette-track]) (let [track-id (get-in clip [:symbols sid :palette-track])
track (get-in clip [:symbols track-id])] track (get-in clip [:symbols track-id])]
(if (= :palette-track (:type track)) (if (= :palette-track (:type track))
;; A MATERIALIZED TRACK IS AN ORDINARY LANE ROW, selection and all: it is ;; A MATERIALIZED TRACK IS AN ORDINARY LANE ROW, selection, portal and
;; the row `rows` already draws for a lane symbol, wearing this pane's ;; all: it is what `rows` already draws for a lane symbol, wearing this
;; name for it. Only the row of a track that does not exist yet has to say ;; pane's name for it. Only the row of a track that does not exist yet has
;; whose palette it would be, which is what creating in it needs. ;; to say whose palette it would be, which is what creating in it needs.
(-> (first (rows clip track-id expanded chosen)) ;;
(assoc :path [::palette-track] :owner track-id ;; `rows` calls a lane's own row `[::lane]`, which is also the open
:label "palette" :kind :palette ;; symbol's when that is a lane, so this row goes by `[::palette-track]`
:expandable? false :expanded? false)) ;; and is translated on the way in. The portal's rows keep their authored
{:path [::palette-track] :depth 0 :label "palette" :kind :palette ;; paths -- the clip ids are the track's own -- and carry the track as
:lane? true :owner nil :select [::palette-track sid] ;; their `:owner`, so dragging them slides the clip in the track.
:span [0 frames] :keys [] :cels []}))) (let [expanded (cond-> (disj (set expanded) [::lane])
(contains? (set expanded) [::palette-track]) (conj [::lane]))
[lane & more] (rows clip track-id expanded chosen)]
(into [(assoc lane :path [::palette-track] :owner track-id
:label "palette" :kind :palette)]
(comp (take-while #(pos? (:depth %)))
(map #(cond-> (assoc % :owner track-id)
(= ::lane (first (:path %)))
(assoc :path (into [::palette-track] (rest (:path %)))))))
more))
[{:path [::palette-track] :depth 0 :label "palette" :kind :palette
:lane? true :owner nil :select [::palette-track sid]
:span [0 frames] :keys [] :cels []}])))
(defn sound-rows (defn sound-rows
"Audio rows use the same flattened intervals as the mixer, including source "Audio rows use the same flattened intervals as the mixer, including source
@ -1395,7 +1408,7 @@
{:id ::drop :label (str "+ " (:label drop)) :ghost? true {:id ::drop :label (str "+ " (:label drop)) :ghost? true
:span drop-span}) :span drop-span})
chosen (when (= :node (first selection)) (nth selection 3)) chosen (when (= :node (first selection)) (nth selection 3))
picture (cond-> (cond->> (into [(palette-track-row clip open frames expanded chosen)] picture (cond-> (cond->> (into (palette-track-rows clip open frames expanded chosen)
(rows clip open expanded chosen)) (rows clip open expanded chosen))
lane-ghost lane-ghost
(mapv (fn [row] (mapv (fn [row]

View file

@ -98,19 +98,42 @@
"creating in a lane does not move the playhead")))) "creating in a lane does not move the playhead"))))
(deftest the-palette-row-is-a-lane-row-whether-or-not-its-track-exists (deftest the-palette-row-is-a-lane-row-whether-or-not-its-track-exists
(let [empty-row (timeline/palette-track-row (clip/blank) :main 120 #{} nil) (let [empty-row (first (timeline/palette-track-rows (clip/blank) :main 120 #{} nil))
filled (-> (clip/blank) filled (-> (clip/blank)
(assoc-in [:symbols :main :palette-track] :track) (assoc-in [:symbols :main :palette-track] :track)
(assoc-in [:symbols :track] (assoc-in [:symbols :track]
{:id :track :type :palette-track :display :lane {:id :track :type :palette-track :display :lane
:frames 120 :nodes {}})) :frames 120 :nodes {}}))
filled-row (timeline/palette-track-row filled :main 120 #{} nil)] filled-row (first (timeline/palette-track-rows filled :main 120 #{} nil))]
;; The double-click that creates in a lane asks nothing else of a row. ;; The double-click that creates in a lane asks nothing else of a row.
(is (:lane? empty-row)) (is (:lane? empty-row))
(is (:lane? filled-row)) (is (:lane? filled-row))
(is (= [:node :track nil []] (:select filled-row)) (is (= [:node :track nil []] (:select filled-row))
"a track that exists is addressed as the lane it is"))) "a track that exists is addressed as the lane it is")))
(deftest the-palette-row-opens-onto-the-selected-transition-like-any-lane
(let [doc (-> (clip/blank)
(assoc-in [:symbols :main :palette-track] :track)
(assoc-in [:symbols :night] {:id :night :type :palette :frames 1 :nodes {}})
(assoc-in [:symbols :track]
{:id :track :type :palette-track :display :lane :frames 120
:nodes {:p {:id :p :kind :instance :source :night :span [10 40]
:time {:mode :map :at 10 :rate 1}
:channels {[:pos] {:keys {0 [0 0] 12 [5 0]}}}}}}))
closed (timeline/palette-track-rows doc :main 120 #{} [:p])
[lane portal & channels] (timeline/palette-track-rows
doc :main 120 #{[:arthur.ui.timeline/palette-track] [:p]} [:p])]
(is (= 1 (count closed)))
(is (:expandable? (first closed)) "the palette lane has a disclosure like any lane")
(is (:expanded? lane))
(is (= [:p] (:path portal)) "the portal is the selected transition, by its own path")
(is (= [:node :track :p [:p]] (:select portal)))
(is (= :track (:owner portal)) "dragging its bar slides it in the track")
(is (= [10 22] (:keys portal)) "its keys are on this ruler")
(is (= [:p [:pos]] (:path (first channels))) "and it opens onto its channels")
(is (not (contains? #{[:arthur.ui.timeline/lane]} (:path lane)))
"the palette lane never shares the open lane's expansion")))
(deftest the-same-double-click-command-creates-a-palette-symbol-on-the-palette-row (deftest the-same-double-click-command-creates-a-palette-symbol-on-the-palette-row
(let [doc (clip/blank) (let [doc (clip/blank)
id (store/install! {:clip doc :store {}} "double-click-palette-symbol")] id (store/install! {:clip doc :store {}} "double-click-palette-symbol")]