feat: Element-Standzeit und rotierender Pirouetten-Dot
- PathSegment.element_duration_seconds (0-120 s) fuer Punktmarker - Typ-Defaults: Sprung 0,7 s, Pirouette 8 s, im Inspector uebersteuerbar - Section- und Routine-Dauer sowie Timeline enthalten die Standzeiten - Playback haelt am Marker; Pirouette dreht den Dot mit 1,5 U/s - Tests: 599 Assertions gruen; Doku aktualisiert
This commit is contained in:
parent
5968272691
commit
6eca94e6db
11 changed files with 359 additions and 37 deletions
|
|
@ -72,7 +72,8 @@ Ein Segment mit Länge braucht eine positive Dauer. Ein reiner Element-Marker
|
|||
(Länge 0, z. B. Sprungpunkt) darf Dauer 0 haben und wird über `is_marker()`
|
||||
erkannt. Seit der Element-Marker-Session trägt das Segment zusätzlich
|
||||
`element_type` (Sprung, Pirouette, Sequenz), `element_code` (Kürzel, max.
|
||||
24 Zeichen) und `element_level` (0 = Base, 1–4). Ein Punktmarker ist ein
|
||||
24 Zeichen), `element_level` (0 = Base, 1–4) und `element_duration_seconds`
|
||||
(Standzeit, nur Punktmarker). Ein Punktmarker ist ein
|
||||
Segment mit einer Ein-Punkt-Kurve, `is_element_marker()` ist wahr. Eine
|
||||
Sequenz als Bereich bleibt ein normales Segment mit Länge und wird nur
|
||||
getaggt; `element_id` bleibt für die spätere Regelwerk-Referenz reserviert.
|
||||
|
|
@ -136,7 +137,9 @@ eine Abkürzung. So kann die UI Fehler konkret anzeigen.
|
|||
„Element“ öffnet den Inspector für Typ, Kürzel und Level. Im
|
||||
Auswahlmodus lässt sich der Marker über seinen Griff verschieben. Sequenz-
|
||||
Bereiche entstehen, indem ein gezeichnetes Segment über den Inspector
|
||||
getaggt wird. Marker zählen nicht zur Playback-Zeit. Die Timing-Details
|
||||
getaggt wird. Punktmarker haben eine **Standzeit** (`element_duration_seconds`)
|
||||
mit Typ-Defaults (Sprung 0,7 s, Pirouette 8 s, Sequenz 0 s), die im
|
||||
Inspector übersteuert wird und in die Timeline eingeht. Die Timing-Details
|
||||
(Dauer/Tempo/Profil) werden beim Setzen und für Punktmarker ausgeblendet,
|
||||
damit die Leiste auch im Landscape kompakt bleibt.
|
||||
- **Section-Verwaltung:** Ein Panel rechts zeigt die chronologische
|
||||
|
|
@ -158,10 +161,13 @@ eine Abkürzung. So kann die UI Fehler konkret anzeigen.
|
|||
kontinuierlich per Bogenlängen-Sampling (`sample_baked()`). Die Blickrichtung
|
||||
folgt der Kurventangente; bei Rückwärts-Segmenten wird sie um 180° gedreht,
|
||||
sodass die Bewegung entlang des Pfades und die Körperrichtung getrennt
|
||||
sichtbar sind. Während des Playbacks wird die aktuelle Section hervorgehoben,
|
||||
sichtbar sind. Punktmarker halten die Ankunftsrichtung, Pirouetten drehen
|
||||
den Marker während der Standzeit mit 1,5 Umdrehungen pro Sekunde. Während
|
||||
des Playbacks wird die aktuelle Section hervorgehoben,
|
||||
ohne die Bearbeitungs-Section zu wechseln. Steuerung: Play/Pause, Reset,
|
||||
Timeline-Scrubbing und Geschwindigkeit 0,25×–2,0×. Die Dauer kommt aus dem
|
||||
Segment-Timing (Default Adult Gold, 4,3 m/s). Nicht verbundene Segmente
|
||||
Segment-Timing (Default Adult Gold, 4,3 m/s) bzw. bei Punktmarkern aus der
|
||||
Element-Standzeit. Nicht verbundene Segmente
|
||||
führen zu einem Sprung des Markers an den Start des nächsten Segments.
|
||||
- **Geschwindigkeitsannahmen:** Die belastbaren Referenzwerte, Level-Profile
|
||||
und Kalibrierung stehen in `docs/speed-assumptions.md`.
|
||||
|
|
@ -280,24 +286,25 @@ Headless, ohne Editor und ohne Display:
|
|||
|
||||
Aktueller Stand:
|
||||
|
||||
- **Model:** 74 Assertions für Rink-Geometrie, Clamping, Segment-Timing,
|
||||
Timing-Modi, Template-Metadaten, Element-Marker samt Kürzel-/Level-Grenzen,
|
||||
- **Model:** 81 Assertions für Rink-Geometrie, Clamping, Segment-Timing,
|
||||
Timing-Modi, Template-Metadaten, Element-Marker samt Kürzel-/Level-/Dauer-Grenzen,
|
||||
Schema-Version, Section-Aggregation und Routine-Validierung.
|
||||
- **Canvas:** 90 Assertions für Meter→Pixel-Mapping, Fit/Zoom/Pan,
|
||||
Rink-Kontur und die reine Bogen-Geometrie.
|
||||
- **Whiteboard:** 193 Assertions für Controller-Verdrahtung, Segmenterzeugung,
|
||||
- **Whiteboard:** 201 Assertions für Controller-Verdrahtung, Segmenterzeugung,
|
||||
Linien-/Bogenpfade, Klemmen an der Bande, Auswahl, Griff- und
|
||||
Richtungs-/Kanten-Bearbeitung, Segmentlöschung, Element-Marker (Setzen,
|
||||
Typwechsel, Inspector, Verschieben, Löschen), Section-Verwaltung,
|
||||
Typwechsel, Inspector inkl. Standzeit, Verschieben, Löschen), Section-Verwaltung,
|
||||
Ghosting-Zustand, Segment-Labels inklusive Dialog und Sichtbarkeits-Schalter,
|
||||
Speichern/Laden, Schema-Prüfung, Dirty-State,
|
||||
Navigationsmodus und den Maus-Drag-Pfad.
|
||||
- **History:** 53 Assertions für Undo/Redo von Segmenten, Kanten, Labels, Sections,
|
||||
Zeichengesten und Griff-Bearbeitung, Toolbar-Buttons, Erhalt der Ansicht
|
||||
sowie das Zurücksetzen der Historie.
|
||||
- **Playback:** 38 Assertions für Dauer/Timeline, Vorwärts-/Rückwärts-
|
||||
- **Playback:** 45 Assertions für Dauer/Timeline, Vorwärts-/Rückwärts-
|
||||
Blickrichtung, Section-Hervorhebung, Play/Pause/Reset inklusive
|
||||
Button-Verdrahtung, Scrubbing und Geschwindigkeitswechsel.
|
||||
Button-Verdrahtung, Scrubbing, Geschwindigkeitswechsel, Standzeiten von
|
||||
Elementen und die Rotation des Markers in einer Pirouette.
|
||||
- **Timing:** 41 Assertions für Dauer-/Tempo-Kopplung, Level-Presets,
|
||||
Kalibrierung, Undo, Persistenz und Schema-1-Migration.
|
||||
- **Export:** 26 Assertions für SVG-Struktur, Titel-Escaping, Segment-Labels,
|
||||
|
|
|
|||
|
|
@ -9,12 +9,12 @@ Bedienung und des Exports.
|
|||
|
||||
| Ziel | Ergebnis |
|
||||
| :--- | :--- |
|
||||
| Marker-Modell | `element_type`, `element_code`, `element_level` am Segment |
|
||||
| Marker-Modell | `element_type`, `element_code`, `element_level`, `element_duration_seconds` |
|
||||
| Platzieren | Werkzeug „Element“, ein Tipp setzt einen Punktmarker |
|
||||
| Bearbeiten | Inspector (Typ, Kürzel, Level), Verschieben per Griff |
|
||||
| Darstellung | Typform + Kürzel auf Canvas, Ghosting und Präsentation |
|
||||
| Export | SVG-Gruppe `element-marker`, PNG über die Export-Szene |
|
||||
| Tests | 577 Assertions, `./tools/test.sh` grün |
|
||||
| Tests | 599 Assertions, `./tools/test.sh` grün |
|
||||
|
||||
## Modellentscheidung
|
||||
|
||||
|
|
@ -27,6 +27,9 @@ bestehende Entscheidung D3, erweitert:
|
|||
- `element_type`: `NONE`, `JUMP`, `SPIN`, `SEQUENCE`.
|
||||
- `element_code`: Freitext-Kürzel, getrimmt, max. 24 Zeichen.
|
||||
- `element_level`: 0 = Base, 1–4; nur für Pirouetten und Sequenzen im Kürzel.
|
||||
- `element_duration_seconds`: Standzeit eines Punktmarkers (0–120 s). Sie ist
|
||||
unabhängig von der Geometrie und geht als Timeline-Zeit ein. Sequenzbereiche
|
||||
nutzen weiterhin `duration_seconds` des Pfades.
|
||||
- `element_id` bleibt unangetastet und ist für die spätere Referenz auf den
|
||||
ISU-Elementkatalog reserviert.
|
||||
- Eine **Sequenz als Bereich** ist kein Punktmarker, sondern ein normales
|
||||
|
|
@ -63,7 +66,14 @@ Elementtyp sind Fehler. `set_element()` trimmt, kürzt und klemmt die Werte;
|
|||
- Sequenzbereiche zeigen ihr Kürzel wie ein Label am Segmentmittelpunkt, wenn
|
||||
kein Freitext-Label gesetzt ist.
|
||||
- Ghost-Sections zeichnen Marker mit 20 % Deckkraft, aber ohne Kürzel.
|
||||
- Marker erzeugen keine Playback-Zeit; die Timeline ignoriert Dauer 0 bereits.
|
||||
- Punktmarker haben eine **Standzeit**: Sprung 0,7 s, Pirouette 8 s, Sequenz 0 s
|
||||
als Default. Sie wird beim Platzieren gesetzt, im Inspector übersteuert und
|
||||
bei einem Typwechsel auf den Typ-Default zurückgesetzt.
|
||||
- In der Timeline hält der Punkt während der Standzeit an. Bei einer Pirouette
|
||||
dreht sich die Blickrichtung mit 1,5 Umdrehungen pro Sekunde; Sprünge und
|
||||
Sequenzpunkte behalten die Ankunftsrichtung des vorherigen Pfades.
|
||||
- `Routine`/`Section` summieren die effektive Dauer, damit Programmdauer,
|
||||
Statusleiste und Export die Standzeiten enthalten.
|
||||
|
||||
## Export
|
||||
|
||||
|
|
@ -78,14 +88,18 @@ Elementtyp sind Fehler. `set_element()` trimmt, kürzt und klemmt die Werte;
|
|||
|
||||
Neu bzw. erweitert:
|
||||
|
||||
- **Model (74):** Punktmarker, Typen, Kürzel-Trimmen/-Kürzen, Level-Klemmen,
|
||||
Caption-Bildung, Tag-löschen, Kürzel ohne Typ als Fehler.
|
||||
- **Whiteboard (193):** Setzen per Maus, Typwechsel, Inspector-Dialog,
|
||||
Griff-Drag, Undo/Redo, Löschen über „Kein Element“, Tagging und Entfernen
|
||||
von Sequenzbereichen, Persistenz der Elementfelder, Marker zählen nicht zur
|
||||
Playback-Zeit.
|
||||
- **Model (81):** Punktmarker, Typen, Kürzel-Trimmen/-Kürzen, Level-Klemmen,
|
||||
Standzeit-Klemmen und -Grenzen, effektive Dauer, Caption-Bildung,
|
||||
Tag-löschen, Kürzel ohne Typ als Fehler.
|
||||
- **Whiteboard (201):** Setzen per Maus, Typwechsel, Inspector-Dialog inkl.
|
||||
Standzeit, Griff-Drag, Undo/Redo, Löschen über „Kein Element“, Tagging und
|
||||
Entfernen von Sequenzbereichen, Persistenz der Elementfelder, Standzeit in
|
||||
der Programmdauer.
|
||||
- **Playback (45):** Standzeit im Timeline-Verlauf, Halten am Sprung-Marker und
|
||||
Rotation des Dots in der Pirouette.
|
||||
- **Export (26):** Marker-Gruppen, Kürzel mit Level, Form, Abschnittsfilter.
|
||||
- **Touch (28):** Ein Tipp setzt einen Marker und selektiert ihn.
|
||||
- **Touch (28):** Ein Tipp setzt einen Marker und selektiert ihn, ein Tipp auf
|
||||
den Marker wählt ihn ohne Undo-Eintrag aus.
|
||||
|
||||
Visuell geprüft über `tests/manual/capture_elements.gd` (normal, `dialog`,
|
||||
`place`) bei 1024 × 768, 1317 × 824 und 1400 × 876 sowie im PNG-Export.
|
||||
|
|
@ -101,3 +115,6 @@ Visuell geprüft über `tests/manual/capture_elements.gd` (normal, `dialog`,
|
|||
Kürzel-Pillen. Eine Kollisionsvermeidung ist bewusst offen.
|
||||
4. **Level bei Sprüngen:** Das Modell erlaubt Level 0–4 für alle Typen; die
|
||||
Caption zeigt Level nur bei Pirouetten und Sequenzen.
|
||||
5. **Standzeit-Defaults:** 0,7 s bzw. 8 s sind plausible Startwerte, aber
|
||||
nicht regelbasiert. Mit dem ISU-Katalog können sie aus Element und Level
|
||||
abgeleitet werden; die Rotationsrate (1,5 U/s) ist ebenfalls eine Annahme.
|
||||
|
|
|
|||
|
|
@ -102,6 +102,8 @@ Voraussetzung für Phase 1.
|
|||
- [x] Entscheidung: Marker als Segment mit Ein-Punkt-Kurve und
|
||||
`element_type`/`element_code`/`element_level` (D3), Sequenzbereiche als
|
||||
getaggte Segmente
|
||||
- [x] Standzeit je Typ (Sprung 0,7 s, Pirouette 8 s) mit Inspector-Override
|
||||
- [x] Pirouetten-Dot rotiert während der Standzeit
|
||||
- [x] Tests für Marker-Modell, Interaktion und Export erweitern
|
||||
- [ ] Optional: Elementkatalog mit Kürzelvorschlägen (Teil des ISU-Regelwerks)
|
||||
|
||||
|
|
|
|||
|
|
@ -565,7 +565,7 @@ caret_blink = true
|
|||
[node name="ElementDialog" type="ConfirmationDialog" parent="."]
|
||||
unique_name_in_owner = true
|
||||
title = "Element"
|
||||
size = Vector2i(520, 360)
|
||||
size = Vector2i(520, 420)
|
||||
ok_button_text = "Übernehmen"
|
||||
cancel_button_text = "Abbrechen"
|
||||
|
||||
|
|
@ -573,7 +573,7 @@ cancel_button_text = "Abbrechen"
|
|||
offset_left = 12.0
|
||||
offset_top = 12.0
|
||||
offset_right = 508.0
|
||||
offset_bottom = 280.0
|
||||
offset_bottom = 350.0
|
||||
theme_override_constants/separation = 8
|
||||
|
||||
[node name="ElementTypeLabel" type="Label" parent="ElementDialog/ElementBox"]
|
||||
|
|
@ -615,6 +615,21 @@ custom_minimum_size = Vector2(0, 56)
|
|||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 17
|
||||
|
||||
[node name="ElementDurationLabel" type="Label" parent="ElementDialog/ElementBox"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.580392, 0.639216, 0.721569, 1)
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Standzeit in Sekunden (nur Punktmarker)"
|
||||
|
||||
[node name="ElementDurationSpin" type="SpinBox" parent="ElementDialog/ElementBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 17
|
||||
max_value = 120.0
|
||||
step = 0.1
|
||||
suffix = " s"
|
||||
|
||||
[node name="ElementHint" type="Label" parent="ElementDialog/ElementBox"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.580392, 0.639216, 0.721569, 1)
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ enum ElementType {
|
|||
|
||||
const ELEMENT_CODE_MAX_LENGTH := 24
|
||||
const ELEMENT_MAX_LEVEL := 4
|
||||
const ELEMENT_MAX_DURATION_SECONDS := 120.0
|
||||
|
||||
@export var segment_id: String = ""
|
||||
@export var curve: Curve2D
|
||||
|
|
@ -52,6 +53,9 @@ const ELEMENT_MAX_LEVEL := 4
|
|||
## ISU level: 0 is "Base", 1–4 are the graded levels. Only used by spins and
|
||||
## sequences; jumps keep 0.
|
||||
@export var element_level: int = 0
|
||||
## Stand time of a point marker in seconds (jump air time, spin rotation). It is
|
||||
## independent of the geometry; ranges use [member duration_seconds] instead.
|
||||
@export var element_duration_seconds: float = 0.0
|
||||
@export var label: String = ""
|
||||
|
||||
## Geometry metadata. Start and end are always the first and last curve points;
|
||||
|
|
@ -151,6 +155,24 @@ func get_element_caption() -> String:
|
|||
return code
|
||||
|
||||
|
||||
## Clamps the stand time of a point marker. Ranges derive their time from the
|
||||
## segment duration and keep this value at 0.
|
||||
func set_element_duration(seconds: float) -> void:
|
||||
element_duration_seconds = clampf(
|
||||
seconds,
|
||||
0.0,
|
||||
ELEMENT_MAX_DURATION_SECONDS
|
||||
)
|
||||
|
||||
|
||||
## Time this segment occupies on the timeline. Point markers use their element
|
||||
## stand time, everything else the segment duration.
|
||||
func get_effective_duration_seconds() -> float:
|
||||
if is_element_marker():
|
||||
return element_duration_seconds
|
||||
return duration_seconds
|
||||
|
||||
|
||||
func is_arc() -> bool:
|
||||
return template == Template.ARC
|
||||
|
||||
|
|
@ -178,6 +200,14 @@ func validate() -> PackedStringArray:
|
|||
)
|
||||
if element_type == ElementType.NONE and not element_code.strip_edges().is_empty():
|
||||
errors.append("element_code needs an element_type")
|
||||
if (
|
||||
element_duration_seconds < 0.0
|
||||
or element_duration_seconds > ELEMENT_MAX_DURATION_SECONDS
|
||||
):
|
||||
errors.append(
|
||||
"element_duration_seconds must be between 0 and %d"
|
||||
% int(ELEMENT_MAX_DURATION_SECONDS)
|
||||
)
|
||||
if template == Template.ARC:
|
||||
if arc_depth_ratio <= 0.0 or arc_depth_ratio >= 0.5:
|
||||
errors.append("arc_depth_ratio must be between 0 and 0.5")
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@ func get_duration_seconds() -> float:
|
|||
var total := 0.0
|
||||
for segment: PathSegment in segments:
|
||||
if segment != null:
|
||||
total += segment.duration_seconds
|
||||
total += segment.get_effective_duration_seconds()
|
||||
return total
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -32,6 +32,12 @@ const DURATION_STEP_SECONDS := 0.1
|
|||
const MIN_DURATION_SECONDS := 0.1
|
||||
const MAX_DURATION_SECONDS := 120.0
|
||||
const DEFAULT_PROFILE_INDEX := 2
|
||||
const SPIN_REVOLUTIONS_PER_SECOND := 1.5
|
||||
const ELEMENT_DEFAULT_DURATIONS := {
|
||||
PathSegment.ElementType.JUMP: 0.7,
|
||||
PathSegment.ElementType.SPIN: 8.0,
|
||||
PathSegment.ElementType.SEQUENCE: 0.0,
|
||||
}
|
||||
const PROFILE_NAMES := [
|
||||
"Adult Bronze",
|
||||
"Adult Silver",
|
||||
|
|
@ -103,6 +109,7 @@ const COMPACT_LAYOUT_WIDTH := 1280.0
|
|||
@onready var element_dialog_type_option: OptionButton = %ElementDialogTypeOption
|
||||
@onready var element_code_edit: LineEdit = %ElementCodeEdit
|
||||
@onready var element_level_option: OptionButton = %ElementLevelOption
|
||||
@onready var element_duration_spin: SpinBox = %ElementDurationSpin
|
||||
@onready var segment_label_dialog: ConfirmationDialog = %SegmentLabelDialog
|
||||
@onready var segment_label_edit: LineEdit = %SegmentLabelEdit
|
||||
@onready var duration_minus_button: Button = %DurationMinusButton
|
||||
|
|
@ -395,11 +402,13 @@ func get_selected_element_caption() -> String:
|
|||
|
||||
|
||||
## Tags the selected segment with an element (or removes the tag). Returns true
|
||||
## when the model changed.
|
||||
## when the model changed. A negative [param duration] keeps the current stand
|
||||
## time.
|
||||
func set_selected_element(
|
||||
type: PathSegment.ElementType,
|
||||
code: String,
|
||||
level: int
|
||||
level: int,
|
||||
duration: float = -1.0
|
||||
) -> bool:
|
||||
var segment := get_selected_segment()
|
||||
if segment == null:
|
||||
|
|
@ -411,18 +420,33 @@ func set_selected_element(
|
|||
|
||||
var cleaned := code.strip_edges().left(PathSegment.ELEMENT_CODE_MAX_LENGTH)
|
||||
var clamped := clampi(level, 0, PathSegment.ELEMENT_MAX_LEVEL)
|
||||
var clamped_duration := -1.0
|
||||
if type == PathSegment.ElementType.NONE:
|
||||
cleaned = ""
|
||||
clamped = 0
|
||||
clamped_duration = 0.0
|
||||
elif duration >= 0.0:
|
||||
clamped_duration = clampf(
|
||||
duration,
|
||||
0.0,
|
||||
PathSegment.ELEMENT_MAX_DURATION_SECONDS
|
||||
)
|
||||
elif segment.is_element_marker():
|
||||
clamped_duration = segment.element_duration_seconds
|
||||
else:
|
||||
clamped_duration = 0.0
|
||||
|
||||
if (
|
||||
segment.element_type == type
|
||||
and segment.element_code == cleaned
|
||||
and segment.element_level == clamped
|
||||
and segment.element_duration_seconds == clamped_duration
|
||||
):
|
||||
return false
|
||||
|
||||
_record_undo()
|
||||
segment.set_element(type, cleaned, clamped)
|
||||
segment.set_element_duration(maxf(clamped_duration, 0.0))
|
||||
if type != PathSegment.ElementType.NONE:
|
||||
# Keep the placement defaults on the last real element type.
|
||||
_element_type = type
|
||||
|
|
@ -441,7 +465,8 @@ func add_element_marker(
|
|||
position: Vector2,
|
||||
type: PathSegment.ElementType = PathSegment.ElementType.JUMP,
|
||||
code: String = "",
|
||||
level: int = -1
|
||||
level: int = -1,
|
||||
duration: float = -1.0
|
||||
) -> PathSegment:
|
||||
if _active_section == null:
|
||||
return null
|
||||
|
|
@ -462,6 +487,11 @@ func add_element_marker(
|
|||
code,
|
||||
_element_level if level < 0 else level
|
||||
)
|
||||
segment.set_element_duration(
|
||||
float(ELEMENT_DEFAULT_DURATIONS.get(type, 0.0))
|
||||
if duration < 0.0
|
||||
else duration
|
||||
)
|
||||
|
||||
_active_section.segments.append(segment)
|
||||
_selected_segment_id = segment.segment_id
|
||||
|
|
@ -503,7 +533,12 @@ func _on_element_type_selected(index: int) -> void:
|
|||
var selected := get_selected_segment()
|
||||
if selected == null:
|
||||
return
|
||||
set_selected_element(type, selected.element_code, selected.element_level)
|
||||
set_selected_element(
|
||||
type,
|
||||
selected.element_code,
|
||||
selected.element_level,
|
||||
float(ELEMENT_DEFAULT_DURATIONS.get(type, 0.0))
|
||||
)
|
||||
|
||||
|
||||
func _open_element_dialog() -> void:
|
||||
|
|
@ -520,7 +555,17 @@ func _open_element_dialog() -> void:
|
|||
if level_index < 0:
|
||||
level_index = 0
|
||||
element_level_option.select(level_index)
|
||||
element_dialog.popup_centered(Vector2i(520, 360))
|
||||
|
||||
var is_marker := segment.is_element_marker()
|
||||
element_duration_spin.set_value_no_signal(segment.element_duration_seconds)
|
||||
element_duration_spin.editable = is_marker
|
||||
element_duration_spin.tooltip_text = (
|
||||
"Standzeit des Punktmarkers"
|
||||
if is_marker
|
||||
else "Sequenzbereiche nutzen die Segmentdauer in der Timing-Leiste"
|
||||
)
|
||||
|
||||
element_dialog.popup_centered(Vector2i(520, 420))
|
||||
element_code_edit.grab_focus()
|
||||
element_code_edit.select_all()
|
||||
|
||||
|
|
@ -530,7 +575,7 @@ func _on_element_confirmed() -> void:
|
|||
element_dialog_type_option.selected
|
||||
)
|
||||
var level: int = element_level_option.get_item_id(element_level_option.selected)
|
||||
set_selected_element(type, element_code_edit.text, level)
|
||||
set_selected_element(type, element_code_edit.text, level, element_duration_spin.value)
|
||||
|
||||
|
||||
func add_section() -> RoutineSection:
|
||||
|
|
@ -793,6 +838,7 @@ func _clone_segment(source: PathSegment) -> PathSegment:
|
|||
clone.element_type = source.element_type
|
||||
clone.element_code = source.element_code
|
||||
clone.element_level = source.element_level
|
||||
clone.element_duration_seconds = source.element_duration_seconds
|
||||
clone.label = source.label
|
||||
clone.template = source.template
|
||||
clone.arc_depth_ratio = source.arc_depth_ratio
|
||||
|
|
@ -1341,7 +1387,10 @@ func _refresh_playback_timeline() -> void:
|
|||
for segment: PathSegment in section.segments:
|
||||
if segment == null:
|
||||
continue
|
||||
var duration := maxf(segment.duration_seconds, 0.0)
|
||||
var duration := maxf(
|
||||
segment.get_effective_duration_seconds(),
|
||||
0.0
|
||||
)
|
||||
if duration <= 0.0:
|
||||
continue
|
||||
entries.append({
|
||||
|
|
@ -1382,11 +1431,14 @@ func _update_playback_state(
|
|||
return
|
||||
|
||||
var entry: Dictionary = _playback_entries[_playback_entries.size() - 1]
|
||||
for candidate: Dictionary in _playback_entries:
|
||||
var entry_index := _playback_entries.size() - 1
|
||||
for index: int in range(_playback_entries.size()):
|
||||
var candidate: Dictionary = _playback_entries[index]
|
||||
var candidate_start: float = candidate["start"]
|
||||
var candidate_duration: float = candidate["duration"]
|
||||
if _playback_time < candidate_start + candidate_duration - 0.0001:
|
||||
entry = candidate
|
||||
entry_index = index
|
||||
break
|
||||
|
||||
var segment: PathSegment = entry["segment"]
|
||||
|
|
@ -1417,7 +1469,18 @@ func _update_playback_state(
|
|||
if segment.direction == PathSegment.Direction.BACKWARD:
|
||||
facing = -facing
|
||||
|
||||
if force_heading or delta <= 0.0 or _playback_heading.length_squared() <= 0.0:
|
||||
if segment.is_element_marker():
|
||||
# Markers have no tangent: keep facing the way the skater arrived. A
|
||||
# spin rotates in place, so its heading follows the elapsed stand time.
|
||||
facing = _entry_arrival_heading(entry_index)
|
||||
if segment.element_type == PathSegment.ElementType.SPIN:
|
||||
facing = facing.rotated(
|
||||
TAU * SPIN_REVOLUTIONS_PER_SECOND * local_time
|
||||
)
|
||||
_playback_heading = facing
|
||||
elif force_heading or _playback_heading.length_squared() <= 0.0:
|
||||
_playback_heading = facing
|
||||
elif force_heading or delta <= 0.0 or _playback_heading.length_squared() <= 0.0:
|
||||
_playback_heading = facing
|
||||
else:
|
||||
var turn := clampf(delta * 12.0, 0.0, 1.0)
|
||||
|
|
@ -1439,6 +1502,32 @@ func _update_playback_state(
|
|||
_update_playback_ui()
|
||||
|
||||
|
||||
## Heading with which the skater arrives at the timed entry [param entry_index].
|
||||
## Walks back to the last entry with a real path so a marker keeps facing the
|
||||
## direction of travel.
|
||||
func _entry_arrival_heading(entry_index: int) -> Vector2:
|
||||
var index := entry_index - 1
|
||||
while index >= 0:
|
||||
var previous: Dictionary = _playback_entries[index]
|
||||
var previous_segment: PathSegment = previous["segment"]
|
||||
if previous_segment != null:
|
||||
var length := previous_segment.get_length_m()
|
||||
if length > 0.0 and previous_segment.curve != null:
|
||||
var epsilon := maxf(0.01, length * 0.01)
|
||||
var before := previous_segment.curve.sample_baked(
|
||||
maxf(0.0, length - epsilon)
|
||||
)
|
||||
var end := previous_segment.curve.sample_baked(length)
|
||||
var direction := end - before
|
||||
if direction.length_squared() > 0.0:
|
||||
direction = direction.normalized()
|
||||
if previous_segment.direction == PathSegment.Direction.BACKWARD:
|
||||
direction = -direction
|
||||
return direction
|
||||
index -= 1
|
||||
return Vector2.RIGHT
|
||||
|
||||
|
||||
func _update_playback_ui() -> void:
|
||||
_updating_timeline = true
|
||||
playback_timeline.max_value = maxf(_playback_total_duration, 0.0)
|
||||
|
|
@ -1545,9 +1634,10 @@ func _update_timing_ui() -> void:
|
|||
element_button.tooltip_text = "Element bearbeiten: %s" % (
|
||||
selected.get_element_caption()
|
||||
)
|
||||
timing_selection_label.text = "%s · %s" % [
|
||||
timing_selection_label.text = "%s · %s · %s s" % [
|
||||
PathSegment.element_type_name(selected.element_type),
|
||||
selected.get_element_caption(),
|
||||
_format_seconds(selected.element_duration_seconds),
|
||||
]
|
||||
duration_value_label.text = "–"
|
||||
speed_value_label.text = "–"
|
||||
|
|
@ -2469,9 +2559,10 @@ func _update_status() -> void:
|
|||
|
||||
if selected != null:
|
||||
if selected.is_element_marker():
|
||||
text += " | Auswahl: %s · %s" % [
|
||||
text += " | Auswahl: %s · %s · %s s" % [
|
||||
PathSegment.element_type_name(selected.element_type),
|
||||
selected.get_element_caption(),
|
||||
_format_seconds(selected.element_duration_seconds),
|
||||
]
|
||||
status_label.text = text
|
||||
return
|
||||
|
|
|
|||
|
|
@ -83,6 +83,18 @@ func _capture() -> void:
|
|||
controller.set_tool(WhiteboardController.Tool.ELEMENT)
|
||||
elif args.size() > 3 and args[3] == "dialog":
|
||||
controller.element_button.pressed.emit()
|
||||
elif args.size() > 3 and args[3] == "spin":
|
||||
var elapsed := 0.0
|
||||
for segment: PathSegment in controller.get_active_section().segments:
|
||||
if (
|
||||
segment.is_element_marker()
|
||||
and segment.element_type == PathSegment.ElementType.SPIN
|
||||
):
|
||||
controller.seek_playback(
|
||||
elapsed + segment.element_duration_seconds * 0.5
|
||||
)
|
||||
break
|
||||
elapsed += segment.get_effective_duration_seconds()
|
||||
controller.rink_canvas.fit_rink()
|
||||
controller.rink_canvas.refresh()
|
||||
await process_frame
|
||||
|
|
|
|||
|
|
@ -211,6 +211,30 @@ func _test_element_markers() -> void:
|
|||
"caption falls back to the type name"
|
||||
)
|
||||
|
||||
spin.set_element_duration(9.5)
|
||||
_check_approx(
|
||||
spin.element_duration_seconds,
|
||||
9.5,
|
||||
"stand time is stored on the marker"
|
||||
)
|
||||
_check_approx(
|
||||
spin.get_effective_duration_seconds(),
|
||||
9.5,
|
||||
"a point marker uses its stand time as timeline duration"
|
||||
)
|
||||
spin.set_element_duration(-3.0)
|
||||
_check_approx(
|
||||
spin.element_duration_seconds,
|
||||
0.0,
|
||||
"negative stand time is clamped to zero"
|
||||
)
|
||||
spin.element_duration_seconds = 200.0
|
||||
_check(
|
||||
not spin.is_valid(),
|
||||
"stand time above the maximum is invalid"
|
||||
)
|
||||
spin.set_element_duration(8.0)
|
||||
|
||||
spin.set_element(
|
||||
PathSegmentModel.ElementType.SEQUENCE,
|
||||
"123456789012345678901234567890",
|
||||
|
|
@ -252,6 +276,11 @@ func _test_element_markers() -> void:
|
|||
)
|
||||
_check(not plain.is_element(), "plain segment has no element")
|
||||
_check(not plain.is_element_marker(), "plain segment is not a point marker")
|
||||
_check_approx(
|
||||
plain.get_effective_duration_seconds(),
|
||||
1.0,
|
||||
"path segments use their normal duration on the timeline"
|
||||
)
|
||||
_check(
|
||||
plain.get_element_caption() == "Element",
|
||||
"plain segment caption falls back to the generic name"
|
||||
|
|
@ -283,6 +312,22 @@ func _test_section_aggregation() -> void:
|
|||
"segment lookup returns the matching instance"
|
||||
)
|
||||
|
||||
var marker: PathSegment = PathSegmentModel.new()
|
||||
marker.segment_id = "seg-jump"
|
||||
var marker_curve := Curve2D.new()
|
||||
marker_curve.add_point(Vector2(0.0, 0.0))
|
||||
marker.curve = marker_curve
|
||||
marker.speed_mps = 4.3
|
||||
marker.set_element(PathSegmentModel.ElementType.JUMP, "3Lz", 0)
|
||||
marker.set_element_duration(0.7)
|
||||
section.segments.append(marker)
|
||||
_check_approx(
|
||||
section.get_duration_seconds(),
|
||||
7.2,
|
||||
"section duration includes the stand time of markers"
|
||||
)
|
||||
_check_approx(section.get_length_m(), 10.0, "markers keep the section length")
|
||||
|
||||
|
||||
func _test_routine_validation() -> void:
|
||||
var routine: Routine = _make_routine()
|
||||
|
|
|
|||
|
|
@ -178,6 +178,63 @@ func _run() -> void:
|
|||
controller.speed_option.item_selected.emit(2)
|
||||
_check_approx(controller.get_playback_speed(), 1.0, "speed option returns to 1x")
|
||||
|
||||
# Element markers take their stand time from the element, not the geometry,
|
||||
# and a spin rotates the playback dot in place.
|
||||
var jump_marker := controller.add_element_marker(
|
||||
Vector2(20.0, 3.0),
|
||||
PathSegment.ElementType.JUMP,
|
||||
"3Lz",
|
||||
0
|
||||
)
|
||||
_check_approx(
|
||||
jump_marker.element_duration_seconds,
|
||||
0.7,
|
||||
"jump marker gets a default air time"
|
||||
)
|
||||
var spin_marker := controller.add_element_marker(
|
||||
Vector2(22.0, 6.0),
|
||||
PathSegment.ElementType.SPIN,
|
||||
"CCoSp4",
|
||||
3
|
||||
)
|
||||
_check_approx(
|
||||
spin_marker.element_duration_seconds,
|
||||
8.0,
|
||||
"spin marker gets a default stand time"
|
||||
)
|
||||
controller._update_status()
|
||||
_check_approx(
|
||||
controller.get_playback_duration(),
|
||||
14.7,
|
||||
"timeline duration includes the element stand times"
|
||||
)
|
||||
|
||||
var jump_start := 6.0
|
||||
controller.seek_playback(jump_start)
|
||||
_check(
|
||||
controller.get_playback_segment_id() == jump_marker.segment_id,
|
||||
"timeline stops at the jump marker"
|
||||
)
|
||||
var jump_heading := controller.get_playback_heading()
|
||||
controller.seek_playback(jump_start + 0.35)
|
||||
_check(
|
||||
jump_heading.dot(controller.get_playback_heading()) > 0.99,
|
||||
"jump marker keeps the arrival heading"
|
||||
)
|
||||
|
||||
var spin_start := jump_start + 0.7
|
||||
controller.seek_playback(spin_start)
|
||||
_check(
|
||||
controller.get_playback_segment_id() == spin_marker.segment_id,
|
||||
"timeline stops at the spin marker"
|
||||
)
|
||||
var spin_arrival := controller.get_playback_heading()
|
||||
controller.seek_playback(spin_start + 1.0 / 3.0)
|
||||
_check(
|
||||
spin_arrival.dot(controller.get_playback_heading()) < -0.9,
|
||||
"spin marker rotates the playback dot in place"
|
||||
)
|
||||
|
||||
scene.queue_free()
|
||||
await process_frame
|
||||
_finish()
|
||||
|
|
|
|||
|
|
@ -626,6 +626,7 @@ func _run() -> void:
|
|||
"element tool enables marker placement"
|
||||
)
|
||||
var marker_count_before := section.segments.size()
|
||||
var duration_before_marker := controller.get_routine().get_duration_seconds()
|
||||
var jump_point := Vector2(14.0, 7.0)
|
||||
_mouse_button(canvas, view.model_to_screen(jump_point), true)
|
||||
_mouse_button(canvas, view.model_to_screen(jump_point), false)
|
||||
|
|
@ -638,7 +639,16 @@ func _run() -> void:
|
|||
_check(jump != null and jump.is_element_marker(), "placed marker is a point marker")
|
||||
if jump != null:
|
||||
_check_approx(jump.get_length_m(), 0.0, "marker has no length")
|
||||
_check_approx(jump.duration_seconds, 0.0, "marker has no duration")
|
||||
_check_approx(
|
||||
jump.duration_seconds,
|
||||
0.0,
|
||||
"marker geometry has no traversal duration"
|
||||
)
|
||||
_check_approx(
|
||||
jump.element_duration_seconds,
|
||||
0.7,
|
||||
"jump gets the default air time"
|
||||
)
|
||||
_check(
|
||||
jump.element_type == PathSegment.ElementType.JUMP,
|
||||
"default marker type is a jump"
|
||||
|
|
@ -653,8 +663,13 @@ func _run() -> void:
|
|||
)
|
||||
_check_approx(
|
||||
controller.get_playback_duration(),
|
||||
routine.get_duration_seconds(),
|
||||
"markers do not add playback time"
|
||||
controller.get_routine().get_duration_seconds(),
|
||||
"playback includes the marker stand time"
|
||||
)
|
||||
_check_approx(
|
||||
controller.get_routine().get_duration_seconds(),
|
||||
duration_before_marker + 0.7,
|
||||
"routine duration includes the jump air time"
|
||||
)
|
||||
|
||||
# A tap on the selected marker handle must not record an undo entry:
|
||||
|
|
@ -690,6 +705,11 @@ func _run() -> void:
|
|||
spin != null and spin.element_type == PathSegment.ElementType.SPIN,
|
||||
"toolbar type is used for the next marker"
|
||||
)
|
||||
_check_approx(
|
||||
spin.element_duration_seconds,
|
||||
8.0,
|
||||
"spin gets the default stand time"
|
||||
)
|
||||
|
||||
_check(
|
||||
controller.set_selected_element(
|
||||
|
|
@ -703,6 +723,11 @@ func _run() -> void:
|
|||
spin.get_element_caption() == "CCoSp4 L3",
|
||||
"marker caption includes code and level"
|
||||
)
|
||||
_check_approx(
|
||||
spin.element_duration_seconds,
|
||||
8.0,
|
||||
"editing code keeps the stand time"
|
||||
)
|
||||
_check(controller.undo(), "element edit can be undone")
|
||||
var restored_spin := controller.get_active_section().get_segment_by_id(
|
||||
spin.segment_id
|
||||
|
|
@ -732,11 +757,27 @@ func _run() -> void:
|
|||
controller.element_level_option.select(
|
||||
controller.element_level_option.get_item_index(2)
|
||||
)
|
||||
controller.element_duration_spin.value = 6.5
|
||||
controller.element_dialog.confirmed.emit()
|
||||
_check(
|
||||
controller.get_selected_element_caption() == "CCoSp3 L2",
|
||||
"element dialog applies code and level"
|
||||
)
|
||||
_check_approx(
|
||||
controller.get_selected_segment().element_duration_seconds,
|
||||
6.5,
|
||||
"element dialog applies the stand time"
|
||||
)
|
||||
controller.element_button.pressed.emit()
|
||||
_check_approx(
|
||||
controller.element_duration_spin.value,
|
||||
6.5,
|
||||
"element dialog is prefilled with the stand time"
|
||||
)
|
||||
_check(
|
||||
controller.element_duration_spin.editable,
|
||||
"stand time is editable for point markers"
|
||||
)
|
||||
controller.element_dialog.hide()
|
||||
|
||||
# Dragging the marker handle moves the point.
|
||||
|
|
@ -901,6 +942,11 @@ func _run() -> void:
|
|||
loaded_marker.get_element_caption() == "Sprung",
|
||||
"load restores the element caption"
|
||||
)
|
||||
_check_approx(
|
||||
loaded_marker.element_duration_seconds,
|
||||
0.7,
|
||||
"load restores the element stand time"
|
||||
)
|
||||
_check(
|
||||
loaded_marker.curve.point_count == 1,
|
||||
"load keeps the marker curve as a single point"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue