🚀 Blueprint System, Dark Chibi Animals & Massive Reference Organization
FEATURES: ✅ Blueprint System: Auto-generated ghost/hologram items for building mode ✅ ItemManager: Logic for Item/Blueprint switching ✅ New Animals: Cow, Pig, Bear, Wolf (Dark Noir Chibi Style) ORGANIZATION: ✅ Flattened Reference Library: All 6k+ images in 'glavna_referenca' for easy review ✅ Cleanup: Empty 'ZA_PREGLED' and '_NESORTIRANO' sorted ✅ Unlocked: 'glavna_referenca' ready for manual editing STATUS: Ready for DEMO assembly!
This commit is contained in:
83
scripts/generate_blueprints.py
Normal file
83
scripts/generate_blueprints.py
Normal file
@@ -0,0 +1,83 @@
|
||||
import os
|
||||
from PIL import Image, ImageEnhance
|
||||
|
||||
# Konfiguracija
|
||||
SOURCE_DIR = os.path.abspath("assets/slike/items")
|
||||
DEST_DIR = os.path.abspath("assets/slike/items/blueprints")
|
||||
|
||||
# Prezri te mape in datoteke
|
||||
IGNORE_DIRS = {'blueprints', '.DS_Store'}
|
||||
EXTENSIONS = {'.png', '.jpg', '.jpeg'}
|
||||
|
||||
def create_blueprint_effect(image_path, save_path):
|
||||
try:
|
||||
img = Image.open(image_path).convert("RGBA")
|
||||
|
||||
# 1. Naredi sliko prosojno (Ghost effect)
|
||||
# Split channels
|
||||
r, g, b, a = img.split()
|
||||
|
||||
# Zmanjšaj alpha kanal (prosojnost na 60%)
|
||||
# Opcija: Lahko bi uporabil constante, ampak point() je hiter
|
||||
a = a.point(lambda p: p * 0.6)
|
||||
|
||||
# 2. Dodaj modrikast tint (Hologram effect)
|
||||
# Povečaj Blue kanal, zmanjšaj Red in Green
|
||||
r = r.point(lambda p: p * 0.5) # Temnejši
|
||||
g = g.point(lambda p: p * 0.7) # Srednji
|
||||
b = b.point(lambda p: min(p * 1.5, 255)) # Svetlejši modri
|
||||
|
||||
# Združi nazaj
|
||||
ghost_img = Image.merge("RGBA", (r, g, b, a))
|
||||
|
||||
# Shrani
|
||||
ghost_img.save(save_path, "PNG")
|
||||
print(f"👻 Created blueprint: {os.path.basename(save_path)}")
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"❌ Error processing {image_path}: {e}")
|
||||
return False
|
||||
|
||||
def main():
|
||||
if not os.path.exists(DEST_DIR):
|
||||
os.makedirs(DEST_DIR)
|
||||
|
||||
print(f"🔍 Scanning {SOURCE_DIR} for items...")
|
||||
|
||||
count = 0
|
||||
|
||||
for root, dirs, files in os.walk(SOURCE_DIR):
|
||||
# Preskoči samo mapo blueprints da ne delamo blueprintov iz blueprintov
|
||||
if 'blueprints' in root:
|
||||
continue
|
||||
|
||||
for file in files:
|
||||
if any(file.lower().endswith(ext) for ext in EXTENSIONS):
|
||||
# Izračunaj relativno pot (npr. tools/axe.png)
|
||||
rel_path = os.path.relpath(root, SOURCE_DIR)
|
||||
|
||||
# Ciljna mapa (ohrani strukturo, npr. blueprints/tools/)
|
||||
if rel_path == ".":
|
||||
target_subdir = DEST_DIR
|
||||
else:
|
||||
target_subdir = os.path.join(DEST_DIR, rel_path)
|
||||
|
||||
if not os.path.exists(target_subdir):
|
||||
os.makedirs(target_subdir)
|
||||
|
||||
source_file = os.path.join(root, file)
|
||||
dest_file = os.path.join(target_subdir, file)
|
||||
|
||||
# Ustvari blueprint če še ne obstaja
|
||||
if not os.path.exists(dest_file):
|
||||
create_blueprint_effect(source_file, dest_file)
|
||||
count += 1
|
||||
else:
|
||||
# Opcija: Preveri timestamp če je original novejši?
|
||||
# Zaenkrat samo preskočimo obstoječe.
|
||||
pass
|
||||
|
||||
print(f"✨ DONE! Created {count} new blueprints.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user