🚀 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:
76
scripts/flatten_references.py
Normal file
76
scripts/flatten_references.py
Normal file
@@ -0,0 +1,76 @@
|
||||
import os
|
||||
import shutil
|
||||
|
||||
ROOT_DIR = os.path.abspath("assets/slike/glavna_referenca")
|
||||
|
||||
def flatten_folder():
|
||||
if not os.path.exists(ROOT_DIR):
|
||||
print("❌ Folder not found!")
|
||||
return
|
||||
|
||||
print(f"🚜 Flattening {ROOT_DIR}...")
|
||||
|
||||
moved_count = 0
|
||||
|
||||
# Walk bottom-up to handle subdirs
|
||||
for root, dirs, files in os.walk(ROOT_DIR, topdown=False):
|
||||
if root == ROOT_DIR:
|
||||
continue # Skip root folder itself
|
||||
|
||||
for file in files:
|
||||
if file.startswith("."): continue
|
||||
|
||||
src_path = os.path.join(root, file)
|
||||
dest_path = os.path.join(ROOT_DIR, file)
|
||||
|
||||
# Handle duplicate names
|
||||
if os.path.exists(dest_path):
|
||||
base, ext = os.path.splitext(file)
|
||||
counter = 1
|
||||
while os.path.exists(os.path.join(ROOT_DIR, f"{base}_{counter}{ext}")):
|
||||
counter += 1
|
||||
dest_path = os.path.join(ROOT_DIR, f"{base}_{counter}{ext}")
|
||||
|
||||
try:
|
||||
shutil.move(src_path, dest_path)
|
||||
moved_count += 1
|
||||
except Exception as e:
|
||||
print(f"❌ Error moving {file}: {e}")
|
||||
|
||||
# Remove empty dir
|
||||
try:
|
||||
if not os.listdir(root):
|
||||
os.rmdir(root)
|
||||
# print(f"🗑️ Removed empty dir: {root}")
|
||||
except:
|
||||
pass
|
||||
|
||||
print(f"✨ DONE! Moved {moved_count} images to root.")
|
||||
|
||||
# 2. Add New Animals (Steampunk + Dark Chibi)
|
||||
print("🎨 Importing generated animals...")
|
||||
EXT_SRCS = [
|
||||
"assets/slike/animals/generated_steampunk",
|
||||
"assets/slike/animals/generated_dark_chibi" # If exists
|
||||
]
|
||||
|
||||
imported = 0
|
||||
for ext_src in EXT_SRCS:
|
||||
if os.path.exists(ext_src):
|
||||
for file in os.listdir(ext_src):
|
||||
if file.startswith("."): continue
|
||||
|
||||
src = os.path.join(ext_src, file)
|
||||
dest = os.path.join(ROOT_DIR, file)
|
||||
|
||||
if os.path.exists(dest):
|
||||
base, ext = os.path.splitext(file)
|
||||
dest = os.path.join(ROOT_DIR, f"{base}_NEW{ext}")
|
||||
|
||||
shutil.copy(src, dest)
|
||||
imported += 1
|
||||
|
||||
print(f"✅ Imported {imported} new animals.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
flatten_folder()
|
||||
Reference in New Issue
Block a user