Onion skin ghosts the lane a drawing is in
It ghosted the selected row, and a stroke selects the shape it drew, which exists on its own cel's frames only: the ghosts went out at the first stroke. Inside a lane, the nearest lane is what is ghosted, so the neighbouring drawings stay on. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011FLuCjp9kNH6ovwJVXSbq9
This commit is contained in:
parent
1a92a103cc
commit
796bb9ae6b
2 changed files with 33 additions and 7 deletions
|
|
@ -10,6 +10,7 @@
|
|||
[arthur.domain.nest :as nest]
|
||||
[arthur.domain.node :as node]
|
||||
[arthur.domain.pick :as pick]
|
||||
[arthur.domain.symbol :as symbol]
|
||||
[arthur.footage.store :as store]
|
||||
[arthur.subs.playback :as playback]
|
||||
[arthur.subs.render :as render]
|
||||
|
|
@ -108,6 +109,30 @@
|
|||
(when clip
|
||||
(creation/target clip (:store (store/entry clip-id)) open selection f))))
|
||||
|
||||
(rf/reg-sub
|
||||
::onion-scope
|
||||
:<- [::selection]
|
||||
:<- [::render/clip]
|
||||
:<- [::render/clip-id]
|
||||
:<- [::render/open]
|
||||
:<- [::render/open-frame]
|
||||
;; WHAT ONION SKIN GHOSTS: the selection's row, or the lane it is in. A cel,
|
||||
;; and anything drawn in one, is on screen for its own few frames, so ghosting
|
||||
;; it ghosts nothing either side — and drawing selects the shape just drawn,
|
||||
;; which put the onion out at the first stroke. A lane's neighbours are its
|
||||
;; other drawings, which is what onion skin is for. The nearest lane, so a
|
||||
;; lane drawn inside a cel of another ghosts its own drawings.
|
||||
(fn [[[kind _ id path] clip clip-id open f] _]
|
||||
(if-not (= :node kind)
|
||||
[]
|
||||
(let [path (vec (or path [id]))
|
||||
st (some-> clip-id store/entry :store)
|
||||
lane? #(when-let [{:keys [sid]} (and clip (nest/inside clip st open % f))]
|
||||
(symbol/lane? (clip/symbol clip sid)))]
|
||||
(or (some #(let [up (pop %)] (when (and (seq up) (lane? up)) up))
|
||||
(take-while seq (iterate pop path)))
|
||||
path)))))
|
||||
|
||||
(rf/reg-sub
|
||||
::creation-placement
|
||||
:<- [::creation-target]
|
||||
|
|
|
|||
|
|
@ -140,7 +140,8 @@
|
|||
;; symbol's stacking context.
|
||||
:target (rf/subscribe [::ui-sub/creation-target])
|
||||
:onion (rf/subscribe [::layout/onion])
|
||||
:selection (rf/subscribe [::ui-sub/selection])})
|
||||
:selection (rf/subscribe [::ui-sub/selection])
|
||||
:ghosting (rf/subscribe [::ui-sub/onion-scope])})
|
||||
(fn [{:keys [draft hover tone fit target] :as s} _]
|
||||
(-> s
|
||||
(dissoc :draft :hover :tone :fit :target)
|
||||
|
|
@ -163,8 +164,8 @@
|
|||
;; in the editor's own state, so it changes what the canvases should
|
||||
;; show without touching the frame number OR the resolver.
|
||||
(when-not (and (identical? (:resolver before) (:resolver now))
|
||||
(= (select-keys before [:tracing :pen :mat :onion :selection :playing? :preview :solo?])
|
||||
(select-keys now [:tracing :pen :mat :onion :selection :playing? :preview :solo?])))
|
||||
(= (select-keys before [:tracing :pen :mat :onion :selection :ghosting :playing? :preview :solo?])
|
||||
(select-keys now [:tracing :pen :mat :onion :selection :ghosting :playing? :preview :solo?])))
|
||||
(repaint!))))))
|
||||
|
||||
;; The brush or eraser stroke being painted: its mask, mutated in place as the
|
||||
|
|
@ -195,14 +196,14 @@
|
|||
(declare op-path reach)
|
||||
|
||||
(defn- paint-onions!
|
||||
"Ghost the picture `onion/frames` either side of `f`: the selected node's ops
|
||||
when a node is selected, everything otherwise. Each ghost is rasterised as
|
||||
"Ghost the picture `onion/frames` either side of `f`: the ops of
|
||||
`::ui-sub/onion-scope` — the selection's row, or the lane it is in —
|
||||
everything when nothing is selected. Each ghost is rasterised as
|
||||
far as it reaches inside `[vx vy wx wy]`, what is on screen, as the picture
|
||||
is, and the canvas covers them all."
|
||||
[f [vx vy wx wy]]
|
||||
(let [{:keys [onion-canvas]} @state
|
||||
{:keys [onion playing? resolver frames selection width height]} @snapshot
|
||||
path (if (= :node (first selection)) (or (nth selection 3 nil) [(nth selection 2)]) [])
|
||||
{:keys [onion playing? resolver frames width height] path :ghosting} @snapshot
|
||||
ghosts (when (and onion-canvas (:on? onion) (not playing?))
|
||||
(into []
|
||||
(keep (fn [{:keys [frame direction]}]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue