Personnages : toutes les animations, tous les personnages ; retrait de l'import de sprites personnalisés
À la demande de l'utilisateur (validation de la refonte visuelle du widget Personnage), deux ajustements : - Bibliothèque de sprites Forge étendue aux 6 personnages du pack Kenney "Toon Characters" (aventurier/aventurière, personnage homme/femme, robot, zombie), avec TOUTES leurs poses (45 par personnage) plutôt que 3 — regroupées en 31 animations nommées par personnage (poses numérotées type walk0..walk7 fusionnées en un seul cycle "walk", les autres restant des poses figées à une image). ~1,2 Mo au total, toujours un sous-ensemble curé du pack source (assets/characters/, non versionné) — HD/Parts/Tilesheet/Vector toujours exclus. - Import de sprites personnalisés retiré pour le moment : plus de tuile "➕ Sprite personnalisé" dans la galerie d'ajout, plus de section d'import dans les propriétés d'un personnage — seuls les personnages Forge restent proposés. La résolution serveur de _personnage_data garde son support générique de la source "custom" (aucune migration requise si cette possibilité revient plus tard), mais plus aucune UI ne permet de la créer. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@@ -28,11 +28,8 @@ def element_add(slug, screen_id):
|
|||||||
# Posé depuis la galerie "🎭 Personnages" (voir addPersonnageElement()
|
# Posé depuis la galerie "🎭 Personnages" (voir addPersonnageElement()
|
||||||
# dans tree-panels.js) : remplace le personnage Forge par défaut
|
# dans tree-panels.js) : remplace le personnage Forge par défaut
|
||||||
# (male-adventurer, voir default_style_for_widget.py) par celui
|
# (male-adventurer, voir default_style_for_widget.py) par celui
|
||||||
# réellement cliqué, ou bascule sur une source "custom" vide si la
|
# réellement cliqué.
|
||||||
# tuile "➕ Sprite personnalisé" a été choisie.
|
|
||||||
forge_character = request.form.get("forge_character")
|
forge_character = request.form.get("forge_character")
|
||||||
if forge_character == "__custom__":
|
if forge_character and forge_character in screens.SPRITE_LIBRARY:
|
||||||
screens.set_personnage_data(slug, new_id, {"source": "custom", "animations": {}})
|
|
||||||
elif forge_character and forge_character in screens.SPRITE_LIBRARY:
|
|
||||||
screens.set_personnage_data(slug, new_id, {"source": "forge", "forge_character": forge_character})
|
screens.set_personnage_data(slug, new_id, {"source": "forge", "forge_character": forge_character})
|
||||||
return redirect(url_for("screen_edit", slug=slug, screen_id=screen_id, selected=new_id))
|
return redirect(url_for("screen_edit", slug=slug, screen_id=screen_id, selected=new_id))
|
||||||
|
|||||||
@@ -1,28 +1,54 @@
|
|||||||
# ---------- Bibliothèque de sprites bundlée avec Forge (Phase 7) ----------
|
# ---------- Bibliothèque de sprites bundlée avec Forge (Phase 7/8) ----------
|
||||||
#
|
#
|
||||||
# Sous-ensemble curé (idle/marche/saut, pas les packs complets HD/Parts/
|
# Les 6 personnages "Toon Characters" de Kenney (CC0, voir
|
||||||
# Tilesheet/Vector — inutiles pour un jeu 2D web) des personnages "Toon
|
# static/characters/LICENSE-kenney.txt), copiés intégralement (toutes leurs
|
||||||
# Characters" de Kenney (CC0, voir static/characters/LICENSE-kenney.txt),
|
# poses) dans static/characters/<slug>/*.png depuis
|
||||||
# copiés dans static/characters/<slug>/*.png. Un créateur qui veut ses
|
# assets/characters/kenney_toon-characters/ (pack source, non versionné —
|
||||||
# propres sprites n'utilise pas ce catalogue : il uploade ses images (voir
|
# seul ce sous-ensemble copié l'est). Un créateur qui veut ses propres
|
||||||
# routes/uploads/upload_file.py) et colle leurs URLs directement dans la
|
# sprites n'utilise pas ce catalogue — cette possibilité est retirée pour
|
||||||
# même zone de frames — voir #nf-action-sprite-fields dans
|
# le moment (voir historique du plan), seuls ces personnages Forge sont
|
||||||
# screen_edit.html.
|
# disponibles.
|
||||||
|
CHARACTERS = {
|
||||||
|
"male-adventurer": "Aventurier",
|
||||||
|
"female-adventurer": "Aventurière",
|
||||||
|
"male-person": "Personnage (homme)",
|
||||||
|
"female-person": "Personnage (femme)",
|
||||||
|
"robot": "Robot",
|
||||||
|
"zombie": "Zombie",
|
||||||
|
}
|
||||||
|
|
||||||
|
# Regroupement des poses individuelles en animations nommées : les poses
|
||||||
|
# numérotées (ex. walk0..walk7) forment un cycle à plusieurs images, les
|
||||||
|
# autres sont des poses figées à une seule image. Mêmes noms de fichiers
|
||||||
|
# pour les 6 personnages (confirmé sur disque), donc une seule définition
|
||||||
|
# suffit pour tous.
|
||||||
|
_SEQUENCE_ANIMATIONS = {
|
||||||
|
"walk": 8, # cycle de marche
|
||||||
|
"run": 3, # course
|
||||||
|
"attack": 3, # attaque
|
||||||
|
"cheer": 2, # acclamation
|
||||||
|
"climb": 2, # escalade
|
||||||
|
"switch": 2, # bascule/actionner
|
||||||
|
}
|
||||||
|
_SINGLE_POSES = [
|
||||||
|
"idle", "jump", "fall", "duck", "hit", "back", "slide", "interact",
|
||||||
|
"kick", "side", "shove", "shoveBack", "talk", "attackKick", "hang",
|
||||||
|
"hold", "hurt", "behindBack", "down", "drag", "fallDown", "rope",
|
||||||
|
"show", "think", "wide",
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def _animations_for(slug):
|
||||||
|
animations = {
|
||||||
|
name: [f"/static/characters/{slug}/{name}{i}.png" for i in range(count)]
|
||||||
|
for name, count in _SEQUENCE_ANIMATIONS.items()
|
||||||
|
}
|
||||||
|
for name in _SINGLE_POSES:
|
||||||
|
animations[name] = [f"/static/characters/{slug}/{name}.png"]
|
||||||
|
return animations
|
||||||
|
|
||||||
|
|
||||||
SPRITE_LIBRARY = {
|
SPRITE_LIBRARY = {
|
||||||
"male-adventurer": {
|
slug: {"label": label, "animations": _animations_for(slug)}
|
||||||
"label": "Aventurier",
|
for slug, label in CHARACTERS.items()
|
||||||
"animations": {
|
|
||||||
"idle": ["/static/characters/male-adventurer/idle.png"],
|
|
||||||
"marche": [f"/static/characters/male-adventurer/walk{i}.png" for i in range(8)],
|
|
||||||
"saut": ["/static/characters/male-adventurer/jump.png"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
"zombie": {
|
|
||||||
"label": "Zombie",
|
|
||||||
"animations": {
|
|
||||||
"idle": ["/static/characters/zombie/idle.png"],
|
|
||||||
"marche": [f"/static/characters/zombie/walk{i}.png" for i in range(8)],
|
|
||||||
"saut": ["/static/characters/zombie/jump.png"],
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
}
|
||||||
|
|||||||
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.7 KiB |