#783: Object Matte tool in the Composition viewer
Problem: Object Matte could only be applied through the objectMatte.apply command; After Effects 26.2 picks the object directly in the viewer (click it, or drag a box around it). Fix: an Object Matte tool (with Roto Brush & Refine Edge in the Alt+W slot, icon drawn in code). In the Composition viewer a click sets a point prompt and a drag a box prompt (its centre the point) on the footage, solid or comp layer under the pointer, converted to layer pixels through the layer's transform. The layer's Object Matte (the selected one, else its last) is re-prompted; Shift adds another. Everything goes through objectMatte.apply, which gained `effect` to re-prompt an instance (point, box or no box, reference frame; the reach kept unless given), so each prompt is one undo step; the effect is then selected, so its point controls show in the viewer. Hover draws a crosshair and the outline of the layer that would get the matte (a live matte preview would need a segmentation per pointer move). Automation ids: viewer.objectMatte.crosshair / .target / .box, tools.ObjectMatte. Tests: ui-egui ui_object_matte (hover, click, drag box re-prompts the same effect, Shift-click adds one, undo steps); engine tests_roto::object_matte_reprompt_updates_the_instance. Checked with the headless snapshot example (hover crosshair, box drag isolating a disk). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4fc7b52351
commit
0c695cff77
@@ -113,6 +113,11 @@ pub fn reference_frame(params: &Params) -> i64 {
|
||||
frames(params, "objectTracking/referenceFrame", -1e9, 1e9)
|
||||
}
|
||||
|
||||
/// Frames Before / After (finite, clamped to `0..=MAX_REACH`).
|
||||
pub fn reach(params: &Params) -> [i64; 2] {
|
||||
[frames(params, "objectTracking/framesBefore", 0.0, MAX_REACH), frames(params, "objectTracking/framesAfter", 0.0, MAX_REACH)]
|
||||
}
|
||||
|
||||
/// Whether the matte is carried from the reference frame (else every frame is segmented on its
|
||||
/// own).
|
||||
pub fn tracks(params: &Params) -> bool {
|
||||
@@ -170,8 +175,7 @@ pub fn prompt_strokes(params: &Params, layer_size: [f64; 2], frame: i64, with_mo
|
||||
pub fn roto_data(params: &Params, layer_size: [f64; 2], f: i64, with_model: bool) -> Option<RotoData> {
|
||||
if tracks(params) {
|
||||
let base = reference_frame(params);
|
||||
let before = frames(params, "objectTracking/framesBefore", 0.0, MAX_REACH);
|
||||
let after = frames(params, "objectTracking/framesAfter", 0.0, MAX_REACH);
|
||||
let [before, after] = reach(params);
|
||||
let strokes = prompt_strokes(params, layer_size, base, with_model)?;
|
||||
Some(RotoData { base: Some(base), span: [base.saturating_sub(before), base.saturating_add(after)], strokes })
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user