refactor: Move assets to correct categories (fence→environment, chest→items, campfire already in workstations)
This commit is contained in:
243
scripts/generate_gravity_batch.py
Normal file
243
scripts/generate_gravity_batch.py
Normal file
@@ -0,0 +1,243 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
GRAVITY BATCH GENERATOR - DolinaSmrti Asset Production
|
||||
Uses ONLY Gravity (generate_image) - NO ComfyUI/Ufi
|
||||
Style: Gritty Noir Hand-Drawn 2D Stylized Indie
|
||||
"""
|
||||
|
||||
import os
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
# === CONFIGURATION ===
|
||||
BASE_DIR = Path("/Users/davidkotnik/repos/novafarma")
|
||||
ASSETS_DIR = BASE_DIR / "assets" / "images"
|
||||
|
||||
# === GRITTY NOIR STYLE ===
|
||||
STYLE_PROMPT = """
|
||||
(bold black outlines:1.4), dark hand-drawn stylized indie game asset,
|
||||
(gritty noir aesthetic:1.2), flat colors, muted color palette,
|
||||
exaggerated features, warped perspective, wonky proportions,
|
||||
mature post-apocalyptic vibe, Don't Starve inspired,
|
||||
high contrast noir elements, transparent background PNG
|
||||
"""
|
||||
|
||||
NEGATIVE_PROMPT = """
|
||||
pixel art, pixels, grainy, blurry, 3D rendering, realistic photo,
|
||||
shading gradients, Disney style, cute kawaii, bright colors,
|
||||
background elements, text, watermark
|
||||
"""
|
||||
|
||||
# === ASSET REGISTRY ===
|
||||
# Based on DODATNA_VSEBINA_REGISTRY_V1.14.md
|
||||
|
||||
ASSET_CATEGORIES = {
|
||||
"buildings": [
|
||||
"church_complete", "church_unfinished", "church_ruined",
|
||||
"workshop_complete", "workshop_ruined",
|
||||
"barn_complete", "barn_damaged",
|
||||
"farmhouse_complete", "farmhouse_ruined",
|
||||
"store_complete", "store_damaged",
|
||||
"windmill", "watchtower", "greenhouse",
|
||||
"laboratory", "vape_lab", "furnace_building",
|
||||
"mint_building", "tailoring_shop",
|
||||
],
|
||||
|
||||
"workstations": [
|
||||
"furnace", "campfire", "tailoring_table",
|
||||
"vape_lab_station", "mint_station",
|
||||
"basic_sprinkler", "quality_sprinkler", "iridium_sprinkler",
|
||||
"enchanting_table", "crafting_bench",
|
||||
],
|
||||
|
||||
"items": [
|
||||
# Weapons
|
||||
"wooden_bow", "crystal_bow", "dragon_bow", "alpha_rainbow_bow",
|
||||
"fire_arrow", "ice_arrow", "lightning_arrow", "bomb_arrow",
|
||||
"poison_arrow", "holy_arrow", "silver_arrow",
|
||||
|
||||
# Tools
|
||||
"wooden_axe", "iron_axe", "gold_axe", "diamond_axe",
|
||||
"wooden_pickaxe", "iron_pickaxe", "gold_pickaxe", "diamond_pickaxe",
|
||||
"wooden_hoe", "iron_hoe", "gold_hoe",
|
||||
"watering_can", "fishing_rod",
|
||||
|
||||
# Resources
|
||||
"iron_ore", "gold_ore", "silver_ore", "diamond",
|
||||
"iron_bar", "gold_bar", "silver_bar",
|
||||
"wood_log", "stone", "coal",
|
||||
"hemp_fiber", "leather", "spider_silk",
|
||||
|
||||
# Food
|
||||
"bread", "cheese", "milk", "beef",
|
||||
"chicken_egg", "truffle", "ham",
|
||||
|
||||
# Magic
|
||||
"slime_gel_green", "slime_gel_blue", "slime_gel_red",
|
||||
"rainbow_vape_liquid", "menthol_vape_liquid",
|
||||
"magic_mushroom",
|
||||
],
|
||||
|
||||
"zivali": [ # Animals
|
||||
# Livestock
|
||||
"sheep_normal", "sheep_fire", "sheep_golden_fleece",
|
||||
"cow_normal", "cow_mutant",
|
||||
"chicken_normal", "chicken_three_headed",
|
||||
"pig_normal", "pig_giant",
|
||||
"horse_normal", "horse_undead",
|
||||
|
||||
# Wildlife
|
||||
"fox", "deer", "rabbit", "hedgehog",
|
||||
"bear", "wolf", "wild_boar",
|
||||
"owl", "bat",
|
||||
|
||||
# Marine
|
||||
"fish_bass", "fish_trout", "fish_salmon", "fish_tuna", "fish_piranha",
|
||||
"golden_fish", "sea_dragon", "loch_ness_monster",
|
||||
"shark", "jellyfish",
|
||||
|
||||
# Dogs
|
||||
"dog_retriever", "dog_shepherd", "dog_husky", "dog_corgi", "dog_dalmatian",
|
||||
"dachshund_susi",
|
||||
|
||||
# Slimes
|
||||
"slime_green", "slime_blue", "slime_red", "slime_yellow",
|
||||
"slime_purple", "slime_black", "slime_rainbow",
|
||||
],
|
||||
|
||||
"mutanti": [
|
||||
"zombie_brown_dreads", "zombie_bald", "zombie_pink_dreads",
|
||||
"zombie_portrait_closeup",
|
||||
"werewolf_normal", "werewolf_transformed",
|
||||
"skeleton_warrior", "ghost",
|
||||
"mutant_monkey", "mutant_beast",
|
||||
"griffin", "pterodactyl", "hippogriff",
|
||||
"bigfoot", "yeti",
|
||||
],
|
||||
|
||||
"bosses": [
|
||||
"mutant_king", "zombie_horde_leader", "ancient_tree",
|
||||
"giant_troll_king", "ice_titan", "fire_dragon",
|
||||
"king_slime",
|
||||
],
|
||||
|
||||
"environment": [
|
||||
# Crops
|
||||
"wheat_planted", "wheat_growing", "wheat_harvest",
|
||||
"corn_planted", "corn_growing", "corn_harvest",
|
||||
"tomato_planted", "tomato_growing", "tomato_harvest",
|
||||
|
||||
# Trees
|
||||
"cherry_blossom_tree", "oak_tree", "pine_tree",
|
||||
"dead_tree", "burned_tree",
|
||||
|
||||
# Decorations
|
||||
"grave_stone", "grave_cross", "grave_angel",
|
||||
"rock_small", "rock_large", "boulder",
|
||||
"bush_green", "bush_dead",
|
||||
|
||||
# Special
|
||||
"carnivorous_plant_seedling", "carnivorous_plant_giant",
|
||||
"portal_normal", "portal_activated",
|
||||
],
|
||||
|
||||
"ui": [
|
||||
"health_bar", "stamina_bar", "mana_bar",
|
||||
"inventory_slot", "inventory_slot_selected",
|
||||
"coin_icon", "heart_icon", "star_icon",
|
||||
"button_play", "button_pause", "button_settings",
|
||||
],
|
||||
}
|
||||
|
||||
|
||||
def generate_prompt(category: str, asset_name: str) -> str:
|
||||
"""Generate full prompt for Gravity image generation"""
|
||||
|
||||
# Clean asset name for description
|
||||
clean_name = asset_name.replace("_", " ")
|
||||
|
||||
# Category-specific additions
|
||||
category_context = {
|
||||
"buildings": "game building asset, isometric view, architectural structure",
|
||||
"workstations": "crafting station, work table, game object",
|
||||
"items": "game item icon, inventory object, collectible",
|
||||
"zivali": "animal character, creature sprite, wildlife",
|
||||
"mutanti": "mutant creature, zombie character, monster enemy",
|
||||
"bosses": "boss enemy, large creature, intimidating monster",
|
||||
"environment": "environment object, natural element, decoration",
|
||||
"ui": "UI element, game interface icon, HUD component",
|
||||
}
|
||||
|
||||
context = category_context.get(category, "game asset")
|
||||
|
||||
full_prompt = f"""
|
||||
{clean_name}, {context}, {STYLE_PROMPT}
|
||||
""".strip()
|
||||
|
||||
return full_prompt
|
||||
|
||||
|
||||
def main():
|
||||
"""Main batch generation loop"""
|
||||
|
||||
print("=" * 60)
|
||||
print("🎨 GRAVITY BATCH GENERATOR - DolinaSmrti")
|
||||
print("=" * 60)
|
||||
print(f"Style: Gritty Noir Hand-Drawn 2D Stylized Indie")
|
||||
print(f"Output: {ASSETS_DIR}")
|
||||
print("=" * 60)
|
||||
|
||||
total_assets = sum(len(assets) for assets in ASSET_CATEGORIES.values())
|
||||
print(f"\n📊 Total assets to generate: {total_assets}")
|
||||
|
||||
generated_count = 0
|
||||
|
||||
for category, assets in ASSET_CATEGORIES.items():
|
||||
print(f"\n{'='*60}")
|
||||
print(f"📁 Category: {category.upper()} ({len(assets)} assets)")
|
||||
print(f"{'='*60}")
|
||||
|
||||
# Create category directory
|
||||
category_dir = ASSETS_DIR / category
|
||||
category_dir.mkdir(parents=True, exist_ok=True)
|
||||
|
||||
for i, asset_name in enumerate(assets, 1):
|
||||
output_path = category_dir / f"{asset_name}.png"
|
||||
|
||||
# Skip if already exists
|
||||
if output_path.exists():
|
||||
print(f" ⏭️ [{i}/{len(assets)}] SKIP: {asset_name} (already exists)")
|
||||
generated_count += 1
|
||||
continue
|
||||
|
||||
# Generate prompt
|
||||
prompt = generate_prompt(category, asset_name)
|
||||
|
||||
print(f"\n 🎨 [{i}/{len(assets)}] Generating: {asset_name}")
|
||||
print(f" Prompt: {prompt[:80]}...")
|
||||
|
||||
# === THIS IS WHERE GRAVITY INTEGRATION HAPPENS ===
|
||||
# In actual usage, Antigravity will call generate_image here
|
||||
# For now, this is a placeholder that will be replaced
|
||||
|
||||
print(f" ⚠️ PLACEHOLDER: Call generate_image('{prompt}', '{asset_name}')")
|
||||
print(f" 💾 Save to: {output_path}")
|
||||
|
||||
generated_count += 1
|
||||
|
||||
# Progress update
|
||||
progress = (generated_count / total_assets) * 100
|
||||
print(f"\n 📊 Overall Progress: {generated_count}/{total_assets} ({progress:.1f}%)")
|
||||
|
||||
# Respectful delay (avoid API hammering)
|
||||
time.sleep(2)
|
||||
|
||||
print("\n" + "=" * 60)
|
||||
print("✅ GENERATION COMPLETE!")
|
||||
print("=" * 60)
|
||||
print(f"Total generated: {generated_count}/{total_assets}")
|
||||
print(f"Output directory: {ASSETS_DIR}")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user