Add anchor character location CGs
This commit is contained in:
@@ -210,6 +210,88 @@ def main() -> None:
|
||||
f"{entry['location_id']} revision candidate",
|
||||
)
|
||||
|
||||
character_location_asset_path = DATA / "character_location_assets.json"
|
||||
character_location_accepted = 0
|
||||
character_location_revision_count = 0
|
||||
if character_location_asset_path.exists():
|
||||
character_location_assets_doc = load_json(character_location_asset_path)
|
||||
character_location_minimum = character_location_assets_doc[
|
||||
"minimum_dimensions"
|
||||
]
|
||||
character_location_min_width = character_location_minimum["width"]
|
||||
character_location_min_height = character_location_minimum["height"]
|
||||
|
||||
contact_sheet = ROOT / character_location_assets_doc["contact_sheet"]
|
||||
if not contact_sheet.exists():
|
||||
fail(f"character-location contact sheet is missing: {contact_sheet}")
|
||||
png_dimensions(contact_sheet)
|
||||
|
||||
presence_doc = load_json(DATA / "character_location_presence.json")
|
||||
allowed_pairs = {
|
||||
(entry["character_id"], location["location_id"])
|
||||
for entry in presence_doc["characters"]
|
||||
for location in entry["locations"]
|
||||
}
|
||||
|
||||
character_location_asset_entries = character_location_assets_doc["assets"]
|
||||
seen_pairs = set()
|
||||
for entry in character_location_asset_entries:
|
||||
character_id = entry["character_id"]
|
||||
location_id = entry["location_id"]
|
||||
pair = (character_id, location_id)
|
||||
|
||||
if character_id not in character_id_set:
|
||||
fail(
|
||||
"character-location asset references missing character id: "
|
||||
f"{character_id}"
|
||||
)
|
||||
if location_id not in location_ids:
|
||||
fail(
|
||||
"character-location asset references missing location id: "
|
||||
f"{location_id}"
|
||||
)
|
||||
if pair not in allowed_pairs:
|
||||
fail(
|
||||
"character-location asset references unavailable location: "
|
||||
f"{character_id}/{location_id}"
|
||||
)
|
||||
if pair in seen_pairs:
|
||||
fail(
|
||||
"character-location asset manifest contains duplicate pair: "
|
||||
f"{character_id}/{location_id}"
|
||||
)
|
||||
seen_pairs.add(pair)
|
||||
|
||||
status = entry["status"]
|
||||
if status not in {"accepted", "needs_revision", "pending", "rejected"}:
|
||||
fail(
|
||||
f"{character_id}/{location_id} has invalid "
|
||||
f"character-location asset status {status}"
|
||||
)
|
||||
|
||||
path_value = entry.get("path")
|
||||
if status == "accepted":
|
||||
character_location_accepted += 1
|
||||
if not path_value:
|
||||
fail(
|
||||
f"{character_id}/{location_id} accepted asset lacks a path"
|
||||
)
|
||||
validate_asset_image(
|
||||
ROOT / path_value,
|
||||
character_location_min_width,
|
||||
character_location_min_height,
|
||||
f"{character_id}/{location_id}",
|
||||
)
|
||||
elif status == "needs_revision":
|
||||
character_location_revision_count += 1
|
||||
if path_value:
|
||||
validate_asset_image(
|
||||
ROOT / path_value,
|
||||
character_location_min_width,
|
||||
character_location_min_height,
|
||||
f"{character_id}/{location_id} revision candidate",
|
||||
)
|
||||
|
||||
print(
|
||||
"Validated character asset manifest: "
|
||||
f"{accepted}/{len(asset_entries)} accepted, "
|
||||
@@ -217,7 +299,9 @@ def main() -> None:
|
||||
f"{date_cg_accepted} accepted date CG tiers, "
|
||||
f"{date_cg_revision_count} date CG tiers need revision, "
|
||||
f"{location_accepted} accepted location backgrounds, "
|
||||
f"{location_revision_count} location backgrounds need revision."
|
||||
f"{location_revision_count} location backgrounds need revision, "
|
||||
f"{character_location_accepted} accepted character-location CGs, "
|
||||
f"{character_location_revision_count} character-location CGs need revision."
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user