Add an image batch-script popup that splits a pasted shot list onto the start still.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+80
-9
@@ -359,6 +359,19 @@
|
||||
<span class="text-[11px] leading-snug text-zinc-400">Each pass from the last output</span>
|
||||
</button>
|
||||
</div>
|
||||
<button
|
||||
v-if="imagePassMode === 'batch'"
|
||||
type="button"
|
||||
class="w-full rounded-2xl border border-dashed px-4 py-2.5 text-left text-sm transition"
|
||||
:class="imageBatchScript.trim()
|
||||
? 'border-amber-300/40 bg-amber-400/5 text-amber-100 hover:border-amber-300'
|
||||
: 'border-white/15 text-zinc-300 hover:border-amber-300/40 hover:text-amber-100'"
|
||||
:disabled="editBusy"
|
||||
@click="openImageBatchModal"
|
||||
>
|
||||
<span class="block font-semibold">{{ imageBatchScript.trim() ? 'Edit batch script' : 'Paste batch script' }}</span>
|
||||
<span class="text-[11px] leading-snug text-zinc-400">{{ imageBatchButtonHint }}</span>
|
||||
</button>
|
||||
<div
|
||||
v-for="(item, index) in editPassQueue"
|
||||
:key="item.id"
|
||||
@@ -1879,6 +1892,12 @@
|
||||
:placeholder="promptPlaceholder"
|
||||
@update:open="promptDrawerOpen = $event"
|
||||
/>
|
||||
<ImageBatchModal
|
||||
:open="imageBatchOpen"
|
||||
v-model:text="imageBatchDraft"
|
||||
@close="imageBatchOpen = false"
|
||||
@apply="applyImageBatch"
|
||||
/>
|
||||
<ImagePickerModal
|
||||
:open="pickerOpen"
|
||||
:folders="folders"
|
||||
@@ -1962,7 +1981,7 @@
|
||||
|
||||
<script setup lang="ts">
|
||||
import { parseEditPasses, looksLikeShotScript } from '~/utils/parseRecommend'
|
||||
import { parseShotScript } from '~/utils/parseShots'
|
||||
import { parseImageBatchScript, parseShotScript } from '~/utils/parseShots'
|
||||
import type { DirectorScript } from '~/utils/directorScripts'
|
||||
import {
|
||||
composeShotPrompt,
|
||||
@@ -2259,10 +2278,14 @@ const recommendJobId = ref('')
|
||||
const recommendApplied = ref(false)
|
||||
const promptBeforeRecommend = ref('')
|
||||
const editPassesBeforeRecommend = ref<QueuedEditPass[]>([])
|
||||
const imageBatchBeforeRecommend = ref('')
|
||||
const shotScriptBeforeRecommend = ref(false)
|
||||
const extensionQueue = ref<QueuedExtension[]>([])
|
||||
const editPassQueue = ref<QueuedEditPass[]>([])
|
||||
const imagePassMode = ref<ImagePassMode>('batch')
|
||||
const imageBatchOpen = ref(false)
|
||||
const imageBatchScript = ref('')
|
||||
const imageBatchDraft = ref('')
|
||||
const clipName = ref('')
|
||||
const videoDownloadName = ref('output')
|
||||
const editDownloadName = ref('edited')
|
||||
@@ -2832,9 +2855,14 @@ const extraPassButtonLabel = computed(() => {
|
||||
if (imagePassMode.value === 'batch') return '+ Prompt'
|
||||
return studioMode.value === 'editv2' && v2Mode.value === 'compose' ? '+ Compose pass' : '+ Edit pass'
|
||||
})
|
||||
const imageBatchButtonHint = computed(() => {
|
||||
const n = 1 + editPassQueue.value.length
|
||||
if (imageBatchScript.value.trim() && n > 1) return `${n} prompts on the start still. Same format as a video shot list.`
|
||||
return 'Paste shot 1, shot 2, shot 3. Each image is a new prompt on the original still.'
|
||||
})
|
||||
const extraPassHint = computed(() => {
|
||||
if (imagePassMode.value === 'batch') {
|
||||
return 'Every prompt runs from the start still. Outputs do not feed the next prompt.'
|
||||
return 'Every prompt runs from the start still. Paste a shot list, or add prompts one at a time. Outputs do not feed the next prompt.'
|
||||
}
|
||||
if (studioMode.value === 'editv2' && v2Mode.value === 'compose') {
|
||||
return 'Each extra pass is another Compose on the last output, with the same still B. You cannot switch graphs between passes.'
|
||||
@@ -3992,7 +4020,7 @@ function applyGenerationPreset(preset: GenerationPreset) {
|
||||
const settings = preset.settings as ImageV2PresetSettings
|
||||
persistImageV2LoraStack(imageV2LoraStack.value, v2Engine.value)
|
||||
v2Mode.value = settings.mode === 'compose' ? 'compose' : settings.mode === 'refine' ? 'refine' : settings.mode === 'generate' ? 'generate' : 'edit'
|
||||
if (v2Mode.value !== 'edit' && v2Mode.value !== 'compose') editPassQueue.value = []
|
||||
if (v2Mode.value !== 'edit' && v2Mode.value !== 'compose') clearEditPasses()
|
||||
v2Engine.value = parseImageV2Engine(settings.engine, 'flux')
|
||||
v2Task.value = v2Mode.value === 'compose' ? (settings.task || 'scene') : v2Mode.value === 'refine' ? 'refine' : v2Mode.value === 'generate' ? 't2i' : 'scene'
|
||||
if (typeof settings.prompt === 'string') prompt.value = settings.prompt
|
||||
@@ -4267,12 +4295,21 @@ function applyRecommend() {
|
||||
if (!text) return
|
||||
promptBeforeRecommend.value = prompt.value
|
||||
editPassesBeforeRecommend.value = editPassQueue.value.map(item => ({ ...item }))
|
||||
imageBatchBeforeRecommend.value = imageBatchScript.value
|
||||
shotScriptBeforeRecommend.value = shotScriptMode.value
|
||||
if (studioMode.value === 'edit' || v2PassChaining.value) {
|
||||
const passes = parseEditPasses(text)
|
||||
if (passes && passes.length > 1) {
|
||||
prompt.value = passes[0]
|
||||
editPassQueue.value = passes.slice(1).map(item => ({ id: crypto.randomUUID(), prompt: item }))
|
||||
const fromPasses = parseEditPasses(text)
|
||||
const fromScript = parseImageBatchScript(text)
|
||||
const parts = fromPasses && fromPasses.length > 1
|
||||
? fromPasses
|
||||
: fromScript.length > 1
|
||||
? fromScript.map(item => item.prompt)
|
||||
: null
|
||||
if (parts && parts.length > 1) {
|
||||
prompt.value = parts[0]
|
||||
editPassQueue.value = parts.slice(1).map(item => ({ id: crypto.randomUUID(), prompt: item }))
|
||||
imagePassMode.value = 'batch'
|
||||
imageBatchScript.value = fromPasses ? '' : text
|
||||
} else {
|
||||
prompt.value = text
|
||||
}
|
||||
@@ -4289,6 +4326,7 @@ function applyRecommend() {
|
||||
function revertRecommend() {
|
||||
prompt.value = promptBeforeRecommend.value
|
||||
editPassQueue.value = editPassesBeforeRecommend.value.map(item => ({ ...item }))
|
||||
imageBatchScript.value = imageBatchBeforeRecommend.value
|
||||
shotScriptMode.value = shotScriptBeforeRecommend.value
|
||||
recommendApplied.value = false
|
||||
}
|
||||
@@ -5825,6 +5863,39 @@ function removeEditPass(id: string) {
|
||||
editPassQueue.value = editPassQueue.value.filter(item => item.id !== id)
|
||||
}
|
||||
|
||||
function clearEditPasses() {
|
||||
editPassQueue.value = []
|
||||
imageBatchScript.value = ''
|
||||
}
|
||||
|
||||
function reconstructImageBatchScript() {
|
||||
if (imageBatchScript.value.trim()) return imageBatchScript.value
|
||||
const first = prompt.value.trim()
|
||||
const rest = editPassQueue.value.map(item => item.prompt.trim()).filter(Boolean)
|
||||
if (!first && !rest.length) return ''
|
||||
if (!rest.length) return first
|
||||
return [`shot 1\n${first}`, ...rest.map((item, index) => `shot ${index + 2}\n${item}`)].join('\n\n')
|
||||
}
|
||||
|
||||
function openImageBatchModal() {
|
||||
imageBatchDraft.value = reconstructImageBatchScript()
|
||||
imageBatchOpen.value = true
|
||||
}
|
||||
|
||||
function applyImageBatch() {
|
||||
const shots = parseImageBatchScript(imageBatchDraft.value)
|
||||
if (!shots.length) {
|
||||
toast('Paste at least one prompt. Put shot 1, shot 2 on their own lines.')
|
||||
return
|
||||
}
|
||||
imagePassMode.value = 'batch'
|
||||
imageBatchScript.value = imageBatchDraft.value
|
||||
prompt.value = shots[0].prompt
|
||||
editPassQueue.value = shots.slice(1).map(item => ({ id: crypto.randomUUID(), prompt: item.prompt }))
|
||||
imageBatchOpen.value = false
|
||||
toast(shots.length === 1 ? 'Loaded 1 prompt' : `Loaded ${shots.length} prompts on the start still`)
|
||||
}
|
||||
|
||||
function imagePassUnit() {
|
||||
return imagePassMode.value === 'batch' ? 'Batch' : 'Pass'
|
||||
}
|
||||
@@ -6023,7 +6094,7 @@ async function ensureRefineCanvas() {
|
||||
|
||||
async function sendToEdit() {
|
||||
if (!editResultUrl.value) return
|
||||
editPassQueue.value = []
|
||||
clearEditPasses()
|
||||
studioMode.value = 'editv2'
|
||||
outputFocus.value = 'edit'
|
||||
try {
|
||||
@@ -6037,7 +6108,7 @@ async function sendToEdit() {
|
||||
|
||||
async function sendToRefine() {
|
||||
if (!editResultUrl.value) return
|
||||
editPassQueue.value = []
|
||||
clearEditPasses()
|
||||
studioMode.value = 'editv2'
|
||||
outputFocus.value = 'edit'
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user