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
|
|
@ -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