mirror of
https://github.com/exogen/t2-mapper.git
synced 2026-02-17 21:53:50 +00:00
add TorqueScript transpiler and runtime
This commit is contained in:
parent
c8391a1056
commit
7d10fb7dee
49 changed files with 12324 additions and 2075 deletions
17
src/imageFileList.ts
Normal file
17
src/imageFileList.ts
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
export function parseImageFileList(source: string) {
|
||||
const lines = source
|
||||
.split(/(?:\r\n|\r|\n)/g)
|
||||
.map((line) => line.trim())
|
||||
.filter(Boolean)
|
||||
.filter((line) => !line.startsWith(";")); // discard comments
|
||||
|
||||
return lines.map((line) => {
|
||||
const fileWithCount = line.match(/^(.+)\s(\d+)$/);
|
||||
if (fileWithCount) {
|
||||
const frameCount = parseInt(fileWithCount[2], 10);
|
||||
return { name: fileWithCount[1], frameCount };
|
||||
} else {
|
||||
return { name: line, frameCount: 1 };
|
||||
}
|
||||
});
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue