M3.4: After Effects menu-bar parity (engine menu tree, ~190 new commands, menu dialogs)
- engine::menus: the AE 2026 menu bar as an indented tree (same menus, order, submenus, separators, "..." labels, AE default macOS shortcuts; [mac]/[!mac] app menu vs Edit > Preferences / File > Exit), entries bind command params, check-mark state, Effect categories from the registry. - New engine commands: Layer (quality/sampling, frame blending, switch ops, numeric Transform values, Center Anchor Point, Auto-Orient, mask ops on existing masks, layer markers + lock, track-matte menu, open/reveal source, expression errors), Edit (keyframe clipboard + Paste Reversed, Copy with (Relative) Property Links, Copy Expression Only, Lift/Extract Work Area, Select Label Group, Purge, Edit Original), Animation (JSON animation presets, Add Keyframe, Exponential Scale, Time-Reverse Keyframes, Sequence Layers, text selectors, Remove All Text Animators, Reveal Properties), File (New Folder, Close/Close Project, Save a Copy, placeholders/solids, New Comp from Selection, Dependencies, Run Script File, Interpret/Remember/ Apply Interpretation, Replace/Reload Footage, Reveal in Finder), Composition (crop to ROI / layer bounds, Save Frame As PNG, Responsive Design - Time), View (guides add/clear/import/export, region of interest), Help docs links. - Frontend commands (viewer, panels, workspaces, dialogs) are registered engine commands that emit Event::Frontend; owned-elsewhere items (3D, render queue, time remap, pen, tracking, layer styles) are disabled stubs. - UI renders the engine tree (check gutter, scrolling long submenus, dynamic Undo/Redo labels), bindings include param'd entries, generic parameter forms, Settings, Keyboard Shortcuts, View Options, guides/ROI/pasteboard in the viewer, timeline reveal of engine-picked properties; snapshot example gains a `pointer` step for opening menus headlessly. - Tests: menu order, every entry resolves, spec/tree consistency, shortcut uniqueness, per-family command tests with undo. - Workspace clippy -D warnings clean (rust 1.96 lints). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
4f47a01fed
commit
b4b2950c5d
@@ -1,15 +1,22 @@
|
||||
//! The command registry. Ids follow After Effects' menu structure; every menu item, panel button,
|
||||
//! shortcut and viewer/timeline gesture maps to one of these.
|
||||
|
||||
mod anim;
|
||||
mod comp;
|
||||
mod comp_more;
|
||||
mod edit;
|
||||
mod effect;
|
||||
mod file;
|
||||
mod file_more;
|
||||
mod frontend;
|
||||
mod help;
|
||||
mod layer;
|
||||
mod layer_menu;
|
||||
mod prop;
|
||||
mod query;
|
||||
mod stubs;
|
||||
mod time;
|
||||
mod view;
|
||||
|
||||
use std::sync::OnceLock;
|
||||
|
||||
@@ -73,6 +80,13 @@ pub fn command_specs() -> &'static [CommandSpec] {
|
||||
v.extend(time::specs());
|
||||
v.extend(help::specs());
|
||||
v.extend(query::specs());
|
||||
v.extend(layer_menu::specs());
|
||||
v.extend(anim::specs());
|
||||
v.extend(view::specs());
|
||||
v.extend(file_more::specs());
|
||||
v.extend(comp_more::specs());
|
||||
v.extend(frontend::specs());
|
||||
v.extend(stubs::specs());
|
||||
v
|
||||
})
|
||||
}
|
||||
@@ -98,6 +112,60 @@ pub(crate) fn has_keys(s: &Session) -> std::result::Result<(), String> {
|
||||
if s.state.selected_keys.is_empty() { Err("select keyframes first".into()) } else { Ok(()) }
|
||||
}
|
||||
|
||||
pub(crate) fn has_project_selection(s: &Session) -> std::result::Result<(), String> {
|
||||
if s.state.project_selection.is_empty() { Err("select an item in the Project panel first".into()) } else { Ok(()) }
|
||||
}
|
||||
|
||||
/// Disabled-command enablement (menu entries whose implementation lands with another milestone).
|
||||
pub(crate) fn not_yet(_: &Session) -> std::result::Result<(), String> {
|
||||
Err("not available yet in EffectCraft".into())
|
||||
}
|
||||
|
||||
/// `run` of a not-yet-available command.
|
||||
pub(crate) fn not_yet_run(_: &mut Session, _: &Value) -> Result<Value> {
|
||||
Err(EngineError::Other("not available yet in EffectCraft".into()))
|
||||
}
|
||||
|
||||
/// Hand a frontend-only command to the UI ([`crate::Event::Frontend`]).
|
||||
pub(crate) fn frontend(s: &mut Session, id: &str, p: &Value) -> Result<Value> {
|
||||
s.events.push(crate::Event::Frontend { command: id.to_string(), params: p.clone() });
|
||||
Ok(serde_json::json!({"frontend": id}))
|
||||
}
|
||||
|
||||
/// Match path of a node (`transform/position`, `effects/#2/blurriness` style with `match#n`
|
||||
/// occurrences) so it can be found again on another layer.
|
||||
pub fn match_path_of(g: &effectcraft_project::PropGroup, uid: effectcraft_project::Uid) -> Option<String> {
|
||||
for c in &g.children {
|
||||
let nth = g.children.iter().take_while(|x| !std::ptr::eq(*x, c)).filter(|x| x.match_id() == c.match_id()).count() + 1;
|
||||
let seg = if nth == 1 { c.match_id().to_string() } else { format!("{}#{nth}", c.match_id()) };
|
||||
if c.uid() == uid {
|
||||
return Some(seg);
|
||||
}
|
||||
if let effectcraft_project::Node::Group(sub) = c
|
||||
&& let Some(rest) = match_path_of(sub, uid)
|
||||
{
|
||||
return Some(format!("{seg}/{rest}"));
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
/// Selected properties (leaves) of the active comp as (layer, uid); selected groups expand to
|
||||
/// their properties.
|
||||
pub(crate) fn selected_leaf_props(s: &Session) -> Vec<(LayerId, effectcraft_project::Uid)> {
|
||||
let Some(comp) = s.active_comp() else { return vec![] };
|
||||
let mut out = vec![];
|
||||
for (lid, uid) in &s.state.selected_props {
|
||||
let Some(l) = comp.layer(*lid) else { continue };
|
||||
if l.props.find(*uid).is_some() {
|
||||
out.push((*lid, *uid));
|
||||
} else if let Some(g) = l.props.find_group(*uid) {
|
||||
g.walk("", &mut |_, p| out.push((*lid, p.uid)));
|
||||
}
|
||||
}
|
||||
out
|
||||
}
|
||||
|
||||
// ---------- params ----------
|
||||
|
||||
pub(crate) fn bad(cmd: &str, msg: impl Into<String>) -> EngineError {
|
||||
@@ -182,6 +250,6 @@ pub(crate) fn time_p(s: &Session, p: &Value, comp: Option<&Comp>) -> Tick {
|
||||
s.time()
|
||||
}
|
||||
|
||||
pub(crate) fn layer_mut<'a>(p: &'a mut effectcraft_project::Project, cid: ItemId, lid: LayerId) -> Result<&'a mut Layer> {
|
||||
pub(crate) fn layer_mut(p: &mut effectcraft_project::Project, cid: ItemId, lid: LayerId) -> Result<&mut Layer> {
|
||||
p.comp_mut(cid).ok_or(EngineError::NoComp)?.layer_mut(lid).ok_or(EngineError::Project(effectcraft_project::ProjectError::NoLayer(lid)))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user