Enrichit les declencheurs/actions de scene (clic/survol/affichage, surbrillance/video/son/visibilite/indication/attendre) et fiabilise la pose d'un fond/decor importe
- Ajoute clic/survol/affichage-ecran comme declencheurs, et surbrillance, video, son, visibilite, indication, attendre comme actions, utilisables aussi bien par l'editeur manuel (menu lateral Objets/Ecran) que par Ruby (IA), avec blocs deplacables/supprimables dans une chaine. - Corrige plusieurs variantes du bug "impossible de poser un objet hors du champ de la camera" (troncature du chainage d'actions a 4 maillons, fond importe pose a 128x128 au lieu de sa taille reelle, decalage du fond au vrai glisser-depose, redimensionnement manuel jamais propage au monde). - Ajoute un vrai glisser-depose depuis la galerie vers la scene, la gestion complete de "Mes assets" (sous-sections Fonds/Decors/Sons/ Videos, suppression, reclassement fond<->decor sans re-upload). - Ajoute l'upload de son (limite 3 min) et de video (MP4 uniquement, limite 5 min), avec validation de la duree reelle du fichier, et une replique audio optionnelle dans une bulle de dialogue. - Fixe la taille de pose d'un objet/decor importe a 200x200 avec une boite de collision de 150x150. - Filtre le selecteur de fichier des actions son/video par type reel. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 5
parent
b07b231a61
commit
559331f9cf
@@ -40,6 +40,33 @@ def test_add_decor_scene_object(tmp_game_slug_cleanup):
|
||||
assert obj["kind"] == "decor"
|
||||
|
||||
|
||||
def test_add_decor_scene_object_with_an_image_defaults_to_200x200_with_a_150x150_collision_box(tmp_game_slug_cleanup):
|
||||
"""Demande explicite : un objet/décor posé depuis "Mes assets" doit
|
||||
toujours démarrer à 200×200 (jamais la taille réelle, souvent bien
|
||||
plus grande, ni le défaut 128×128 du schéma), avec une boîte de
|
||||
collision plus petite (150×150, centrée) pour rester proche de la
|
||||
silhouette réelle."""
|
||||
slug, screen_id = _create_jeu2d_game(tmp_game_slug_cleanup)
|
||||
obj_id = screens.add_scene_object(slug, screen_id, kind="decor", image_url="/assets/1/photo.png")
|
||||
obj = screens.get_scene_object(slug, obj_id)
|
||||
assert (obj["width"], obj["height"]) == (200, 200)
|
||||
collision = screens.resolve_collision_settings(obj)
|
||||
assert (collision["width"], collision["height"]) == (150, 150)
|
||||
|
||||
|
||||
def test_add_decor_scene_object_with_an_image_ignores_real_image_dimensions(tmp_game_slug_cleanup):
|
||||
"""Contrairement à "fond" (voir add_scene_object.py), un "decor" ne
|
||||
doit JAMAIS être posé à la taille réelle de l'image importée — même
|
||||
quand elle est connue (image_width/image_height fournis)."""
|
||||
slug, screen_id = _create_jeu2d_game(tmp_game_slug_cleanup)
|
||||
obj_id = screens.add_scene_object(
|
||||
slug, screen_id, kind="decor", image_url="/assets/1/photo.png",
|
||||
image_width=5504, image_height=3072,
|
||||
)
|
||||
obj = screens.get_scene_object(slug, obj_id)
|
||||
assert (obj["width"], obj["height"]) == (200, 200)
|
||||
|
||||
|
||||
def test_scene_object_geometry_is_pixels_not_percent(tmp_game_slug_cleanup):
|
||||
slug, screen_id = _create_jeu2d_game(tmp_game_slug_cleanup)
|
||||
obj_id = screens.add_scene_object(slug, screen_id)
|
||||
@@ -108,6 +135,44 @@ def test_render_scene_object_fond_alt_is_always_empty_rgaa(tmp_game_slug_cleanup
|
||||
assert 'alt=""' in html
|
||||
|
||||
|
||||
def test_add_scene_object_with_explicit_position_uses_it_instead_of_the_default(tmp_game_slug_cleanup):
|
||||
"""Vrai glisser-déposer depuis la galerie (demande explicite :
|
||||
"n'importe où sur la scène") — x/y explicites remplacent le défaut
|
||||
100/100 posé par le schéma (voir ensure_scene_schema.py)."""
|
||||
slug, screen_id = _create_jeu2d_game(tmp_game_slug_cleanup)
|
||||
obj_id = screens.add_scene_object(slug, screen_id, kind="decor", x=250, y=340)
|
||||
obj = screens.get_scene_object(slug, obj_id)
|
||||
assert obj["x"] == 250
|
||||
assert obj["y"] == 340
|
||||
|
||||
|
||||
def test_add_scene_object_without_position_still_defaults_to_100_100(tmp_game_slug_cleanup):
|
||||
slug, screen_id = _create_jeu2d_game(tmp_game_slug_cleanup)
|
||||
obj_id = screens.add_scene_object(slug, screen_id, kind="decor")
|
||||
obj = screens.get_scene_object(slug, obj_id)
|
||||
assert obj["x"] == 100
|
||||
assert obj["y"] == 100
|
||||
|
||||
|
||||
def test_add_scene_object_fond_with_explicit_position_overrides_the_top_left_default(tmp_game_slug_cleanup):
|
||||
"""Un "fond" reste au coin haut-gauche (0,0) SANS position explicite
|
||||
(comportement inchangé), mais un glisser-déposer précis doit pouvoir
|
||||
le positionner ailleurs si le créateur le demande explicitement."""
|
||||
slug, screen_id = _create_jeu2d_game(tmp_game_slug_cleanup)
|
||||
obj_id = screens.add_scene_object(slug, screen_id, kind="fond", background_slug="foret", x=50, y=60)
|
||||
obj = screens.get_scene_object(slug, obj_id)
|
||||
assert obj["x"] == 50
|
||||
assert obj["y"] == 60
|
||||
|
||||
|
||||
def test_add_scene_object_fond_without_position_still_defaults_to_top_left(tmp_game_slug_cleanup):
|
||||
slug, screen_id = _create_jeu2d_game(tmp_game_slug_cleanup)
|
||||
obj_id = screens.add_scene_object(slug, screen_id, kind="fond", background_slug="foret")
|
||||
obj = screens.get_scene_object(slug, obj_id)
|
||||
assert obj["x"] == 0
|
||||
assert obj["y"] == 0
|
||||
|
||||
|
||||
def test_delete_scene_object_cleans_up_referencing_flow_nodes(tmp_game_slug_cleanup):
|
||||
slug, screen_id = _create_jeu2d_game(tmp_game_slug_cleanup)
|
||||
obj_id = screens.add_scene_object(slug, screen_id)
|
||||
|
||||
Reference in New Issue
Block a user