Extracted all parts of all characters

This commit is contained in:
2021-10-17 19:05:40 -07:00
parent 3fd0efb4d8
commit 5c7468283b
5 changed files with 43 additions and 11 deletions

View File

@ -3,10 +3,9 @@
# This software is released under the MIT License.
# https://opensource.org/licenses/MIT
function(tool_vn_character DEP_NAME IN OUT)
add_custom_target(${DEP_NAME}
COMMAND node ${TOOLS_DIR}/vn/character-sheet-generator.js --root="${ROOT_DIR}" --in="${ROOT_DIR}/${IN}" --out="${OUT}"
COMMAND node ${TOOLS_DIR}/vn/character-sheet-generator.js --assets="${ASSETS_DIR}" --root="${ROOT_DIR}" --in="${IN}" --out="${OUT}"
COMMENT "Adding VN Character ${FILE_NAME}"
)
endfunction()

View File

@ -7,6 +7,7 @@ const { mkdirp } = require('../utils/file');
// Parse Args
if(!args.root) throw new Error(`Missing root argument`);
if(!args.assets) throw new Error(`Missing assets argument`);
if(!args.in) throw new Error(`Missing in argument`);
if(!args.out) throw new Error(`Missing out argument`);
if(!args.in.endsWith('xml')) throw new Error(`Invalid in XML`);
@ -14,9 +15,9 @@ if(!args.out.endsWith('png')) throw new Error(`Invalid out PNG`);
// Determine in and out.
const root = path.resolve(args.root);
const file = path.resolve(args.in);
const file = path.resolve(args.root, args.assets, args.in);
if(!fs.existsSync(file)) throw new Error(`Could not find ${file}`);
const outFile = path.resolve(args.out);
const outFile = path.resolve(args.assets, args.out);
if(fs.existsSync(outFile)) return;
// Load XML
@ -25,7 +26,7 @@ const [ character ] = data.elements;
// Validate file.
if(!character.attributes.context) throw new Error(`Missing context`)
const dir = path.resolve(root, 'assets', character.attributes.context);
const dir = path.resolve(root, args.assets, character.attributes.context);
// Parse base and layers
const base = character.elements.find(e => e.name == 'base').attributes;