From d31cb5cf3823406ced92618a7410336ca64da67e Mon Sep 17 00:00:00 2001 From: Nat Quayle Nelson Date: Fri, 12 May 2023 11:40:40 -0600 Subject: [PATCH] press dd to redefine last delay length --- src/hollywoo/Director.hx | 1 + src/hollywoo/Movie.kiss | 17 ++++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/src/hollywoo/Director.hx b/src/hollywoo/Director.hx index 489fc95..af14a69 100644 --- a/src/hollywoo/Director.hx +++ b/src/hollywoo/Director.hx @@ -44,6 +44,7 @@ interface Director, Actor, Sound, Song, Prop, VoiceTrack, Cam function showPauseMenu(resume:Continuation):Void; function chooseString(prompt:String, choices:Array, submit:String->Void):Void; + function enterString(prompt:String, submit:String->Void):Void; function defineStagePosition(submit:StagePosition->Void):Void; function defineLightSource(submit:LightSource->Void):Void; diff --git a/src/hollywoo/Movie.kiss b/src/hollywoo/Movie.kiss index e697597..6d49327 100644 --- a/src/hollywoo/Movie.kiss +++ b/src/hollywoo/Movie.kiss @@ -20,6 +20,10 @@ (prop :Map voiceTracksPerActor (new Map)) (prop &mut :DelayHandling delayHandling AutoWithSkip) + + (prop &mut :String lastDelay "") + (prop &mut :Float lastDelayLength 0) + // Mutable representation of frames in time: (prop :FuzzyMap> scenes (new FuzzyMap>)) @@ -230,6 +234,13 @@ ->cc (director.showPauseMenu cc)) (#when debug + (shortcutHandler.registerItem "[d]efine [d]elay" + ->cc + (director.enterString "Redefine $lastDelay from $lastDelayLength sec?" + ->lengthStr + (let [length (Std.parseFloat lengthStr)] + (delayLengths.put lastDelay (new DelayLength length)) + (cc)))) (shortcutHandler.registerItem "[d]efine [p]osition" ->cc (director.chooseString "Which position?" (dictGet positionsInScene sceneKey) @@ -304,7 +315,11 @@ (hollywooMethod :Void delay true [:Dynamic length :Continuation cc] (let [sec (typeCase [length] ([:Float sec] sec) - ([:String key] .length (delayLengths.get key)) + ([:String key] + (let [lengthFloat .length (delayLengths.get key)] + (set lastDelay key) + (set lastDelayLength lengthFloat) + lengthFloat)) (never otherwise))] (case delayHandling (Auto