non-automatic conversions

This commit is contained in:
2024-08-17 19:30:01 -05:00
parent 05d2c189b4
commit 824b13b86a
6 changed files with 15 additions and 8 deletions

View File

@@ -5,5 +5,6 @@ typedef Conversion = {
outputType:String,
canConvert:String->Bool,
convert:String->String,
name:String
name:String,
?neverAutomatic:Bool
};

View File

@@ -210,7 +210,7 @@
(function registerConversion [:Conversion c]
(_conversions.push c))
(method :Map<String,String> validConversions [index :String->Dynamic reportError]
(method :Map<String,String> validConversions [index :Bool automatic :String->Dynamic reportError]
(let [sourceFile inFile
outputFile outFile
block (nth blocks index)
@@ -219,6 +219,7 @@
(doFor c _conversions
(case c
((when (and
(or !automatic !c.neverAutomatic)
(= sourceType (sourceFile.extension))
(= outputType (outputFile.extension))
(canConvert source))
@@ -232,7 +233,7 @@
(method :Void fullAutoConvert [:String->Dynamic reportError]
(doFor [idx block] (enumerate blocks)
(when (or block.locked block.outText) (continue))
(let [vc (validConversions idx reportError)]
(let [vc (validConversions idx true reportError)]
(when (= 1 (count vc))
(doFor =>conversionName text vc
(print "Converting block $(+ idx 1)/${blocks.length}")

View File

@@ -2,7 +2,8 @@
&prop &mut :String sourceType
&prop &mut :String outputType
:(String,Array<String>)->Bool canConvertNames
:(String,Array<String>)->String convertBlock]
:(String,Array<String>)->String convertBlock
&opt :Bool _neverAutomatic]
[
&mut :String->Bool canConvert ->block {
(Main.updateNameExceptions)
@@ -12,4 +13,5 @@
(Main.updateNameExceptions)
(let [names (Names.findNames block)] (convertBlock block names))
}
&mut :Null<Bool> neverAutomatic _neverAutomatic
])

View File

@@ -2,8 +2,10 @@
&prop &mut :String sourceType
&prop &mut :String outputType
:Stream->Bool canConvertStream
:Stream->String convertStream]
:Stream->String convertStream
&opt :Bool _neverAutomatic]
[
&mut :String->Bool canConvert ->block (canConvertStream (Stream.fromString block))
&mut :String->String convert ->block (convertStream (Stream.fromString block))
&mut :Null<Bool> neverAutomatic _neverAutomatic
])

View File

@@ -127,7 +127,8 @@
(FileConversionProject.registerConversion
(new tct.StreamConversion "Delay" "fountain" "hollywoo"
->stream (isScreenLine stream.content)
->stream "DELAY ##\"$(stream.content.trim)\"##\n"))
->stream "DELAY ##\"$(stream.content.trim)\"##\n"
true))
(function newSceneConversion [engine command setArgs newCamera containsPlaceholders]
(FileConversionProject.registerConversion