Explorar el Código

Add Sylvia Beauregard

Also add a 'setup' script that both creates a directory and runs
the bounds-fixer script on it
master
Fen Dweller hace 3 años
padre
commit
b3c9f45fb3
Se han modificado 5 ficheros con 1314 adiciones y 21 borrados
  1. +12
    -0
      media/attribution.js
  2. +1243
    -0
      media/characters/sylvia-beauregard/front.svg
  3. +23
    -0
      presets/characters.js
  4. +25
    -21
      scripts/add-bounds.py
  5. +11
    -0
      scripts/setup.py

+ 12
- 0
media/attribution.js Ver fichero

@@ -22257,6 +22257,18 @@ const attributionData = {
"epicoart"
]
},
{
prefix: "./media/characters/sylvia-beauregard/",
files: [
{ name: "front.svg", source: "https://www.deviantart.com/epicoart/art/Sylvia-897733355" }
],
authors: [
"epicoart"
],
owners: [
"epicoart"
]
},
//characters
{
prefix: "./media/fiction/halo/halo/",


+ 1243
- 0
media/characters/sylvia-beauregard/front.svg
La diferencia del archivo ha sido suprimido porque es demasiado grande
Ver fichero


+ 23
- 0
presets/characters.js Ver fichero

@@ -64085,6 +64085,29 @@ characterMakers.push(() => makeCharacter(
]
))

characterMakers.push(() => makeCharacter(
{ name: "Sylvia Beauregard", species: ["human"], tags: ["anthro"] },
{
front: {
height: math.unit(6, "feet"),
weight: math.unit(220, "lb"),
name: "Front",
image: {
source: "./media/characters/sylvia-beauregard/front.svg",
extra: 483/479,
bottom: 6/489
}
},
},
[
{
name: "Macro",
height: math.unit(2071, "feet"),
default: true
},
]
))

//characters

function makeCharacters() {


+ 25
- 21
scripts/add-bounds.py Ver fichero

@@ -5,30 +5,34 @@ from xml.etree import ElementTree
from pathlib import Path
import os

for path in Path(sys.argv[1]).rglob("*.svg"):
if path.name.startswith("z_"):
print("Renamed {0}".format(path))
renamed = path.with_name(path.name[2:])
if os.path.exists(renamed):
os.unlink(renamed)
os.rename(path, renamed)
def add_bounds(directory):
for path in Path(directory).rglob("*.svg"):
if path.name.startswith("z_"):
print("Renamed {0}".format(path))
renamed = path.with_name(path.name[2:])
if os.path.exists(renamed):
os.unlink(renamed)
os.rename(path, renamed)

for path in Path(sys.argv[1]).rglob('*.svg'):
tree = ElementTree.ElementTree()
parsed = tree.parse(path)
for path in Path(directory).rglob('*.svg'):
tree = ElementTree.ElementTree()
parsed = tree.parse(path)

if "width" not in parsed.attrib:
print(f"Rewriting {path}")
width, height = parsed.attrib["viewBox"].split(" ")[-2:]
if "width" not in parsed.attrib:
print(f"Rewriting {path}")
width, height = parsed.attrib["viewBox"].split(" ")[-2:]

# I'd rather avoid mangling the XML files by parsing them first
# XML is awful and we never should have invented it :(
# I'd rather avoid mangling the XML files by parsing them first
# XML is awful and we never should have invented it :(

with open(path, "r", encoding="utf-8") as file:
data = file.read()
with open(path, "r", encoding="utf-8") as file:
data = file.read()

data = re.sub('viewBox="0 0', f'width="{width}" height="{height}" viewBox="0 0', data)
data = re.sub('viewBox="0 0', f'width="{width}" height="{height}" viewBox="0 0', data)

with open(path, "w", encoding="utf-8") as file:
file.write(data)
with open(path, "w", encoding="utf-8") as file:
file.write(data)

if __name__ == "__main__":
add_bounds(sys.argv[1])

+ 11
- 0
scripts/setup.py Ver fichero

@@ -0,0 +1,11 @@
import importlib

add_bounds = importlib.import_module("add-bounds").add_bounds

import sys
import os
path = sys.argv[1]

os.makedirs(path, exist_ok=True)

add_bounds(sys.argv[1])

Cargando…
Cancelar
Guardar