Timeline: Project items land where they are dropped (#89)
A Project item (or Media Browser file) dropped in the Timeline always went above the selected layer, starting where new layers start. Now, as in After Effects, a line shows where it goes in the stack (above the first layer row whose middle is below the pointer, else below the last), and over the time graph a marker with a timecode tag shows its In point, which follows the pointer (frame-snapped) or, with Shift, the current time. The layer reorder drag shares the insertion logic. layer.addItem and layer.newModel take `index` (1-based stack position); mediaBrowser.import passes `time` and `index` on, one layer under the other. Tests: project_items_land_where_they_are_dropped_in_the_timeline (ui_drag_drop.rs, real pointer drags: outline, time graph, Shift, below the last layer) and add_item_at_a_stack_index_and_time (engine). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
9e619d2893
commit
1a0940d50a
@@ -110,8 +110,13 @@ fn browser_import(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
&& s.active_comp_id().is_some()
|
||||
&& let Some(items) = r.get("items").and_then(Value::as_array)
|
||||
{
|
||||
for it in items {
|
||||
s.execute("layer.addItem", json!({"item": it}))?;
|
||||
// Where a drop put them (`time`, `index`): one under the other.
|
||||
for (k, it) in items.iter().enumerate() {
|
||||
let mut add = json!({"item": it, "time": p.get("time")});
|
||||
if let Some(i) = p.get("index").and_then(Value::as_u64) {
|
||||
add["index"] = json!(i.saturating_add(k as u64));
|
||||
}
|
||||
s.execute("layer.addItem", add)?;
|
||||
}
|
||||
}
|
||||
Ok(r)
|
||||
@@ -233,7 +238,15 @@ pub fn specs() -> Vec<CommandSpec> {
|
||||
cmd!("mediaBrowser.go", "Go to Folder", [], None, "{path?: folder | \"..\", importableOnly?}", browser_enabled, browser_go),
|
||||
cmd!("mediaBrowser.addFavorite", "Add to Favorites", [], None, "{path?}", browser_enabled, |s, p| browser_favorite(s, p, true)),
|
||||
cmd!("mediaBrowser.removeFavorite", "Remove from Favorites", [], None, "{path?}", browser_enabled, |s, p| browser_favorite(s, p, false)),
|
||||
cmd!("mediaBrowser.import", "Import", [], None, "{paths, addToComp?}", browser_enabled, browser_import),
|
||||
cmd!(
|
||||
"mediaBrowser.import",
|
||||
"Import",
|
||||
[],
|
||||
None,
|
||||
"{paths, addToComp?, time?, index? (where the layers go, as in layer.addItem)}",
|
||||
browser_enabled,
|
||||
browser_import
|
||||
),
|
||||
cmd!(
|
||||
"mediaBrowser.action",
|
||||
"Media Browser Action",
|
||||
|
||||
Reference in New Issue
Block a user