backup with fully working version, only one texture renders
This commit is contained in:
@@ -50,6 +50,26 @@ _LAYER_KEYWORDS = (
|
||||
'_fur', '_shell', '_crackiness',
|
||||
)
|
||||
|
||||
# Entities whose base skin is one of several fur/colour variants. The preview
|
||||
# picks one at random so the model matches the variety the pack shows in-game.
|
||||
VARIANTS = {
|
||||
'wolf': [
|
||||
'wolf/wolf.png', 'wolf/wolf_ashen.png', 'wolf/wolf_black.png',
|
||||
'wolf/wolf_chestnut.png', 'wolf/wolf_rusty.png', 'wolf/wolf_snowy.png',
|
||||
'wolf/wolf_spotted.png', 'wolf/wolf_striped.png', 'wolf/wolf_woods.png',
|
||||
],
|
||||
'fox': ['fox/fox.png', 'fox/snow_fox.png'],
|
||||
'cat': [
|
||||
'cat/tabby.png', 'cat/black.png', 'cat/red.png', 'cat/siamese.png',
|
||||
'cat/british_shorthair.png', 'cat/calico.png', 'cat/persian.png',
|
||||
'cat/ragdoll.png', 'cat/white.png', 'cat/jellie.png', 'cat/all_black.png',
|
||||
],
|
||||
'cow': [
|
||||
'cow/temperate_cow.png', 'cow/cold_cow.png', 'cow/warm_cow.png',
|
||||
'cow/red_mooshroom.png', 'cow/brown_mooshroom.png',
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def _base_candidates(entity):
|
||||
"""Return (entity, [candidate relative paths]) in priority order."""
|
||||
@@ -77,7 +97,7 @@ def _base_candidates(entity):
|
||||
|
||||
|
||||
def refresh_vanilla_index():
|
||||
"""Rebuild the entity → base-skin map from the extracted vanilla set."""
|
||||
"""Rebuild the entity → {default, variants} skin map from the vanilla set."""
|
||||
root = os.path.join(settings.MEDIA_ROOT, 'vanilla', ENTITY_ROOT)
|
||||
if not os.path.isdir(root):
|
||||
raise FileNotFoundError(f'{root} missing — extract vanilla entity textures first')
|
||||
@@ -87,19 +107,23 @@ def refresh_vanilla_index():
|
||||
rel = os.path.join(root, entry)
|
||||
if entry.endswith('.png'):
|
||||
entity = entry[:-4]
|
||||
if not index.get(entity):
|
||||
index[entity] = entry
|
||||
index.setdefault(entity, {'default': entry, 'variants': [entry]})
|
||||
continue
|
||||
if not os.path.isdir(rel):
|
||||
continue
|
||||
entity = entry
|
||||
_, candidates = _base_candidates(entity)
|
||||
if candidates and not index.get(entity):
|
||||
index[entity] = candidates[0]
|
||||
if candidates and entity not in index:
|
||||
index[entity] = {'default': candidates[0], 'variants': [candidates[0]]}
|
||||
|
||||
for entity, rel in ALIASES.items():
|
||||
if not index.get(entity):
|
||||
index[entity] = rel
|
||||
if entity not in index:
|
||||
index[entity] = {'default': rel, 'variants': [rel]}
|
||||
|
||||
for entity, variants in VARIANTS.items():
|
||||
if entity in index and variants:
|
||||
index[entity]['default'] = variants[0]
|
||||
index[entity]['variants'] = variants
|
||||
|
||||
out = os.path.join(settings.MEDIA_ROOT, 'vanilla', INDEX_NAME)
|
||||
with open(out, 'w') as f:
|
||||
|
||||
Reference in New Issue
Block a user