in generated export string, use structure name which is based on the name of the input file
This commit is contained in:
@@ -69,7 +69,7 @@ struct
|
||||
val squares = LayerTree.flatten (maxSide, layerTree)
|
||||
|
||||
val exportString =
|
||||
CollisionTree.toExportString (squares, canvasWidth, canvasHeight)
|
||||
CollisionTree.toExportString (squares, canvasWidth, canvasHeight, openFilePath)
|
||||
val msg = EXPORT_SQUARES {output = exportString, filepath = openFilePath}
|
||||
in
|
||||
(model, [FILE msg])
|
||||
|
||||
@@ -585,7 +585,7 @@ struct
|
||||
item :: acc
|
||||
end
|
||||
|
||||
fun toExportString (squares, canvasWidth, canvasHeight) =
|
||||
fun toExportString (squares, canvasWidth, canvasHeight, filepath) =
|
||||
let
|
||||
val size = Int.max (canvasWidth, canvasHeight)
|
||||
val qtree = buildTree (0, 0, size, squares)
|
||||
@@ -594,10 +594,12 @@ struct
|
||||
val f = toExportStringFolder (canvasWidth, canvasHeight)
|
||||
val coords = BinTree.foldr (f, bintree, [])
|
||||
val coords = String.concatWith ",\n" coords
|
||||
|
||||
val structureName = FileString.filenameToStructureName filepath
|
||||
val structureStart = String.concat ["structure ", structureName, " = struct\n"]
|
||||
in
|
||||
String.concat
|
||||
[ "structure AAA = \nstruct\n"
|
||||
|
||||
[ structureStart
|
||||
, " fun xToNdc (xOffset, xpos, scale, halfWidth) =\n"
|
||||
, " ((xpos * scale + xOffset) - halfWidth) / halfWidth\n\n"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user