From 603465549f34c1a704c3dc2c86f93ead649c5694 Mon Sep 17 00:00:00 2001 From: "Frenken, S.H. (Sander)" <> Date: Sat, 11 Jan 2025 09:43:05 +0100 Subject: [PATCH] Update z-position script usage and readme --- ...dex_html.yml => validate-site-sources.yml} | 12 +- README.md | 33 +- index.html | 132 +-- scripts/generate_sources.js | 4 +- scripts/{ => zPositioning}/parse_zpos.js | 4 +- scripts/{ => zPositioning}/update_zpos.js | 3 +- scripts/zPositioning/z_positions.csv | 821 ++++++++++++++++++ scripts/z_positions.csv | 326 ------- sheet_definitions/dress_bodice.json | 6 +- sheet_definitions/head_ears_cat.json | 2 +- sheet_definitions/head_ears_wolf.json | 2 +- sheet_definitions/heads_frankenstein.json | 6 +- sheet_definitions/heads_vampire.json | 2 +- sheet_definitions/legs_skirt_belle.json | 6 +- sheet_definitions/legs_skirt_overskirt.json | 6 +- sheet_definitions/shield_heater_paint.json | 4 +- .../shield_heater_revised_paint.json | 4 +- sheet_definitions/torso_armour_leather.json | 4 +- sheet_definitions/torso_armour_plate.json | 24 +- sheet_definitions/weapon_polearm_spear.json | 4 +- .../weapon_ranged_bow_normal.json | 4 +- 21 files changed, 966 insertions(+), 443 deletions(-) rename .github/workflows/{validate-index_html.yml => validate-site-sources.yml} (74%) rename scripts/{ => zPositioning}/parse_zpos.js (90%) rename scripts/{ => zPositioning}/update_zpos.js (86%) create mode 100644 scripts/zPositioning/z_positions.csv delete mode 100644 scripts/z_positions.csv diff --git a/.github/workflows/validate-index_html.yml b/.github/workflows/validate-site-sources.yml similarity index 74% rename from .github/workflows/validate-index_html.yml rename to .github/workflows/validate-site-sources.yml index 5e8cbb9631..9e83c00770 100644 --- a/.github/workflows/validate-index_html.yml +++ b/.github/workflows/validate-site-sources.yml @@ -1,4 +1,4 @@ -name: Validate index_html +name: Validate site sources on: push: @@ -7,8 +7,8 @@ on: branches: [ master ] jobs: - validate_index_html: - name: Validate index html + validate_site_sources: + name: Validate site sources runs-on: ubuntu-latest permissions: contents: read @@ -17,13 +17,13 @@ jobs: - name: Checkout code uses: actions/checkout@v3 - - name: Validate HTML generation + - name: Validate site sources generation run: | node scripts/generate_sources.js - name: Assert git diff run: | if [[ `git status --porcelain` ]]; then - echo "Differences found after (re)generation of the index.html" - echo "Please refer to the README in order to learn how to generate the index.html properly." + echo "Differences found after (re)generation of the site sources" + echo "Please refer to the README in order to learn how to generate the site's sources properly." exit -1 fi diff --git a/README.md b/README.md index 1fe4aeafe3..29abae3baf 100755 --- a/README.md +++ b/README.md @@ -75,19 +75,42 @@ Make sure the name starts with `div_sheet_`, and match the postfix with the name When adding files to the project, please add valid licensing information inside the json files as well. Note the entire list of authors for that image, a URL for each piece of art from which this image is derived, and a list of licenses under which the art is available. If you don't add license information for your newly added files, the generation of the site sources will fail. At this point, you will need to run a script that will generate the final `index.html`. -In order to do that, run `node scripts/generate_sources.js` from the root folder. +In order to do that, run: + +`node scripts/generate_sources.js` + This will generate the `index.html` from the `source_index.html`. In case you want to push your changes, be sure to run this script and never change the `index.html` manually. The CI will reject any PR's that contain manual changes made on the `index.html`. -### Run +#### z-positions -To run this project, just clone the repo and open `index.html` in your browser of choice. +In order to facilitate easier management of the z-positions of the assets in this repo, there is a [script](/scripts/zPositioning/parse_zpos.js) that traverses all JSON files and write's the layer's z-position to a CSV. + +To run this script, use: + +`node scripts/zPositioning/parse_zpos.js` + +This [CSV file](/scripts/zPositioning/z_positions.csv) will be regenerated each time one invokes: + +`node scripts/generate_sources.js` -### z-positions +Therefore, before creating a PR, make sure you have committed the CSV to the repo as well. -TBD +Using this CSV, one can more clearly see the overview of all the z-position used per asset's layer. + +Moreover, one can adjust the z-position from within the CSV, and then run: + +`node scripts/zPositioning/update_zpos.js` + +In order to reflect the changes made back into the JSON files. + +**Concluding, please remember that the JSON files will always contain the source of truth with regard to the z-position an asset will be rendered at. The CSV is there to give an overview of the z-positions in use, and provides a mean to easily alter them from a single file.** + +### Run + +To run this project, just clone the repo and open `index.html` in your browser of choice. ### Examples ![example](https://github.com/liberatedpixelcup/Universal-LPC-Spritesheet-Character-Generator/blob/master/example.png) diff --git a/index.html b/index.html index 000bf0cbd2..08d4d672c6 100644 --- a/index.html +++ b/index.html @@ -10203,199 +10203,199 @@

Head