Copy generated stills into Input without loading the current frame.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -1280,6 +1280,29 @@ export async function saveStill(params: {
|
||||
return still
|
||||
}
|
||||
|
||||
export async function keepStillAsInput(owner: string, id: string) {
|
||||
const still = getStill(owner, id)
|
||||
if (stillRole(still) === 'input') return still
|
||||
const path = stillPath(owner, still.id)
|
||||
if (!existsSync(path)) throw createError({ statusCode: 404, statusMessage: 'Image file missing' })
|
||||
const data = readFileSync(path)
|
||||
const name = (still.name || still.filename.replace(/\.[a-z0-9]+$/i, '') || 'still').trim().slice(0, 80)
|
||||
const base = lastFrameStillName(name) || clipIdFromStillFilename(`${name}.png`) ? 'still' : name
|
||||
const saved = await saveStill({
|
||||
ownerKey: owner,
|
||||
folderId: still.folderId,
|
||||
filename: `${base}.png`,
|
||||
data,
|
||||
width: still.width,
|
||||
height: still.height,
|
||||
hideInput: still.hideInput,
|
||||
role: 'input',
|
||||
name
|
||||
})
|
||||
if (!saved) throw createError({ statusCode: 400, statusMessage: 'Could not save that still as input' })
|
||||
return saved
|
||||
}
|
||||
|
||||
export async function rememberInputStill(params: {
|
||||
ownerKey: string
|
||||
folderId: string
|
||||
|
||||
Reference in New Issue
Block a user