Skip to content

AI media harness for planning, generating, and editing locally

TypeScript

Add scene continuation overlap lock

Bitti96a4515651fa
diff --git a/RELEASE_NOTES.md b/RELEASE_NOTES.md
index 0b2fd17..3fc6732 100644
--- a/RELEASE_NOTES.md
+++ b/RELEASE_NOTES.md
@@ -32,6 +32,7 @@ This alpha update adds LAN generation workers, Linux support, expanded color gra
## Fixes and improvements
+- Scene continuation offers a Lock Overlap toggle for local and worker generation, constraining overlapping video and audio to the source scene.
- Image and video exports share a work queue with progress, cancellation, and retained results. SeedVR2 upscaling runs on the selected CUDA worker, which prepares its own models.
- Upscaler downloads share the generator and LoRA download queue, with progress in Work Queue and cancellation for waiting downloads.
- Work queue activity indicators keep moving in the top bar and open queue when Windows interface animations are disabled.
diff --git a/src-tauri/core/src/slopfab/ffi/mod.rs b/src-tauri/core/src/slopfab/ffi/mod.rs
index 53b7250..39d977a 100644
--- a/src-tauri/core/src/slopfab/ffi/mod.rs
+++ b/src-tauri/core/src/slopfab/ffi/mod.rs
@@ -139,6 +139,10 @@ impl Api {
self.check(r)?;
self.inner.set_steps(r.pointer.as_ptr(), v)
}
+ pub fn set_continuation_lock_overlap(&self, r: &RequestHandle, enabled: bool) -> Result<(), String> {
+ self.check(r)?;
+ self.inner.set_continuation_lock_overlap(r.pointer.as_ptr(), enabled)
+ }
pub fn set_seed(&self, r: &RequestHandle, v: u64) -> Result<(), String> {
self.check(r)?;
self.inner.set_seed(r.pointer.as_ptr(), v)
diff --git a/src-tauri/core/src/slopfab/ffi/raw/mod.rs b/src-tauri/core/src/slopfab/ffi/raw/mod.rs
index d7be283..6f35a9e 100644
--- a/src-tauri/core/src/slopfab/ffi/raw/mod.rs
+++ b/src-tauri/core/src/slopfab/ffi/raw/mod.rs
@@ -86,6 +86,7 @@ pub struct Api {
set_image_edit_invert_mask: Option<unsafe extern "C" fn(*mut Request, i32) -> i32>,
set_save_latents: Option<unsafe extern "C" fn(*mut Request, *const c_char) -> i32>,
set_continuation_file: Option<unsafe extern "C" fn(*mut Request, *const c_char, i32) -> i32>,
+ set_continuation_lock_overlap: Option<unsafe extern "C" fn(*mut Request, i32) -> i32>,
set_video_transition: Option<unsafe extern "C" fn(*mut Request, i32) -> i32>,
set_steps: unsafe extern "C" fn(*mut Request, i32) -> i32,
set_sampling_settings: Option<unsafe extern "C" fn(*mut Request, *const c_char) -> i32>,
@@ -238,6 +239,9 @@ impl Api {
)
.ok()
.map(|symbol| *symbol),
+ set_continuation_lock_overlap: library
+ .get::<unsafe extern "C" fn(*mut Request, i32) -> i32>(b"slopfab_request_set_continuation_lock_overlap\0")
+ .ok().map(|symbol| *symbol),
add_refmod: library
.get::<unsafe extern "C" fn(*mut Request, *const c_char, f32, i32) -> i32>(
b"slopfab_request_add_refmod\0",
@@ -512,6 +516,12 @@ impl Api {
pub fn disable_outpainting_for_test(&mut self) {
self.set_image_edit_invert_mask = None;
}
+ pub fn set_continuation_lock_overlap(&self, r: *mut Request, enabled: bool) -> Result<(), String> {
+ let Some(set) = self.set_continuation_lock_overlap else {
+ return if enabled { Err("Lock Overlap requires SlopFab API 1.23 or later. Update the generation runtime.".into()) } else { Ok(()) };
+ };
+ self.error(unsafe { set(r, i32::from(enabled)) })
+ }
#[cfg(test)]
pub fn disable_lora_preparation_for_test(&mut self) {
self.prepare_lora_grid = None;
diff --git a/src-tauri/core/src/slopfab/ffi/tests.rs b/src-tauri/core/src/slopfab/ffi/tests.rs
index bc44ad7..143abea 100644
--- a/src-tauri/core/src/slopfab/ffi/tests.rs
+++ b/src-tauri/core/src/slopfab/ffi/tests.rs
@@ -1,5 +1,22 @@
use super::*;
+#[test]
+fn continuation_lock_overlap_can_be_enabled_and_disabled() {
+ // Exercise the bundled runtime, including when a running app holds an older staged DLL.
+ let path = Path::new(env!("CARGO_MANIFEST_DIR"))
+ .join("../../lib/slopfab")
+ .join(crate::slopfab::DLL_FILE_NAME);
+ let api = Api::load(&path).unwrap();
+ let request = RequestHandle::new(&api).unwrap();
+ api.set_frames(&request, 48).unwrap();
+ api.set_resolution(&request, 64, 32).unwrap();
+ api.set_continuation_lock_overlap(&request, true).unwrap();
+ // Enabling the constraint requires an attached continuation source.
+ assert!(api.resolve(&request).err().unwrap().contains("continuation"));
+ api.set_continuation_lock_overlap(&request, false).unwrap();
+ assert!(api.resolve(&request).is_ok());
+}
+
#[test]
fn image_edit_setters_use_original_pixel_boxes_and_pad_the_plan() {
let api = Api::load(&crate::slopfab::default_dll_path()).unwrap();
diff --git a/src-tauri/core/src/slopfab/h3.rs b/src-tauri/core/src/slopfab/h3.rs
index 371eee7..746d324 100644
--- a/src-tauri/core/src/slopfab/h3.rs
+++ b/src-tauri/core/src/slopfab/h3.rs
@@ -78,7 +78,9 @@ pub(super) fn configure_request(
}
api.set_inference_backend(handle, platform.backend())?;
api.set_attention(handle, configuration.attention)?;
- api.set_motion_cache(handle, configuration.motion_cache && !dmad && request.image_edit.is_none())?;
+ let lock_overlap = request.continuation_path.is_some() && request.continuation_lock_overlap;
+ // SlopFab's overlap constraint cannot be combined with approximate caches.
+ api.set_motion_cache(handle, configuration.motion_cache && !dmad && request.image_edit.is_none() && !lock_overlap)?;
api.set_verbose(handle, false)?;
if let Some(mode) = request.video_transition.as_deref() {
api.set_video_transition(handle, if mode == "bridge" { 2 } else { 1 })?;
@@ -90,6 +92,7 @@ pub(super) fn configure_request(
opening.as_ref().map_or(path.as_path(), |file| file.as_ref()),
request.continuation_overlap_frames.unwrap_or(crate::models::H3_CAPABILITIES.continuation_overlap),
)?;
+ api.set_continuation_lock_overlap(handle, lock_overlap)?;
}
if purpose == RequestPurpose::Generate {
if let Some(path) = &request.save_latents_path {
diff --git a/src-tauri/core/src/slopfab/types.rs b/src-tauri/core/src/slopfab/types.rs
index 58d825e..f93d694 100644
--- a/src-tauri/core/src/slopfab/types.rs
+++ b/src-tauri/core/src/slopfab/types.rs
@@ -73,6 +73,8 @@ pub struct GenerationRequest {
#[serde(default)]
pub continuation_from: Option<String>,
#[serde(default)]
+ pub continuation_lock_overlap: bool,
+ #[serde(default)]
pub continuation_source_frames: Option<i32>,
// Only the project commands resolve paths; IPC cannot supply save targets.
#[serde(skip)]
diff --git a/src-tauri/core/src/worker/protocol.rs b/src-tauri/core/src/worker/protocol.rs
index ea3bf0c..44d7c99 100644
--- a/src-tauri/core/src/worker/protocol.rs
+++ b/src-tauri/core/src/worker/protocol.rs
@@ -9,8 +9,9 @@ use std::collections::BTreeMap;
pub const SERVICE_TYPE: &str = "_slopus-worker._tcp.local.";
/// Bumped on any incompatible change to the routes or bodies below.
-// v4 adds bounded SeedVR2 export streams. v3 added inverted image masks.
-pub const PROTOCOL_VERSION: u32 = 4;
+// v5 carries overlap locking; older workers would silently ignore it.
+// v4 added SeedVR2 export streams. v3 added inverted image masks.
+pub const PROTOCOL_VERSION: u32 = 5;
/// Streaming SeedVR2 restoration; model paths are resolved on the worker.
#[derive(Debug, Clone, Serialize, Deserialize)]
diff --git a/src-tauri/src/project/scenes.rs b/src-tauri/src/project/scenes.rs
index 8162026..e11d3fc 100644
--- a/src-tauri/src/project/scenes.rs
+++ b/src-tauri/src/project/scenes.rs
@@ -88,6 +88,8 @@ pub(crate) struct GenerationJob {
pub(crate) continuation_overlap_frames: Option<i32>,
#[serde(default, skip_serializing_if = "Option::is_none")]
pub(crate) continuation_from: Option<String>,
+ #[serde(default, skip_serializing_if = "Option::is_none")]
+ pub(crate) continuation_lock_overlap: Option<bool>,
/// The H3 vocabulary tags this shot was built from: group id -> option ids.
/// zod spells it `.nullish()` (src/lib/project.ts `shotTagSelectionSchema`),
/// so `null` IS readable on the frontend — but the key is still skipped
@@ -168,6 +170,7 @@ impl GenerationJob {
continuation_scene_id: None,
continuation_overlap_frames: None,
continuation_from: None,
+ continuation_lock_overlap: None,
shot_tags: None,
shots: Some(Vec::new()),
duration_seconds: Some(defaults.duration_seconds),
diff --git a/src-tauri/src/tests/scenes.rs b/src-tauri/src/tests/scenes.rs
index e0635fa..24d2112 100644
--- a/src-tauri/src/tests/scenes.rs
+++ b/src-tauri/src/tests/scenes.rs
@@ -36,12 +36,14 @@ fn continuation_settings_migrate_and_survive_reordering_and_save() {
config.generation_jobs.reverse();
config.generation_jobs[0].continuation_from = Some("start".into());
config.generation_jobs[0].continuation_overlap_frames = Some(56);
+ config.generation_jobs[0].continuation_lock_overlap = Some(true);
let folder = tempfile::tempdir().unwrap();
write_project(folder.path(), &config).unwrap();
let restored = read_project(folder.path()).unwrap().config;
assert_eq!(restored.generation_jobs[0].continuation_scene_id.as_deref(), Some(source.as_str()));
assert_eq!(restored.generation_jobs[0].continuation_from.as_deref(), Some("start"));
assert_eq!(restored.generation_jobs[0].continuation_overlap_frames, Some(56));
+ assert_eq!(restored.generation_jobs[0].continuation_lock_overlap, Some(true));
config.generation_jobs[0].continuation_overlap_frames = Some(23);
assert!(validate_and_normalize_config(config.clone()).is_err());
config.generation_jobs[0].continuation_overlap_frames = Some(22);
diff --git a/src-tauri/src/worker/client.rs b/src-tauri/src/worker/client.rs
index c7c0f25..77c72a0 100644
--- a/src-tauri/src/worker/client.rs
+++ b/src-tauri/src/worker/client.rs
@@ -1020,6 +1020,7 @@ mod tests {
continuation_from: Some("start".into()),
continuation_overlap_frames: Some(39),
continuation_source_frames: Some(85),
+ continuation_lock_overlap: true,
..Default::default()
};
let (job, sources) = build_job(&request, &settings, &[]).unwrap();
@@ -1034,6 +1035,7 @@ mod tests {
assert_eq!(wire["request"]["continuationFrom"], "start");
assert_eq!(wire["request"]["continuationOverlapFrames"], 39);
assert_eq!(wire["request"]["continuationSourceFrames"], 85);
+ assert_eq!(wire["request"]["continuationLockOverlap"], true);
assert_eq!(sources.len(), 2);
assert!(build_job(&GenerationRequest { reference_paths: vec![folder.path().join("missing.png").to_string_lossy().into_owned()], ..Default::default() }, &BTreeMap::new(), &[]).is_err());
}
diff --git a/src/components/workspace/GeneratorView.test.tsx b/src/components/workspace/GeneratorView.test.tsx
index ca1324b..3cde047 100644
--- a/src/components/workspace/GeneratorView.test.tsx
+++ b/src/components/workspace/GeneratorView.test.tsx
@@ -466,7 +466,7 @@ describe("Generator scene controls", () => {
expect(state.latest().generationJobs[0].endFrameReferenceId).toBeUndefined();
});
- it("continues a later scene with selectable overlap and edge, ignoring hidden frame anchors", () => {
+ it.each([false, true])("continues a later scene with selectable overlap and edge, with Lock Overlap %s", (lockOverlap) => {
const initial = project();
initial.generationJobs[1] = { ...initial.generationJobs[1], status: "completed", latentRelativePath: "latents/later.safetensors" };
initial.references = [{ id: "still", kind: "image", name: "Still", description: "", intendedUse: [], sourcePath: "C:/still.png", createdAt: initial.createdAt }];
@@ -484,10 +484,14 @@ describe("Generator scene controls", () => {
choose("Source scene for continuation", "Second scene");
choose("Take continuation latents from", "Beginning");
choose("Continuation overlap frames", "39");
+ expect(screen.getByRole("switch", { name: "Lock Overlap" })).not.toBeChecked();
+ fireEvent.click(screen.getByRole("switch", { name: "Lock Overlap" }));
+ if (!lockOverlap) fireEvent.click(screen.getByRole("switch", { name: "Lock Overlap" }));
expect(generate).toBeEnabled();
fireEvent.click(generate);
const saved = parseProjectConfig(JSON.parse(JSON.stringify(state.latest())));
- expect(saved.generationJobs[0]).toMatchObject({ sceneType: "continue", continuationSceneId: "scene-second", continuationFrom: "start", continuationOverlapFrames: 39 });
+ expect(saved.generationJobs[0]).toMatchObject({ sceneType: "continue", continuationSceneId: "scene-second", continuationFrom: "start", continuationOverlapFrames: 39, continuationLockOverlap: lockOverlap });
+ expect(JSON.parse(saved.generationJobs[0].generationSnapshot!).continuationLockOverlap ?? false).toBe(lockOverlap);
expect(JSON.parse(saved.generationJobs[0].generationSnapshot!)).toMatchObject({
previousSceneId: "scene-second", continuationRelativePath: "latents/later.safetensors", continuationFrom: "start", continuationOverlapFrames: 39, referencePaths: [],
});
diff --git a/src/components/workspace/SceneEditor.tsx b/src/components/workspace/SceneEditor.tsx
index 7fbb73a..edf1788 100644
--- a/src/components/workspace/SceneEditor.tsx
+++ b/src/components/workspace/SceneEditor.tsx
@@ -1,6 +1,6 @@
import { Audio16, Dismiss12, Image16, ImageAdd16, Text16, Video16 } from "../ui/icons";
import { useId, useMemo, useState, type ReactNode } from "react";
-import { ComboBox, InfoBar, PropRow, PropSection } from "../ui";
+import { ComboBox, InfoBar, PropRow, PropSection, ToggleSwitch } from "../ui";
import {
shotReferenceIds,
danglingReferenceTokens,
@@ -350,7 +350,11 @@ export function SceneInspector({ job, shots, references, folderPath = "", scenes
})}
onChange={(value) => onChange({ continuationOverlapFrames: Number(value) })} />
</PropRow>
- <p className="prop-caption">Uses the selected scene’s saved latents. Generate it first, or use Generate all. Overlap uses 22, 39, 56, … frames at 24 fps.</p>
+ <PropRow label="Lock Overlap" htmlFor={`${id}-lock-overlap`}>
+ <ToggleSwitch id={`${id}-lock-overlap`} aria-label="Lock Overlap" checked={job.continuationLockOverlap ?? false} disabled={disabled}
+ onChange={(checked) => onChange({ continuationLockOverlap: checked })} />
+ </PropRow>
+ <p className="prop-caption">Uses the selected scene’s saved latents. Generate it first, or use Generate all. Overlap uses 22, 39, 56, … frames at 24 fps. Lock Overlap constrains the overlapping video and audio to the source.</p>
</>}
{pose && <>
<PropRow label="Pose video" htmlFor={`${id}-pose`}>
diff --git a/src/lib/project.continue.test.ts b/src/lib/project.continue.test.ts
index 59471bf..949a868 100644
--- a/src/lib/project.continue.test.ts
+++ b/src/lib/project.continue.test.ts
@@ -14,6 +14,7 @@ it("migrates previous-scene links to stable explicit sources with the old defaul
expect(restored.generationJobs[1]).toMatchObject({ sceneType: "continue", continuationSceneId: "source", continuationOverlapFrames: 22, continuationFrom: "end" });
restored.generationJobs.reverse();
expect(sceneFrameInputs(restored.generationJobs[0], restored).previousSceneId).toBe("source");
+ expect(sceneFrameInputs(restored.generationJobs[0], restored).continuationLockOverlap).toBe(false);
expect(parseProjectConfig(JSON.parse(JSON.stringify(restored)))).toEqual(restored);
});
diff --git a/src/lib/project.ts b/src/lib/project.ts
index 6a2c22a..2ab6793 100644
--- a/src/lib/project.ts
+++ b/src/lib/project.ts
@@ -555,6 +555,7 @@ export const generationJobSchema = z.object({
continuationOverlapFrames: z.number().int().min(DEFAULT_CONTINUATION_OVERLAP).max(MAX_CONTINUATION_OVERLAP)
.refine((frames) => (frames - 5) % 17 === 0, "Overlap must be 22, 39, 56, … frames.").nullish(),
continuationFrom: z.enum(["start", "end"]).nullish(),
+ continuationLockOverlap: z.boolean().nullish(),
latentRelativePath: projectRelativePathSchema.nullish(),
// `.nullish()` because Rust holds it as an Option — see the note on
// projectAssetSchema.durationMs. Every project written before shot tags
@@ -1031,6 +1032,7 @@ export function sceneFrameInputs(job: GenerationJob, config: ProjectConfig) {
previousSceneId: sourceId, continuationRelativePath: previous?.latentRelativePath ?? undefined,
continuationOverlapFrames: job.continuationOverlapFrames ?? DEFAULT_CONTINUATION_OVERLAP,
continuationFrom: job.continuationFrom ?? "end",
+ continuationLockOverlap: job.continuationLockOverlap ?? false,
continuationSourceFrames: previous ? sceneOutputFrames(previous, config) : undefined };
}
@@ -1136,6 +1138,7 @@ export interface SceneGenerationInput {
continuationRelativePath?: string;
continuationOverlapFrames?: number;
continuationFrom?: "start" | "end";
+ continuationLockOverlap?: boolean;
continuationSourceFrames?: number;
}
@@ -1164,6 +1167,7 @@ export function sceneGenerationSnapshot(job: GenerationJob, input: SceneGenerati
...(input.previousSceneId ? { previousSceneId: input.previousSceneId } : {}),
...(input.continuationRelativePath ? { continuationRelativePath: input.continuationRelativePath } : {}),
...(input.previousSceneId ? { continuationOutput: "joined", continuationOverlapFrames: input.continuationOverlapFrames ?? DEFAULT_CONTINUATION_OVERLAP,
+ ...(input.continuationLockOverlap ? { continuationLockOverlap: true } : {}),
continuationFrom: input.continuationFrom ?? "end", ...(input.continuationSourceFrames ? { continuationSourceFrames: input.continuationSourceFrames } : {}) } : {}),
shots,
});
diff --git a/src/lib/runtime.ts b/src/lib/runtime.ts
index 041e05c..6b2a192 100644
--- a/src/lib/runtime.ts
+++ b/src/lib/runtime.ts
@@ -113,6 +113,7 @@ export interface SlopfabGenerationRequest {
continuationRelativePath?: string;
continuationOverlapFrames?: number;
continuationFrom?: "start" | "end";
+ continuationLockOverlap?: boolean;
continuationSourceFrames?: number;
}
diff --git a/src/lib/sceneGeneration.ts b/src/lib/sceneGeneration.ts
index 6f02ac0..de3861a 100644
--- a/src/lib/sceneGeneration.ts
+++ b/src/lib/sceneGeneration.ts
@@ -28,6 +28,7 @@ export function sceneGenerationRequest(job: GenerationJob, config: ProjectConfig
...(inputs.previousSceneId ? { previousSceneId: inputs.previousSceneId } : {}),
...(inputs.continuationRelativePath ? { continuationRelativePath: inputs.continuationRelativePath } : {}),
...(inputs.previousSceneId ? { continuationOverlapFrames: inputs.continuationOverlapFrames,
+ continuationLockOverlap: inputs.continuationLockOverlap,
continuationFrom: inputs.continuationFrom, continuationSourceFrames: inputs.continuationSourceFrames } : {}),
// The scene's own length, not a fixed six seconds.
frames: Math.round(sceneDurationSeconds(job) * GENERATION_FRAME_RATE),