Skip to content

FilmCraft: An open-source, nonlinear video editor written by scratch in pure Rust

Merge main into #864 (imports)

Brandon Thomasccfd43f68c1f
diff --cc crates/engine/src/commands.rs
index 6d99827d4,90cb5f77c..ad20f3d10
--- a/crates/engine/src/commands.rs
+++ b/crates/engine/src/commands.rs
@@@ -2011,10 -2211,10 +2223,10 @@@ fn build() -> Vec<CommandSpec>
return Ok(v);
}
let (_seq, ph) = marker_list_mut(s)?;
- let t = time_p(s, p, "").unwrap_or(ph);
+ let t = sequence_time_p(s, p, "", "markers.add")?.unwrap_or(ph);
let name = str_p(p, "name").unwrap_or("").to_string();
let comment = str_p(p, "comment").unwrap_or("").to_string();
- let color = str_p(p, "color").and_then(Label::from_name).unwrap_or(Label::Green);
+ let color = marker_color_p(p, "markers.add")?.unwrap_or(Label::Green);
let dur = p.get("durationFrames").and_then(Value::as_i64).map(|f| s.sequence_rate().tick_of(f)).unwrap_or_default();
let id = s.edit_sequence("Add Marker", |q, ctx, _| {
let id = MarkerId(ctx.alloc());
diff --cc crates/engine/src/sequence_extras.rs
index c67870107,8b5d8e6d8..e8966758d
--- a/crates/engine/src/sequence_extras.rs
+++ b/crates/engine/src/sequence_extras.rs
@@@ -20,7 -20,7 +20,7 @@@ use filmcraft_project::{ClipId, ItemKin
use filmcraft_time::{Tick, TimeRange};
use serde_json::{Value, json};
- use crate::commands::{CommandSpec, bad, bool_p, f64_p, has_seq, marker_color_p, str_p, time_p, u64_p};
-use crate::commands::{CommandSpec, bad, bool_p, f64_p, has_seq, sequence_time_p, str_p, u64_p};
++use crate::commands::{CommandSpec, bad, bool_p, f64_p, has_seq, marker_color_p, sequence_time_p, str_p, u64_p};
use crate::{EngineError, Result, Session};
type Run = fn(&mut Session, &Value) -> Result<Value>;
diff --cc crates/engine/src/sequence_tools.rs
index c3dd3db06,b2a1016a5..ec8cbecba
--- a/crates/engine/src/sequence_tools.rs
+++ b/crates/engine/src/sequence_tools.rs
@@@ -31,7 -31,7 +31,7 @@@ use filmcraft_project::{AudioChannels,
use filmcraft_time::{Tick, TimeRange};
use serde_json::{Value, json};
- use crate::commands::{CommandSpec, always, bad, bool_p, clips_p, has_seq, marker_color_p, str_p, time_p, track_p, with_links};
-use crate::commands::{CommandSpec, always, bad, bool_p, clips_p, has_seq, sequence_time_p, str_p, time_p, track_p, with_links};
++use crate::commands::{CommandSpec, always, bad, bool_p, clips_p, has_seq, marker_color_p, sequence_time_p, str_p, time_p, track_p, with_links};
use crate::{EngineError, Result, Session};
type Run = fn(&mut Session, &Value) -> Result<Value>;
@@@ -206,10 -206,10 +206,10 @@@ fn groups() -> Vec<(&'static str, Vec<C
r#"{"time":ticks?,"name":str?,"comment":str?,"color":label?}"#,
has_seq,
|s, p| {
- let t = time_p(s, p, "").unwrap_or(s.playhead());
+ let t = sequence_time_p(s, p, "", "markers.addChapter")?.unwrap_or(s.playhead());
let n = s.active_sequence().map(|q| q.markers.iter().filter(|m| m.kind == MarkerKind::Chapter).count()).unwrap_or(0) + 1;
let name = str_p(p, "name").map(str::to_string).unwrap_or_else(|| format!("Chapter {n}"));
- let id = add_marker(s, "Add Chapter Marker", t, Tick::ZERO, MarkerKind::Chapter, name, p)?;
+ let id = add_marker(s, "markers.addChapter", "Add Chapter Marker", t, Tick::ZERO, MarkerKind::Chapter, name, p)?;
Ok(json!({"marker": id.0}))
},
),