1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
//! aexlo - After Effects Plugin(.aex) Loader and Emulator
//!
//! This crate provides functionality to load and execute After Effects plugins (.aex)
//! outside of After Effects, enabling testing, automation, and custom rendering pipelines.
//!
//! # Example
//!
//! ```no_run
//! use aexlo::{Depth8, Host, Layer, ParamValue, Time};
//!
//! # fn main() -> aexlo::Result<()> {
//! // Fix the host services first (`Host::install(my_app_host)?` to customize).
//! let host = Host::get();
//!
//! // Load the plugin and run GLOBAL_SETUP, PARAMS_SETUP and SEQUENCE_SETUP.
//! // On Windows pass the `.aex` file, on macOS the `.plugin` bundle.
//! let mut fx = host.load("MyEffect.aex")?;
//! println!("{}", fx.about()?);
//!
//! // Feed an input frame and set parameters (index 0 is the input layer).
//! fx.set_input_layer(Layer::<Depth8>::black(1920, 1080));
//! fx.set_param(1, ParamValue::Float(0.5))?;
//! fx.set_time(Time::frame(0, 30));
//!
//! // Render the way After Effects picks the path: GPU, smart, then legacy.
//! fx.render_frame()?;
//! let output: Layer<Depth8> = fx.read_output()?;
//! # Ok(())
//! # }
//! ```
//!
//! # Trust and process model
//!
//! A plugin is native code, loaded into this process with no sandbox. Loading
//! one is what this crate is for, so [`Host::load`] and [`Loader::load`] are
//! safe functions, the way spawning a process is: what the plugin's code does
//! is outside Rust's guarantees. A buggy plugin can corrupt memory, crash or
//! abort the process that embeds aexlo, so only load plugins you trust.
//!
//! aexlo's own callbacks catch their panics and report
//! `PF_Err_INTERNAL_STRUCT_DAMAGED` to the plugin rather than letting them
//! abort the process, but a crash inside the plugin cannot be caught
//! in-process. When a crashing plugin must not take the application down, run
//! it in a worker process, as the `aexlo` CLI and its toolkit do for every
//! variant.
//!
//! ## Process-wide state
//!
//! Some host state belongs to the process, not to a [`PluginInstance`]:
//!
//! - The [`AppHost`] is fixed once per process ([`Host::install`] or
//! [`Host::get`]) and cannot be swapped afterwards, even between tests.
//! - AEGP Persistent Data (preferences) is one in-memory store shared by every
//! plugin and instance, and is never written to disk.
//! - AEGP registrations, GPU worlds and allocation tracking live in
//! process-wide registries keyed by instance, so instances coexist.
//!
//! ## Threads
//!
//! [`PluginInstance`] is neither `Send` nor `Sync`. After Effects drives an
//! effect instance from one thread at a time, and plugins keep thread-affine
//! state (GPU contexts, Windows `HWND`s, thread-local storage), so create, use
//! and drop each instance on the same thread. To render off a UI thread,
//! create the instance on a worker thread and send that thread commands.
//!
//! ```compile_fail
//! fn assert_send<T: Send>() {}
//! assert_send::<aexlo::PluginInstance>();
//! ```
//!
//! Separate instances may run on separate threads at once: aexlo's
//! process-wide state is behind locks, and its own test suites run instances
//! in parallel. Whether a plugin's globals tolerate that is up to the plugin
//! (it declares `OutFlags2::SUPPORTS_THREADED_RENDERING` when they do).
//!
//! # Features
//!
//! - `diagnostics` - Print every suite call the plugin makes, with its
//! arguments, to stdout
// Tests call FFI fakes directly; their `unsafe` blocks need no proof.
// The crate mirrors the After Effects C SDK, whose suite struct fields and entry
// points (`PF_GetAppName`, `EffectMain`, …) use non-snake-case names. Allowing it
// crate-wide keeps the FFI surface readable without per-item annotations.
pub
pub use ;
pub use ;
pub use Time;
/// Window plugins should treat as After Effects' main window
/// (`PF_PlatData_MAIN_WND`).
///
/// Editors parented here stay invisible while this window is hidden. A GUI
/// host passes its own visible window; `null` falls back to a window aexlo
/// creates. Only Windows has a main window; elsewhere this does nothing.
///
/// # Safety
/// `hwnd` must be null or a valid `HWND` that stays valid for as long as any
/// plugin may use it: plugins parent their windows to it and send it
/// messages. Pass null before destroying the window.
pub unsafe
/// Entry point ABI for driving an in-process effect via
/// [`Host::from_entry`].
pub use PluginEntryPoint;
pub use ;
/// Typed flags and pixel formats a plugin declares.
pub use ;
/// The PiPL resource: what After Effects reads from a plugin before loading it.
pub use ;
/// The GPU this host renders on, for machine fingerprints.
pub use device_name as gpu_device_name;
/// Strict mode ([`PluginInstance::set_strict`]).
pub use ;
/// Layer masks served through the Path Query/Data suites
/// ([`PluginInstance::set_mask_paths`]).
pub use ;
/// Text on the effect's layer, served through the Text Layer Suite
/// ([`PluginInstance::set_text_layer`]).
pub use ;
/// Injectable host-application services (App, Adv App/Item/Time, Plugin
/// Helper and Custom UI Overlay Theme suites): UI colors, fonts, language,
/// color picker, progress dialogs, Info panel, time display, tools, ...
/// Headless by default.
pub use ;
/// Safe pixel/layer wrappers, re-exported explicitly so additions to the
/// `pixel` module don't silently widen this crate's public API.
pub use ;
/// Observation hooks ([`PluginInstance::set_observer`]).
pub use ;