Merge pull request #1098 from vangel76/feat-gap21-percent-guides-effect-labels

# Conflicts:
#	crates/engine/src/tests_menu_cmds.rs
#	docs/effects-parity.md
#	docs/gaps.md
#	docs/ui-parity.md
This commit is contained in:
Brandon Thomas
2026-10-13 04:29:06 -04:00
20 changed files with 301 additions and 25 deletions
+9 -1
View File
@@ -487,7 +487,15 @@ fn build_group(project: &Project, comp: ItemId, eg: &EssentialGraphics, old: Opt
}
}
}
PropGroup { uid, match_id: GROUP.into(), name: "Essential Properties".into(), kind: GroupKind::Essential { overridden: keep }, enabled: true, children }
PropGroup {
uid,
match_id: GROUP.into(),
name: "Essential Properties".into(),
kind: GroupKind::Essential { overridden: keep },
enabled: true,
label: None,
children,
}
}
fn find_prop<'a>(nodes: &'a [Node], m: &str) -> Option<&'a Property> {
+30
View File
@@ -467,7 +467,37 @@ pub struct Comp {
#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize)]
pub struct Guide {
pub vertical: bool,
/// Comp pixels, or percent of the comp's width (vertical) / height (horizontal) when
/// [`Guide::percent`] is set.
pub position: f64,
/// A percentage guide (After Effects 26.5): `position` is a percent of the comp's size, so the
/// guide keeps its relative place when the comp is resized. Absent in older projects.
#[serde(default, skip_serializing_if = "std::ops::Not::not")]
pub percent: bool,
}
impl Guide {
/// The comp's extent along this guide's axis, never zero.
fn extent(&self, width: u32, height: u32) -> f64 {
f64::from(if self.vertical { width } else { height }).max(1.0)
}
/// The guide's position in comp pixels for a comp of this size.
pub fn px(&self, width: u32, height: u32) -> f64 {
if self.percent { self.position / 100.0 * self.extent(width, height) } else { self.position }
}
/// Place the guide at `px` comp pixels, keeping its unit.
pub fn set_px(&mut self, px: f64, width: u32, height: u32) {
self.position = if self.percent { px / self.extent(width, height) * 100.0 } else { px };
}
/// Switch between pixels and percent without moving the guide on the comp.
pub fn set_percent(&mut self, percent: bool, width: u32, height: u32) {
let px = self.px(width, height);
self.percent = percent;
self.set_px(px, width, height);
}
}
fn yes() -> bool {
+5 -1
View File
@@ -255,6 +255,10 @@ pub struct PropGroup {
/// fx switch for effects, eye for shape groups, etc.
#[serde(default = "yes")]
pub enabled: bool,
/// An effect's colour label (After Effects 26.5), shown in Effect Controls and the Timeline;
/// `None` is unlabelled. Absent in older projects.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub label: Option<effectcraft_color::Label>,
#[serde(default)]
pub children: Vec<Node>,
}
@@ -344,7 +348,7 @@ impl PropGroup {
}
pub fn new(uid: Uid, match_id: &str, name: &str) -> PropGroup {
PropGroup { uid, match_id: match_id.into(), name: name.into(), kind: GroupKind::Plain, enabled: true, children: vec![] }
PropGroup { uid, match_id: match_id.into(), name: name.into(), kind: GroupKind::Plain, enabled: true, label: None, children: vec![] }
}
pub fn with(mut self, n: impl Into<Node>) -> PropGroup {
self.children.push(n.into());