M0.9–M0.10: egui frontend (AE-style panels, viewer, timeline, effect controls, dialogs), desktop app with control channel, host wiring; cargo fmt
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
e2ba01a11f
commit
3a59a8470d
@@ -58,8 +58,16 @@ pub fn effects(ids: &mut Ids) -> PropGroup {
|
||||
}
|
||||
|
||||
/// Mask colours cycle like AE's default mask colours.
|
||||
pub const MASK_COLORS: [[u8; 3]; 8] =
|
||||
[[0xb1, 0xb4, 0x4f], [0x4f, 0x8c, 0xc9], [0xc9, 0x4f, 0x8c], [0x4f, 0xc9, 0x7a], [0xc9, 0x8c, 0x4f], [0x8c, 0x4f, 0xc9], [0x4f, 0xc9, 0xc9], [0xc9, 0x4f, 0x4f]];
|
||||
pub const MASK_COLORS: [[u8; 3]; 8] = [
|
||||
[0xb1, 0xb4, 0x4f],
|
||||
[0x4f, 0x8c, 0xc9],
|
||||
[0xc9, 0x4f, 0x8c],
|
||||
[0x4f, 0xc9, 0x7a],
|
||||
[0xc9, 0x8c, 0x4f],
|
||||
[0x8c, 0x4f, 0xc9],
|
||||
[0x4f, 0xc9, 0xc9],
|
||||
[0xc9, 0x4f, 0x4f],
|
||||
];
|
||||
|
||||
pub fn mask(ids: &mut Ids, name: &str, path: ShapePath, mode: MaskMode, color: [u8; 3]) -> PropGroup {
|
||||
let mut g = ids.group("mask", name);
|
||||
@@ -78,7 +86,11 @@ pub fn text(ids: &mut Ids, doc: TextDoc) -> PropGroup {
|
||||
.group("moreOptions", "More Options")
|
||||
.with(ids.prop("anchorGrouping", "Anchor Point Grouping", Value::Enum(0)).with_ui(popup(&["Character", "Word", "Line", "All"])))
|
||||
.with(ids.prop("groupingAlignment", "Grouping Alignment", Value::Vec2([0.0, 0.0])).with_ui(ParamUi::Percent))
|
||||
.with(ids.prop("fillStroke", "Fill & Stroke", Value::Enum(0)).with_ui(popup(&["Per Character Palette", "All Fills Over All Strokes", "All Strokes Over All Fills"])))
|
||||
.with(ids.prop("fillStroke", "Fill & Stroke", Value::Enum(0)).with_ui(popup(&[
|
||||
"Per Character Palette",
|
||||
"All Fills Over All Strokes",
|
||||
"All Strokes Over All Fills",
|
||||
])))
|
||||
.with(ids.prop("interCharBlend", "Inter-Character Blending", Value::Enum(0)).with_ui(popup(&["Normal", "Multiply", "Screen", "Overlay"])));
|
||||
ids.group("text", "Text").with(st).with(path_opts).with(more).with(ids.group("animators", "Animators"))
|
||||
}
|
||||
@@ -306,7 +318,8 @@ pub fn shape_simple_op(ids: &mut Ids, kind: &str) -> Option<PropGroup> {
|
||||
.with(ids.prop("miter", "Miter Limit", Value::Scalar(4.0)))
|
||||
.with(ids.prop("copies", "Copies", Value::Scalar(1.0)))
|
||||
.with(ids.prop("copyOffset", "Copy Offset", Value::Scalar(0.0))),
|
||||
"pucker" => indexed(ids.group("pucker", "Pucker & Bloat 1")).with(ids.prop("amount", "Amount", Value::Scalar(0.0)).with_ui(slider(-100.0, 100.0, -100.0, 100.0, 1))),
|
||||
"pucker" => indexed(ids.group("pucker", "Pucker & Bloat 1"))
|
||||
.with(ids.prop("amount", "Amount", Value::Scalar(0.0)).with_ui(slider(-100.0, 100.0, -100.0, 100.0, 1))),
|
||||
"twist" => indexed(ids.group("twist", "Twist 1"))
|
||||
.with(ids.prop("angle", "Angle", Value::Scalar(0.0)).with_ui(ParamUi::Angle))
|
||||
.with(ids.prop("center", "Center", Value::Vec2([0.0, 0.0])).with_ui(ParamUi::Point)),
|
||||
@@ -322,8 +335,13 @@ pub fn shape_simple_op(ids: &mut Ids, kind: &str) -> Option<PropGroup> {
|
||||
.with(ids.prop("correlation", "Correlation", Value::Scalar(50.0)).with_ui(ParamUi::Percent))
|
||||
.with(ids.prop("phase", "Temporal Phase", Value::Scalar(0.0)).with_ui(ParamUi::Angle))
|
||||
.with(ids.prop("seed", "Random Seed", Value::Scalar(0.0))),
|
||||
"merge" => indexed(ids.group("merge", "Merge Paths 1"))
|
||||
.with(ids.prop("mode", "Mode", Value::Enum(0)).with_ui(popup(&["Merge", "Add", "Subtract", "Intersect", "Exclude Intersections"]))),
|
||||
"merge" => indexed(ids.group("merge", "Merge Paths 1")).with(ids.prop("mode", "Mode", Value::Enum(0)).with_ui(popup(&[
|
||||
"Merge",
|
||||
"Add",
|
||||
"Subtract",
|
||||
"Intersect",
|
||||
"Exclude Intersections",
|
||||
]))),
|
||||
_ => return None,
|
||||
};
|
||||
Some(g)
|
||||
@@ -446,7 +464,8 @@ pub fn layer(project: &mut Project, comp: &Comp, name: &str, source: LayerSource
|
||||
g.children.push(ids.prop("poi", "Point of Interest", Value::Vec3([cw / 2.0, ch / 2.0, 0.0])).with_ui(ParamUi::Point3).spatial().into());
|
||||
}
|
||||
if kind != LightKind::Ambient {
|
||||
g.children.push(ids.prop("position", "Position", Value::Vec3([cw / 2.0 - 260.0, ch / 2.0 - 260.0, -440.0])).with_ui(ParamUi::Point3).spatial().into());
|
||||
g.children
|
||||
.push(ids.prop("position", "Position", Value::Vec3([cw / 2.0 - 260.0, ch / 2.0 - 260.0, -440.0])).with_ui(ParamUi::Point3).spatial().into());
|
||||
}
|
||||
root.children.push(g.into());
|
||||
root.children.push(light_options(&mut ids, kind).into());
|
||||
|
||||
+14
-14
@@ -241,16 +241,24 @@ impl LightKind {
|
||||
#[serde(tag = "type")]
|
||||
pub enum LayerSource {
|
||||
/// Footage item (video, still, sequence, audio).
|
||||
Footage { item: ItemId },
|
||||
Footage {
|
||||
item: ItemId,
|
||||
},
|
||||
/// Nested composition (precomp).
|
||||
Comp { item: ItemId },
|
||||
Comp {
|
||||
item: ItemId,
|
||||
},
|
||||
/// Solid item (solids also back adjustment layers).
|
||||
Solid { item: ItemId },
|
||||
Solid {
|
||||
item: ItemId,
|
||||
},
|
||||
Text,
|
||||
Shape,
|
||||
Null,
|
||||
Camera,
|
||||
Light { kind: LightKind },
|
||||
Light {
|
||||
kind: LightKind,
|
||||
},
|
||||
}
|
||||
|
||||
impl LayerSource {
|
||||
@@ -415,19 +423,11 @@ impl Layer {
|
||||
/// Layer time for a comp time (stretch-aware).
|
||||
pub fn layer_time(&self, comp_t: Tick) -> Tick {
|
||||
let d = comp_t - self.start_time;
|
||||
if (self.stretch - 100.0).abs() < 1e-9 {
|
||||
d
|
||||
} else {
|
||||
Tick((d.0 as f64 * 100.0 / self.stretch) as i64)
|
||||
}
|
||||
if (self.stretch - 100.0).abs() < 1e-9 { d } else { Tick((d.0 as f64 * 100.0 / self.stretch) as i64) }
|
||||
}
|
||||
/// Comp time for a layer time.
|
||||
pub fn comp_time(&self, layer_t: Tick) -> Tick {
|
||||
if (self.stretch - 100.0).abs() < 1e-9 {
|
||||
self.start_time + layer_t
|
||||
} else {
|
||||
self.start_time + Tick((layer_t.0 as f64 * self.stretch / 100.0) as i64)
|
||||
}
|
||||
if (self.stretch - 100.0).abs() < 1e-9 { self.start_time + layer_t } else { self.start_time + Tick((layer_t.0 as f64 * self.stretch / 100.0) as i64) }
|
||||
}
|
||||
pub fn transform(&self) -> Option<&PropGroup> {
|
||||
self.props.sub("transform")
|
||||
|
||||
+12
-12
@@ -182,7 +182,8 @@ pub enum MaskMode {
|
||||
}
|
||||
|
||||
impl MaskMode {
|
||||
pub const ALL: [MaskMode; 7] = [MaskMode::None, MaskMode::Add, MaskMode::Subtract, MaskMode::Intersect, MaskMode::Lighten, MaskMode::Darken, MaskMode::Difference];
|
||||
pub const ALL: [MaskMode; 7] =
|
||||
[MaskMode::None, MaskMode::Add, MaskMode::Subtract, MaskMode::Intersect, MaskMode::Lighten, MaskMode::Darken, MaskMode::Difference];
|
||||
pub fn label(self) -> &'static str {
|
||||
match self {
|
||||
MaskMode::None => "None",
|
||||
@@ -299,13 +300,9 @@ impl PropGroup {
|
||||
match seg {
|
||||
Seg::Uid(u) => self.children.iter().position(|c| c.uid() == *u),
|
||||
Seg::Index(i) => (*i >= 1 && *i <= self.children.len()).then(|| i - 1),
|
||||
Seg::Match(m, n) => self
|
||||
.children
|
||||
.iter()
|
||||
.enumerate()
|
||||
.filter(|(_, c)| c.match_id() == m || c.name().eq_ignore_ascii_case(m))
|
||||
.nth(n.saturating_sub(1))
|
||||
.map(|(i, _)| i),
|
||||
Seg::Match(m, n) => {
|
||||
self.children.iter().enumerate().filter(|(_, c)| c.match_id() == m || c.name().eq_ignore_ascii_case(m)).nth(n.saturating_sub(1)).map(|(i, _)| i)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -492,10 +489,13 @@ impl PropGroup {
|
||||
}
|
||||
}
|
||||
pub fn max_uid(&self) -> Uid {
|
||||
self.children.iter().map(|c| match c {
|
||||
Node::Prop(p) => p.uid,
|
||||
Node::Group(g) => g.max_uid(),
|
||||
}).fold(self.uid, Uid::max)
|
||||
self.children
|
||||
.iter()
|
||||
.map(|c| match c {
|
||||
Node::Prop(p) => p.uid,
|
||||
Node::Group(g) => g.max_uid(),
|
||||
})
|
||||
.fold(self.uid, Uid::max)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,12 @@ fn project_with_layer() -> (Project, crate::ItemId) {
|
||||
let mut p = Project::default();
|
||||
let comp = Comp::new(1920, 1080, FrameRate::FPS_29_97, Tick::from_seconds_f64(10.0));
|
||||
let cid = p.add_item("Main", effectcraft_color::Label::Sandstone, None, ItemKind::Comp(comp.clone().into()));
|
||||
let sid = p.add_item("Red Solid", effectcraft_color::Label::Red, None, ItemKind::Solid(Solid { color: [1.0, 0.0, 0.0], width: 1920, height: 1080, pixel_aspect: 1.0 }));
|
||||
let sid = p.add_item(
|
||||
"Red Solid",
|
||||
effectcraft_color::Label::Red,
|
||||
None,
|
||||
ItemKind::Solid(Solid { color: [1.0, 0.0, 0.0], width: 1920, height: 1080, pixel_aspect: 1.0 }),
|
||||
);
|
||||
let layer = build::layer(&mut p, &comp, "Red Solid 1", LayerSource::Solid { item: sid }, (1920, 1080), None);
|
||||
p.comp_mut(cid).unwrap().layers.push(layer);
|
||||
(p, cid)
|
||||
|
||||
Reference in New Issue
Block a user