Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

Merge remote-tracking branch 'origin/main' into HEAD

bflatastic36fab2ab17d6
diff --cc crates/ui-egui/src/panels/dialogs.rs
index 44349beb6,8e89c109a..2a70d057d
--- a/crates/ui-egui/src/panels/dialogs.rs
+++ b/crates/ui-egui/src/panels/dialogs.rs
@@@ -439,13 -403,11 +439,15 @@@ fn comp_settings(app: &mut EffectcraftA
let mut result = None;
let custom = app.session.prefs.comp_presets.clone();
let mut cmds = Vec::new();
+ // The title keys the modal id and its drag offset; `modal_fit` translates the heading itself,
+ // so passing the source keeps the dialog in place when the interface language changes.
- modal(ctx, "Composition Settings", vec2(600.0, 470.0), t, |ui| {
- result = super::comp_settings::show(ui, &mut d, t, &mut app.auto, &custom, &mut cmds);
+ let live = existing && super::live_preview::active(app);
+ let place = super::live_preview::place(app);
+ let mut preview = app.dialog_state.live.on;
+ modal_placed(ctx, "Composition Settings", vec2(600.0, 470.0), t, place, |ui| {
+ result = super::comp_settings::show(ui, &mut d, t, &mut app.auto, &custom, &mut cmds, live.then_some(&mut preview));
});
+ app.dialog_state.live.on = preview;
if d.preset_name.is_some() {
// Save Preset asks for the name in its own window over the dialog, as After Effects does.
result = None;
diff --cc crates/ui-egui/src/panels/dialogs_3d.rs
index 4b9524a3e,3811f8766..9b3535288
--- a/crates/ui-egui/src/panels/dialogs_3d.rs
+++ b/crates/ui-egui/src/panels/dialogs_3d.rs
@@@ -388,37 -376,6 +398,39 @@@ pub fn light(app: &mut EffectcraftApp,
}
}
+/// The command Light Settings' OK runs, and its parameters.
+fn light_command(d: &LightDraft) -> (&'static str, Value) {
+ let kind = d.kind;
+ let mut p = json!({
+ "name": d.name,
+ "kind": kind.label(),
+ "color": [d.color[0], d.color[1], d.color[2]],
+ "intensity": d.intensity,
+ });
+ if kind == LightKind::Spot {
+ p["coneAngle"] = json!(d.cone_angle);
+ p["coneFeather"] = json!(d.cone_feather);
+ }
+ if falls_off(kind) {
+ p["falloff"] = json!(d.falloff);
+ p["radius"] = json!(d.radius);
+ p["falloffDistance"] = json!(d.falloff_distance);
++ }
++ if casts_shadows(kind) {
+ p["castsShadows"] = json!(d.casts_shadows);
+ p["shadowDarkness"] = json!(d.shadow_darkness);
+ p["shadowDiffusion"] = json!(d.shadow_diffusion);
+ }
+ let id = match d.layer {
+ Some(l) => {
+ p["layer"] = json!(l);
+ "layer.lightSettings"
+ }
+ None => "layer.newLight",
+ };
+ (id, p)
+}
+
/// Menu/shortcut routing: commands that open a 3D settings dialog when invoked without params.
/// Returns true when a dialog was opened.
pub fn route(app: &mut EffectcraftApp, id: &str, params: &Value) -> Result<bool, String> {