mirror of
https://github.com/storytold/effectcraft.git
synced 2026-11-10 10:20:47 -06:00
#3103: doc comments for the touched import and prompt functions
This commit is contained in:
@@ -22,6 +22,8 @@ pub fn is_aep_path(path: &str) -> bool {
|
||||
std::path::Path::new(path).extension().and_then(std::ffi::OsStr::to_str).is_some_and(|e| e.eq_ignore_ascii_case("aep") || e.eq_ignore_ascii_case("aepx"))
|
||||
}
|
||||
|
||||
/// `file.importAep`: the `.aep` / `.aepx` at `path` into the open project, in a folder named after
|
||||
/// the file; refused ([`EngineError::Refused`]) when parts would be lost and `allowLosses` is not set.
|
||||
fn import_aep(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let path = str_p(p, "path").ok_or_else(|| bad("file.importAep", "missing `path`"))?.to_string();
|
||||
let allow_losses = b_p(p, "allowLosses").unwrap_or(false);
|
||||
@@ -97,6 +99,8 @@ fn import_aep(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
}))
|
||||
}
|
||||
|
||||
/// `file.exportAep`: the open project as an `.aep` at `path`; refused ([`EngineError::Refused`])
|
||||
/// when parts would be lost and `allowLosses` is not set.
|
||||
fn export_aep(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
let path = str_p(p, "path").ok_or_else(|| bad("file.exportAep", "missing `path`"))?.to_string();
|
||||
let allow_losses = b_p(p, "allowLosses").unwrap_or(false);
|
||||
@@ -133,6 +137,7 @@ fn export_aep(s: &mut Session, p: &Value) -> Result<Value> {
|
||||
Ok(json!({"path": path, "bytes": res.bytes.len(), "report": res.report}))
|
||||
}
|
||||
|
||||
/// File ▸ Import / Export ▸ Adobe After Effects Project….
|
||||
pub fn specs() -> Vec<CommandSpec> {
|
||||
vec![
|
||||
cmd!(
|
||||
|
||||
@@ -73,6 +73,7 @@ fn bad_input_is_an_error_not_a_crash() {
|
||||
assert!(empty.execute_checked("file.exportAep", json!({"path": path})).is_ok());
|
||||
}
|
||||
|
||||
/// File ▸ Export ▸ Adobe After Effects Project… is in the menu under that label.
|
||||
#[test]
|
||||
fn aep_export_menu_entry_exists() {
|
||||
let entries = crate::menus::entries();
|
||||
|
||||
@@ -231,6 +231,7 @@ fn file_import_takes_after_effects_projects() {
|
||||
let _ = std::fs::remove_dir_all(&dir);
|
||||
}
|
||||
|
||||
/// File ▸ Import ▸ Adobe After Effects Project… is in the menu under that label.
|
||||
#[test]
|
||||
fn aep_menu_entry_exists() {
|
||||
let entries = crate::menus::entries();
|
||||
|
||||
@@ -90,6 +90,8 @@ pub fn lines(report: &Value) -> Vec<(String, Vec<String>)> {
|
||||
.collect()
|
||||
}
|
||||
|
||||
/// Draw the prompt for the conversion waiting on it: its losses by category, Cancel and Import /
|
||||
/// Export Anyway (Escape cancels).
|
||||
pub fn show(app: &mut EffectcraftApp, ctx: &egui::Context, t: &Tokens) {
|
||||
let Some((id, _, report)) = app.dialog_state.aep_losses.command.clone() else {
|
||||
app.dialog = None;
|
||||
|
||||
@@ -475,6 +475,8 @@ fn home_page(
|
||||
}
|
||||
}
|
||||
|
||||
/// Run the commands the Home screen's buttons and recent files asked for, and leave Home once one
|
||||
/// opened something (not while a dialog it opened waits, nor when only the list changed).
|
||||
fn run_actions(app: &mut EffectcraftApp, ctx: &egui::Context, actions: Vec<(&str, serde_json::Value)>) {
|
||||
for (id, params) in actions {
|
||||
let before = (app.session.path.clone(), app.session.revision);
|
||||
|
||||
Reference in New Issue
Block a user