mirror of
https://github.com/storytold/vectorcraft.git
synced 2026-11-09 00:17:42 +00:00
Actions: a paced playback ends when a step comes due in another document
Step by Step and Pause For remember the document that was active after each step. When the next step is due and a different document is active (another one was made active, or that one was closed), the playback ends with a status and the rest of the steps do not run. A step that makes another document active itself does not end the playback.
This commit is contained in:
@@ -5503,6 +5503,7 @@ theme Appearance Външен вид
|
||||
@msg name is empty името е празно
|
||||
@msg an action is already recording вече се записва действие
|
||||
@msg an action is already playing вече се възпроизвежда действие
|
||||
@msg the action stopped playing: its document is no longer active действието спря: документът му вече не е активен
|
||||
@msg speed must be accelerated, step or pause speed трябва да е accelerated, step или pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds трябва да е цяло число от 1 до 60
|
||||
@msg no such function key няма такъв функционален клавиш
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5507,6 +5507,7 @@ mark-style Japanese Japanski
|
||||
@msg name is empty naziv je prazan
|
||||
@msg an action is already recording akcija se već snima
|
||||
@msg an action is already playing akcija se već reproducira
|
||||
@msg the action stopped playing: its document is no longer active reprodukcija akcije je zaustavljena: njen dokument više nije aktivan
|
||||
@msg speed must be accelerated, step or pause speed mora biti accelerated, step ili pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds mora biti cijeli broj od 1 do 60
|
||||
@msg no such function key nema takve funkcijske tipke
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5193,6 +5193,7 @@ digits Malayalam Malaiàlam
|
||||
@msg name is empty el nom és buit
|
||||
@msg an action is already recording ja s’està enregistrant una acció
|
||||
@msg an action is already playing ja s’està reproduint una acció
|
||||
@msg the action stopped playing: its document is no longer active l’acció s’ha aturat: el seu document ja no és l’actiu
|
||||
@msg speed must be accelerated, step or pause speed ha de ser accelerated, step o pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds ha de ser un nombre enter de l’1 al 60
|
||||
@msg no such function key no existeix aquesta tecla de funció
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5593,6 +5593,7 @@ mark-style Japanese Japonské
|
||||
@msg name is empty název je prázdný
|
||||
@msg an action is already recording akce se už zaznamenává
|
||||
@msg an action is already playing akce se už přehrává
|
||||
@msg the action stopped playing: its document is no longer active přehrávání akce se zastavilo: její dokument už není aktivní
|
||||
@msg speed must be accelerated, step or pause speed musí být accelerated, step nebo pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds musí být celé číslo od 1 do 60
|
||||
@msg no such function key taková funkční klávesa neexistuje
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5388,6 +5388,7 @@ swatch Bright Violet Kraftig violet
|
||||
@msg name is empty navnet er tomt
|
||||
@msg an action is already recording en handling optages allerede
|
||||
@msg an action is already playing en handling afspilles allerede
|
||||
@msg the action stopped playing: its document is no longer active handlingen stoppede: dens dokument er ikke længere aktivt
|
||||
@msg speed must be accelerated, step or pause speed skal være accelerated, step eller pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds skal være et heltal fra 1 til 60
|
||||
@msg no such function key ingen sådan funktionstast
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5171,6 +5171,7 @@ effect Soft Weich
|
||||
@msg name is empty Name ist leer
|
||||
@msg an action is already recording eine Aktion wird bereits aufgezeichnet
|
||||
@msg an action is already playing eine Aktion wird bereits abgespielt
|
||||
@msg the action stopped playing: its document is no longer active die Aktion wurde angehalten: ihr Dokument ist nicht mehr aktiv
|
||||
@msg speed must be accelerated, step or pause speed muss accelerated, step oder pause sein
|
||||
@msg seconds must be a whole number from 1 to 60 seconds muss eine ganze Zahl von 1 bis 60 sein
|
||||
@msg no such function key keine solche Funktionstaste
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5544,6 +5544,7 @@ effect Points Σημεία
|
||||
@msg name is empty το όνομα είναι κενό
|
||||
@msg an action is already recording μια ενέργεια καταγράφεται ήδη
|
||||
@msg an action is already playing μια ενέργεια αναπαράγεται ήδη
|
||||
@msg the action stopped playing: its document is no longer active η αναπαραγωγή της ενέργειας σταμάτησε: το έγγραφό της δεν είναι πλέον ενεργό
|
||||
@msg speed must be accelerated, step or pause το speed πρέπει να είναι accelerated, step ή pause
|
||||
@msg seconds must be a whole number from 1 to 60 το seconds πρέπει να είναι ακέραιος από 1 έως 60
|
||||
@msg no such function key δεν υπάρχει τέτοιο πλήκτρο λειτουργίας
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 163 and column 5.
|
@@ -5534,6 +5534,7 @@ mark-style Japanese Japonesas
|
||||
@msg name is empty el nombre está vacío
|
||||
@msg an action is already recording ya se está grabando una acción
|
||||
@msg an action is already playing ya se está reproduciendo una acción
|
||||
@msg the action stopped playing: its document is no longer active la acción se detuvo: su documento ya no es el activo
|
||||
@msg speed must be accelerated, step or pause speed debe ser accelerated, step o pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds debe ser un número entero de 1 a 60
|
||||
@msg no such function key no existe esa tecla de función
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5556,6 +5556,7 @@ mark-style Japanese Japanilainen
|
||||
@msg name is empty nimi on tyhjä
|
||||
@msg an action is already recording toimintoa nauhoitetaan jo
|
||||
@msg an action is already playing toimintoa toistetaan jo
|
||||
@msg the action stopped playing: its document is no longer active toiminnon toisto pysähtyi: sen asiakirja ei ole enää aktiivinen
|
||||
@msg speed must be accelerated, step or pause speed on oltava accelerated, step tai pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds on oltava kokonaisluku 1:stä 60:een
|
||||
@msg no such function key toimintonäppäintä ei ole
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5588,6 +5588,7 @@ theme Appearance Apparence
|
||||
@msg name is empty le nom est vide
|
||||
@msg an action is already recording un script est déjà en cours d’enregistrement
|
||||
@msg an action is already playing un script est déjà en cours d’exécution
|
||||
@msg the action stopped playing: its document is no longer active le script s’est arrêté : son document n’est plus le document actif
|
||||
@msg speed must be accelerated, step or pause speed doit valoir accelerated, step ou pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds doit être un nombre entier de 1 à 60
|
||||
@msg no such function key touche de fonction inexistante
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5576,6 +5576,7 @@ imageTrace Outline Körvonal
|
||||
@msg name is empty a név üres
|
||||
@msg an action is already recording már folyik egy művelet felvétele
|
||||
@msg an action is already playing már folyik egy művelet lejátszása
|
||||
@msg the action stopped playing: its document is no longer active a művelet lejátszása leállt: a dokumentuma már nem az aktív
|
||||
@msg speed must be accelerated, step or pause a speed értéke accelerated, step vagy pause lehet
|
||||
@msg seconds must be a whole number from 1 to 60 a seconds értéke 1 és 60 közötti egész szám lehet
|
||||
@msg no such function key nincs ilyen funkcióbillentyű
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5388,6 +5388,7 @@ swatch Bright Violet Violet cerah
|
||||
@msg name is empty nama kosong
|
||||
@msg an action is already recording sebuah tindakan sedang direkam
|
||||
@msg an action is already playing sebuah tindakan sedang diputar
|
||||
@msg the action stopped playing: its document is no longer active tindakan berhenti diputar: dokumennya tidak lagi aktif
|
||||
@msg speed must be accelerated, step or pause speed harus accelerated, step, atau pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds harus bilangan bulat dari 1 sampai 60
|
||||
@msg no such function key tidak ada tombol fungsi seperti itu
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2230 and column 5.
|
@@ -5206,6 +5206,7 @@ lighting Light Luce
|
||||
@msg name is empty il nome è vuoto
|
||||
@msg an action is already recording è già in corso la registrazione di un’azione
|
||||
@msg an action is already playing è già in corso la riproduzione di un’azione
|
||||
@msg the action stopped playing: its document is no longer active la riproduzione dell’azione si è interrotta: il suo documento non è più attivo
|
||||
@msg speed must be accelerated, step or pause speed deve essere accelerated, step o pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds deve essere un numero intero da 1 a 60
|
||||
@msg no such function key tasto funzione inesistente
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5249,6 +5249,7 @@ lighting Light ライト
|
||||
@msg name is empty 名前が空です
|
||||
@msg an action is already recording すでにアクションを記録中です
|
||||
@msg an action is already playing すでにアクションを再生中です
|
||||
@msg the action stopped playing: its document is no longer active アクションの再生を停止しました: そのドキュメントはアクティブではなくなりました
|
||||
@msg speed must be accelerated, step or pause speed には accelerated、step または pause を指定してください
|
||||
@msg seconds must be a whole number from 1 to 60 seconds には 1 から 60 までの整数を指定してください
|
||||
@msg no such function key 指定されたファンクションキーが見つかりません
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5301,6 +5301,7 @@ imageTrace Outline კონტური
|
||||
@msg name is empty სახელი ცარიელია
|
||||
@msg an action is already recording მოქმედება უკვე იწერება
|
||||
@msg an action is already playing მოქმედება უკვე სრულდება
|
||||
@msg the action stopped playing: its document is no longer active მოქმედება შეჩერდა: მისი დოკუმენტი აღარ არის აქტიური
|
||||
@msg speed must be accelerated, step or pause speed უნდა იყოს accelerated, step ან pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds უნდა იყოს მთელი რიცხვი 1-დან 60-მდე
|
||||
@msg no such function key ასეთი ფუნქციური კლავიში არ არის
|
||||
|
||||
|
Can't render this file because it is too large.
|
@@ -5167,6 +5167,7 @@ lighting Light 광원
|
||||
@msg name is empty 이름이 비어 있습니다
|
||||
@msg an action is already recording 이미 액션을 기록하고 있습니다
|
||||
@msg an action is already playing 이미 액션을 재생하고 있습니다
|
||||
@msg the action stopped playing: its document is no longer active 액션 재생이 중지되었습니다: 해당 문서가 더 이상 활성 상태가 아닙니다
|
||||
@msg speed must be accelerated, step or pause speed는 accelerated, step 또는 pause여야 합니다
|
||||
@msg seconds must be a whole number from 1 to 60 seconds는 1에서 60 사이의 정수여야 합니다
|
||||
@msg no such function key 해당 기능 키가 없습니다
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5396,6 +5396,7 @@ swatch Bright Violet Felviolet
|
||||
@msg name is empty naam is leeg
|
||||
@msg an action is already recording er wordt al een actie opgenomen
|
||||
@msg an action is already playing er wordt al een actie afgespeeld
|
||||
@msg the action stopped playing: its document is no longer active de actie is gestopt: het document ervan is niet meer actief
|
||||
@msg speed must be accelerated, step or pause speed moet accelerated, step of pause zijn
|
||||
@msg seconds must be a whole number from 1 to 60 seconds moet een geheel getal van 1 tot 60 zijn
|
||||
@msg no such function key functietoets bestaat niet
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5446,6 +5446,7 @@ mark-style Japanese Japońskie
|
||||
@msg name is empty nazwa jest pusta
|
||||
@msg an action is already recording operacja jest już nagrywana
|
||||
@msg an action is already playing operacja jest już odtwarzana
|
||||
@msg the action stopped playing: its document is no longer active odtwarzanie operacji zatrzymano: jej dokument nie jest już aktywny
|
||||
@msg speed must be accelerated, step or pause speed musi mieć wartość accelerated, step lub pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds musi być liczbą całkowitą od 1 do 60
|
||||
@msg no such function key brak takiego klawisza funkcyjnego
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5508,6 +5508,7 @@ mark-style Japanese Japonesas
|
||||
@msg name is empty o nome está vazio
|
||||
@msg an action is already recording uma ação já está sendo gravada
|
||||
@msg an action is already playing uma ação já está sendo reproduzida
|
||||
@msg the action stopped playing: its document is no longer active a ação parou: o documento dela não está mais ativo
|
||||
@msg speed must be accelerated, step or pause speed deve ser accelerated, step ou pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds deve ser um número inteiro de 1 a 60
|
||||
@msg no such function key tecla de função inexistente
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -5201,6 +5201,7 @@ lighting Light Свет
|
||||
@msg name is empty имя пустое
|
||||
@msg an action is already recording действие уже записывается
|
||||
@msg an action is already playing действие уже воспроизводится
|
||||
@msg the action stopped playing: its document is no longer active воспроизведение действия остановлено: его документ больше не активен
|
||||
@msg speed must be accelerated, step or pause speed должен быть accelerated, step или pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds должно быть целым числом от 1 до 60
|
||||
@msg no such function key такой функциональной клавиши нет
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5548,6 +5548,7 @@ theme Appearance Utseende
|
||||
@msg name is empty namnet är tomt
|
||||
@msg an action is already recording en åtgärd spelas redan in
|
||||
@msg an action is already playing en åtgärd spelas redan upp
|
||||
@msg the action stopped playing: its document is no longer active åtgärden stoppades: dess dokument är inte längre aktivt
|
||||
@msg speed must be accelerated, step or pause speed måste vara accelerated, step eller pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds måste vara ett heltal från 1 till 60
|
||||
@msg no such function key funktionstangenten finns inte
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 25.
|
@@ -5257,6 +5257,7 @@ theme Appearance Görünüm
|
||||
@msg name is empty isim boş
|
||||
@msg an action is already recording zaten bir eylem kaydediliyor
|
||||
@msg an action is already playing zaten bir eylem oynatılıyor
|
||||
@msg the action stopped playing: its document is no longer active eylemin oynatılması durdu: belgesi artık etkin değil
|
||||
@msg speed must be accelerated, step or pause speed accelerated, step veya pause olmalıdır
|
||||
@msg seconds must be a whole number from 1 to 60 seconds 1 ile 60 arasında bir tam sayı olmalıdır
|
||||
@msg no such function key öyle bir işlev tuşu yok
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 5 and column 25.
|
@@ -5186,6 +5186,7 @@ lighting Light Світло
|
||||
@msg name is empty ім’я порожнє
|
||||
@msg an action is already recording дія вже записується
|
||||
@msg an action is already playing дія вже відтворюється
|
||||
@msg the action stopped playing: its document is no longer active відтворення дії зупинено: її документ більше не активний
|
||||
@msg speed must be accelerated, step or pause speed має бути accelerated, step або pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds має бути цілим числом від 1 до 60
|
||||
@msg no such function key такої функціональної клавіші немає
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 177 and column 5.
|
@@ -5187,6 +5187,7 @@ theme Appearance Giao diện
|
||||
@msg name is empty tên trống
|
||||
@msg an action is already recording đang ghi một hành động
|
||||
@msg an action is already playing đang phát một hành động
|
||||
@msg the action stopped playing: its document is no longer active hành động đã dừng phát: tài liệu của nó không còn hoạt động
|
||||
@msg speed must be accelerated, step or pause speed phải là accelerated, step hoặc pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds phải là số nguyên từ 1 đến 60
|
||||
@msg no such function key không có phím chức năng như vậy
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 199 and column 5.
|
@@ -5426,6 +5426,7 @@ lighting Light 光源
|
||||
@msg name is empty 名称为空
|
||||
@msg an action is already recording 已在记录动作
|
||||
@msg an action is already playing 已在播放动作
|
||||
@msg the action stopped playing: its document is no longer active 动作已停止播放:其文档不再是现用文档
|
||||
@msg speed must be accelerated, step or pause speed 必须为 accelerated、step 或 pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds 必须为 1 到 60 之间的整数
|
||||
@msg no such function key 没有此功能键
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 2 and column 73.
|
@@ -5244,6 +5244,7 @@ lighting Light 光源
|
||||
@msg name is empty 名稱為空
|
||||
@msg an action is already recording 已在錄製動作
|
||||
@msg an action is already playing 已在播放動作
|
||||
@msg the action stopped playing: its document is no longer active 動作已停止播放:其文件不再是作用中文件
|
||||
@msg speed must be accelerated, step or pause speed 必須為 accelerated、step 或 pause
|
||||
@msg seconds must be a whole number from 1 to 60 seconds 必須為 1 到 60 之間的整數
|
||||
@msg no such function key 沒有這個功能鍵
|
||||
|
||||
|
Can't render this file because it contains an unexpected character in line 6 and column 47.
|
@@ -1239,7 +1239,7 @@ pub const UI_COMMANDS: &[(&str, &str, &str, &str)] = &[
|
||||
crate::panels::actions::PLAY_ACTION,
|
||||
"Play Action",
|
||||
"",
|
||||
"{action: name, set?: name} play the Actions panel's action named action at the speed ui.action.playbackOptions sets; set names the set to look in (default: every set). Accelerated plays it as one undoable batch → what command.batch returns. Step by Step and Pause For play its first step now and the others one at a time, each its own undo step, until the last or ui.action.stop → {results: [the first step's result], pending: the steps left}. A name no action has, or one that more than one action in the sets looked in has, or an action played while another is still playing step by step or with pauses, is an error and nothing plays",
|
||||
"{action: name, set?: name} play the Actions panel's action named action at the speed ui.action.playbackOptions sets; set names the set to look in (default: every set). Accelerated plays it as one undoable batch → what command.batch returns. Step by Step and Pause For play its first step now and the others one at a time, each its own undo step, until the last, ui.action.stop, or a step that comes due while a different document is active than after the step before → {results: [the first step's result], pending: the steps left}. A name no action has, or one that more than one action in the sets looked in has, or an action played while another is still playing step by step or with pauses, is an error and nothing plays",
|
||||
),
|
||||
(
|
||||
crate::panels::actions::PLAYBACK_OPTIONS,
|
||||
|
||||
@@ -233,7 +233,8 @@ pub fn play(app: &mut VectorcraftApp, set: usize, idx: usize) -> Result<Value, S
|
||||
let pending = steps.len();
|
||||
if pending > 0 {
|
||||
let hold = options.speed == PlaybackSpeed::Step;
|
||||
app.ui.action_playing = Some(Playing { label: a.name, steps, options, next_at: None, hold });
|
||||
let doc = active_doc(app);
|
||||
app.ui.action_playing = Some(Playing { label: a.name, steps, options, next_at: None, hold, doc });
|
||||
if let Some(ctx) = &app.ui_ctx {
|
||||
ctx.request_repaint();
|
||||
}
|
||||
@@ -298,14 +299,24 @@ pub struct Playing {
|
||||
/// With Step by Step, set until the first frame after the first step: that frame draws the
|
||||
/// first step's result and runs no step, since Play in the panel can run after the canvas drew.
|
||||
hold: bool,
|
||||
/// The [`uid`](vectorcraft_engine::DocState::uid) of the document that was active after the
|
||||
/// last step played, if any.
|
||||
doc: Option<u64>,
|
||||
}
|
||||
|
||||
fn active_doc(app: &VectorcraftApp) -> Option<u64> {
|
||||
app.session.active().map(|d| d.uid)
|
||||
}
|
||||
|
||||
/// Runs the next step of the paced playback in progress when it is due at `now` (seconds on the
|
||||
/// app's clock): with Step by Step at each call after the first, so each frame runs one step and the
|
||||
/// frame after Play draws the first step; with Pause For once the pause after the step before has
|
||||
/// passed. A step that fails ends the playback and shows its error. → the seconds until the window
|
||||
/// should draw again while playback goes on
|
||||
/// passed. A step that fails ends the playback and shows its error. When a step is due and the active
|
||||
/// document is not the one that was active after the last step (another document was made active,
|
||||
/// or that one was closed), the playback ends with a status and the rest do not run. → the seconds
|
||||
/// until the window should draw again while playback goes on
|
||||
pub fn tick_playback(app: &mut VectorcraftApp, now: f64) -> Option<f64> {
|
||||
let doc = active_doc(app);
|
||||
let playing = app.ui.action_playing.as_mut()?;
|
||||
if std::mem::take(&mut playing.hold) {
|
||||
return Some(0.0);
|
||||
@@ -319,6 +330,11 @@ pub fn tick_playback(app: &mut VectorcraftApp, now: f64) -> Option<f64> {
|
||||
// The next pause starts when this step runs.
|
||||
playing.next_at = Some(now + pause);
|
||||
}
|
||||
if playing.doc != doc {
|
||||
app.ui.action_playing = None;
|
||||
app.status("the action stopped playing: its document is no longer active");
|
||||
return None;
|
||||
}
|
||||
let Some(step) = playing.steps.pop_front() else {
|
||||
app.ui.action_playing = None;
|
||||
return None;
|
||||
@@ -332,7 +348,10 @@ pub fn tick_playback(app: &mut VectorcraftApp, now: f64) -> Option<f64> {
|
||||
app.status(e);
|
||||
return None;
|
||||
}
|
||||
let playing = app.ui.action_playing.as_ref()?;
|
||||
let doc = active_doc(app);
|
||||
let playing = app.ui.action_playing.as_mut()?;
|
||||
// A step of the action may open, close or switch documents itself.
|
||||
playing.doc = doc;
|
||||
Some(if playing.options.speed == PlaybackSpeed::Pause { pause } else { 0.0 })
|
||||
}
|
||||
|
||||
@@ -2980,6 +2999,38 @@ mod tests {
|
||||
assert_eq!(x(&app), 33.0, "accelerated: the recorded batches play inside the action's batch");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_paced_playback_ends_when_another_document_becomes_active() {
|
||||
let (mut app, x) = app_with_three_moves();
|
||||
app.run(PLAYBACK_OPTIONS, json!({"speed": "pause", "seconds": 1})).unwrap();
|
||||
play(&mut app, 0, 0).unwrap();
|
||||
assert_eq!(tick_playback(&mut app, 0.0), Some(1.0));
|
||||
app.run("file.new", json!({"width": 50, "height": 50})).unwrap();
|
||||
assert_eq!(tick_playback(&mut app, 0.5), Some(0.5), "nothing ends before the next step is due");
|
||||
app.run("document.activate", json!({"index": 0})).unwrap();
|
||||
assert_eq!(tick_playback(&mut app, 1.0), Some(1.0));
|
||||
assert_eq!(x(&app), 3.0, "the document is active again when the step is due, so it runs");
|
||||
app.run("document.activate", json!({"index": 1})).unwrap();
|
||||
let other = app.session.active().unwrap().doc.clone();
|
||||
assert_eq!(tick_playback(&mut app, 5.0), None, "the playback ends");
|
||||
assert!(app.ui.action_playing.is_none());
|
||||
assert_eq!(app.ui.status, "the action stopped playing: its document is no longer active");
|
||||
assert!(std::sync::Arc::ptr_eq(&app.session.active().unwrap().doc, &other), "no step ran in the other document");
|
||||
app.run("document.activate", json!({"index": 0})).unwrap();
|
||||
assert_eq!(tick_playback(&mut app, 10.0), None);
|
||||
assert_eq!(x(&app), 3.0, "the rest of the steps do not run in the first document either");
|
||||
// A step that makes another document active itself does not end the playback.
|
||||
app.ui.action_sets[0].actions[0].steps.insert(0, ("document.activate".into(), json!({"index": 0})));
|
||||
app.run("document.activate", json!({"index": 1})).unwrap();
|
||||
app.run(PLAYBACK_OPTIONS, json!({"speed": "step"})).unwrap();
|
||||
app.ui.status.clear();
|
||||
play(&mut app, 0, 0).unwrap();
|
||||
assert_eq!(tick_playback(&mut app, 0.0), Some(0.0));
|
||||
while tick_playback(&mut app, 0.0).is_some() {}
|
||||
assert_ne!(app.ui.status, "the action stopped playing: its document is no longer active");
|
||||
assert_eq!(x(&app), 10.0, "the moves after the step ran in the document it made active");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_failing_step_ends_a_paced_playback_with_its_error() {
|
||||
let (mut app, x) = app_with_three_moves();
|
||||
|
||||
+4
-1
@@ -1852,7 +1852,10 @@ already walks Image Trace. Short agent entry points:
|
||||
sets; `set` names the set to look in (default: every set), and a `set` that is not a string is an error. At
|
||||
Accelerated it plays the action as one undoable batch and returns what `command.batch` returns. At Step by Step and
|
||||
Pause For it plays the first step at once and returns `{results: [the first step's result], pending}`, where
|
||||
`pending` counts the steps still to play; the app plays them one at a time, each as its own undo step. A name that no
|
||||
`pending` counts the steps still to play; the app plays them one at a time, each as its own undo step. When the next
|
||||
step is due and the active document is not the one that was active after the step before (another document was
|
||||
made active, or that document was closed), the playback ends with a status and the rest do not play; a step that
|
||||
makes another document active itself does not end it. A name that no
|
||||
action has, or that more than one action in the sets looked in has, or whose every step is excluded, is an error, and
|
||||
then nothing plays. So is an action played while another is still playing at Step by Step or Pause For. A
|
||||
`command.batch` step, which an action played or a panel operation run as one batch records, plays as its own steps,
|
||||
|
||||
@@ -581,7 +581,7 @@ Moved from the ROADMAP's "Shipped so far" on 2026-10-10. Update it when a featur
|
||||
- Actions panel (record/playback, persisted), generic parameter dialogs for every "…" command.
|
||||
- Actions panel: the current set is kept with the UI preferences, so after a restart a recording goes into the set that was current, not into the first set. With no set current, Begin Recording records into the first set and makes it current.
|
||||
- Actions panel: expand an action to show its recorded steps, then clear a step's checkmark to keep it in the action but skip it during playback. The action and set checkmarks include or exclude all their steps; a mixed checkmark includes all. Alt/Option-clicking a step checkmark keeps that step as it was and applies the opposite inclusion state to the other steps in its action. This follows the public [Exclude commands from an action](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/exclude-commands-from-actions.html) guide; the scope of the mixed-state and Alt-click behavior is VectorCraft's design. The exclusion survives UI restart, action duplication, and `.vcactions` save/load. Existing version 1 action set files load with every step included.
|
||||
- Actions panel: the panel menu's Playback Options… sets how actions play: Accelerated (the default) plays every step at once, Step by Step plays one step at a time with the canvas drawn after each, and Pause For waits the given number of seconds between steps ([Specify playback speed](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/specify-playback-speed.html); `ui.action.playbackOptions`). VectorCraft's own rules, which the page does not cover: the pause is a whole number of seconds from 1 to 60, the setting is kept with the UI preferences, Stop Playing/Recording ends a paced playback, each step of a paced playback is its own undo step, and Batch… plays at full speed.
|
||||
- Actions panel: the panel menu's Playback Options… sets how actions play: Accelerated (the default) plays every step at once, Step by Step plays one step at a time with the canvas drawn after each, and Pause For waits the given number of seconds between steps ([Specify playback speed](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/specify-playback-speed.html); `ui.action.playbackOptions`). VectorCraft's own rules, which the page does not cover: the pause is a whole number of seconds from 1 to 60, the setting is kept with the UI preferences, a paced playback ends at Stop Playing/Recording or when a step comes due while another document is active, each step of a paced playback is its own undo step, and Batch… plays at full speed.
|
||||
- Actions panel: Delete Selection deletes the selected action set with its actions and keeps the other sets ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html); `ui.actionSet.delete`). VectorCraft's own rules, which the overview does not cover: deleting a set asks first, Shift-click on a set's name selects a range of sets to delete together, the panel menu's Delete does the same, and Default Actions and the last set can be deleted. Undo does not bring a deleted set back.
|
||||
- Actions panel: the panel menu's Duplicate copies the selected action, else the current action set with all its actions ([Actions panel overview](https://helpx.adobe.com/illustrator/desktop/automate-visualize-data/automate-actions/actions-panel-overview.html); `ui.actionSet.duplicate`). VectorCraft's own rules, which the overview does not cover: the copy goes right after the original, is named after it with " copy" added and is selected.
|
||||
- Batch… over data sets names each file after the document and the data set (`action.batch`). It writes `/`, `\`, `:`, `<`, `>`, `"`, `|`, `?`, `*` and control characters in the data set's name as `-`, and adds `-2`, `-3`… to a name an earlier data set used.
|
||||
|
||||
Reference in New Issue
Block a user