feat: strukturierte Sprungkombinationen
- PathSegment mit jump_kind und combination_jumps (max. 3 Sprünge) - Base Value summiert strukturierte Kombinations-/Folgeteile - Element-Dialog mit Art, zweitem und drittem Sprung; Level/Features bei Spruengen ausgeblendet - Validator nutzt strukturierte Teile fuer Wiederholungen und Kombinationen - Legacy-Freitext bleibt als Fallback lesbar - 93 Model-, 169 Rules-, 70 Adult- und 288 Whiteboard-Assertions (1051 gesamt) - Doku, Anleitung und Findings aktualisiert
This commit is contained in:
parent
e1f543cb66
commit
8f1cf1bf44
16 changed files with 766 additions and 46 deletions
|
|
@ -633,6 +633,7 @@ max_length = 24
|
|||
caret_blink = true
|
||||
|
||||
[node name="ElementLevelLabel" type="Label" parent="ElementDialog/ElementBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.580392, 0.639216, 0.721569, 1)
|
||||
theme_override_font_sizes/font_size = 15
|
||||
|
|
@ -651,6 +652,38 @@ theme_override_colors/font_color = Color(0.74902, 0.803922, 0.878431, 1)
|
|||
theme_override_font_sizes/font_size = 15
|
||||
text = "Base Value: –"
|
||||
|
||||
[node name="JumpCombinationBox" type="VBoxContainer" parent="ElementDialog/ElementBox"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
theme_override_constants/separation = 6
|
||||
|
||||
[node name="JumpKindLabel" type="Label" parent="ElementDialog/ElementBox/JumpCombinationBox"]
|
||||
layout_mode = 2
|
||||
theme_override_colors/font_color = Color(0.580392, 0.639216, 0.721569, 1)
|
||||
theme_override_font_sizes/font_size = 15
|
||||
text = "Sprungkombination"
|
||||
|
||||
[node name="JumpKindOption" type="OptionButton" parent="ElementDialog/ElementBox/JumpCombinationBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
|
||||
[node name="JumpSecondOption" type="OptionButton" parent="ElementDialog/ElementBox/JumpCombinationBox"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
|
||||
[node name="JumpThirdOption" type="OptionButton" parent="ElementDialog/ElementBox/JumpCombinationBox"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
custom_minimum_size = Vector2(0, 48)
|
||||
layout_mode = 2
|
||||
theme_override_font_sizes/font_size = 16
|
||||
|
||||
[node name="ElementFeaturesButton" type="Button" parent="ElementDialog/ElementBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(0, 56)
|
||||
|
|
|
|||
|
|
@ -36,10 +36,17 @@ enum ElementType {
|
|||
SEQUENCE,
|
||||
}
|
||||
|
||||
enum JumpKind {
|
||||
SOLO,
|
||||
COMBINATION,
|
||||
SEQUENCE,
|
||||
}
|
||||
|
||||
const ELEMENT_CODE_MAX_LENGTH := 24
|
||||
const ELEMENT_MAX_LEVEL := 4
|
||||
const ELEMENT_MAX_DURATION_SECONDS := 120.0
|
||||
const ELEMENT_MAX_FEATURES := 16
|
||||
const JUMP_MAX_PARTS := 3
|
||||
|
||||
@export var segment_id: String = ""
|
||||
@export var curve: Curve2D
|
||||
|
|
@ -51,6 +58,10 @@ const ELEMENT_MAX_FEATURES := 16
|
|||
@export var element_id: String = ""
|
||||
@export var element_type: ElementType = ElementType.NONE
|
||||
@export var element_code: String = ""
|
||||
## Structured jump combination: [member element_code] is the first jump,
|
||||
## [member combination_jumps] holds up to two additional jumps.
|
||||
@export var jump_kind: JumpKind = JumpKind.SOLO
|
||||
@export var combination_jumps: PackedStringArray = PackedStringArray()
|
||||
## 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
|
||||
|
|
@ -149,9 +160,16 @@ func set_element(type: ElementType, code: String, level: int) -> void:
|
|||
element_code = ""
|
||||
element_level = 0
|
||||
element_features = PackedStringArray()
|
||||
jump_kind = JumpKind.SOLO
|
||||
combination_jumps = PackedStringArray()
|
||||
return
|
||||
if type != previous_type:
|
||||
element_features = PackedStringArray()
|
||||
jump_kind = JumpKind.SOLO
|
||||
combination_jumps = PackedStringArray()
|
||||
if type != ElementType.JUMP:
|
||||
jump_kind = JumpKind.SOLO
|
||||
combination_jumps = PackedStringArray()
|
||||
element_code = code.strip_edges().left(ELEMENT_CODE_MAX_LENGTH)
|
||||
element_level = clampi(level, 0, ELEMENT_MAX_LEVEL)
|
||||
|
||||
|
|
@ -173,11 +191,56 @@ func set_element_features(features: PackedStringArray) -> void:
|
|||
element_features = cleaned
|
||||
|
||||
|
||||
## Stores a structured jump combination or sequence. [member element_code]
|
||||
## remains the first jump; up to two additional jumps are kept.
|
||||
func set_jump_combination(
|
||||
kind: JumpKind,
|
||||
additional_jumps: PackedStringArray
|
||||
) -> void:
|
||||
if element_type != ElementType.JUMP:
|
||||
jump_kind = JumpKind.SOLO
|
||||
combination_jumps = PackedStringArray()
|
||||
return
|
||||
jump_kind = kind
|
||||
if kind == JumpKind.SOLO:
|
||||
combination_jumps = PackedStringArray()
|
||||
return
|
||||
var cleaned := PackedStringArray()
|
||||
for raw: String in additional_jumps:
|
||||
var code := raw.strip_edges().left(ELEMENT_CODE_MAX_LENGTH)
|
||||
if code.is_empty():
|
||||
continue
|
||||
cleaned.append(code)
|
||||
if cleaned.size() >= JUMP_MAX_PARTS - 1:
|
||||
break
|
||||
combination_jumps = cleaned
|
||||
|
||||
|
||||
## First jump plus the additional combination jumps. Empty for non-jumps.
|
||||
func get_jump_parts() -> PackedStringArray:
|
||||
var parts := PackedStringArray()
|
||||
if element_type != ElementType.JUMP:
|
||||
return parts
|
||||
var first := element_code.strip_edges()
|
||||
if not first.is_empty():
|
||||
parts.append(first)
|
||||
for extra: String in combination_jumps:
|
||||
var code := extra.strip_edges()
|
||||
if not code.is_empty():
|
||||
parts.append(code)
|
||||
return parts
|
||||
|
||||
|
||||
## Short caption for the canvas and exports, e.g. "3Lz" or "CCoSp4 L3".
|
||||
func get_element_caption() -> String:
|
||||
var code := element_code.strip_edges()
|
||||
if code.is_empty():
|
||||
code = element_type_name(element_type)
|
||||
if element_type == ElementType.JUMP and not combination_jumps.is_empty():
|
||||
var caption := "+".join(get_jump_parts())
|
||||
if jump_kind == JumpKind.SEQUENCE:
|
||||
caption += "+SEQ"
|
||||
return caption
|
||||
if element_level > 0 and element_type != ElementType.JUMP:
|
||||
return "%s L%d" % [code, element_level]
|
||||
return code
|
||||
|
|
@ -241,6 +304,29 @@ func validate() -> PackedStringArray:
|
|||
if feature != feature.strip_edges():
|
||||
errors.append("element_features must be trimmed")
|
||||
break
|
||||
if element_type != ElementType.JUMP:
|
||||
if jump_kind != JumpKind.SOLO or not combination_jumps.is_empty():
|
||||
errors.append("jump combinations need a jump element")
|
||||
else:
|
||||
if jump_kind == JumpKind.SOLO and not combination_jumps.is_empty():
|
||||
errors.append("combination jumps need a combination kind")
|
||||
if jump_kind != JumpKind.SOLO and combination_jumps.is_empty():
|
||||
errors.append("a jump combination needs at least one more jump")
|
||||
if combination_jumps.size() > JUMP_MAX_PARTS - 1:
|
||||
errors.append(
|
||||
"a jump combination must not exceed %d jumps" % JUMP_MAX_PARTS
|
||||
)
|
||||
for extra: String in combination_jumps:
|
||||
if extra.strip_edges().is_empty():
|
||||
errors.append("combination_jumps must not contain empty codes")
|
||||
break
|
||||
if extra != extra.strip_edges():
|
||||
errors.append("combination_jumps must be trimmed")
|
||||
break
|
||||
if get_jump_parts().size() > JUMP_MAX_PARTS:
|
||||
errors.append(
|
||||
"a jump combination must not exceed %d jumps" % JUMP_MAX_PARTS
|
||||
)
|
||||
if (
|
||||
element_duration_seconds < 0.0
|
||||
or element_duration_seconds > ELEMENT_MAX_DURATION_SECONDS
|
||||
|
|
|
|||
|
|
@ -108,11 +108,33 @@ func get_base_value(
|
|||
return definition.get_base_value(resolved)
|
||||
|
||||
|
||||
## Base value of an element-tagged segment. Sequences without a code and
|
||||
## elements outside the catalog return -1.
|
||||
## Base value of an element-tagged segment. Jump combinations are summed from
|
||||
## their structured parts; legacy free-text combinations are parsed as a
|
||||
## fallback. Sequences without a code and elements outside the catalog return
|
||||
## -1.
|
||||
func get_segment_base_value(segment: PathSegment) -> float:
|
||||
if segment == null or not segment.is_element():
|
||||
return -1.0
|
||||
if segment.element_type == PathSegment.ElementType.JUMP:
|
||||
if segment.element_code.strip_edges().is_empty():
|
||||
return -1.0
|
||||
var parts := segment.get_jump_parts()
|
||||
if parts.size() == 1 and parts[0].contains("+"):
|
||||
parts = _split_legacy_jump_parts(parts[0])
|
||||
if parts.is_empty():
|
||||
return -1.0
|
||||
var total := 0.0
|
||||
for part: String in parts:
|
||||
var value := get_base_value(
|
||||
part,
|
||||
0,
|
||||
PathSegment.ElementType.JUMP
|
||||
)
|
||||
if value < 0.0:
|
||||
return -1.0
|
||||
total += value
|
||||
return total
|
||||
|
||||
if segment.element_code.strip_edges().is_empty():
|
||||
return -1.0
|
||||
return get_base_value(
|
||||
|
|
@ -122,6 +144,21 @@ func get_segment_base_value(segment: PathSegment) -> float:
|
|||
)
|
||||
|
||||
|
||||
static func _split_legacy_jump_parts(code: String) -> PackedStringArray:
|
||||
var parts := PackedStringArray()
|
||||
for raw: String in code.split("+"):
|
||||
var token := raw.strip_edges()
|
||||
var upper := token.to_upper()
|
||||
if token.is_empty() or upper == "SEQ" or upper == "S":
|
||||
continue
|
||||
if token.length() < 2 or not token.substr(0, 1).is_valid_int():
|
||||
continue
|
||||
if token.substr(1).to_lower() == "eu":
|
||||
continue
|
||||
parts.append(token)
|
||||
return parts
|
||||
|
||||
|
||||
## Family codes for one element type, in file order.
|
||||
func get_codes(
|
||||
type: PathSegment.ElementType = PathSegment.ElementType.NONE
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ func _validate_category(
|
|||
match segment.element_type:
|
||||
PathSegment.ElementType.JUMP:
|
||||
jumps += 1
|
||||
var parts := _jump_parts(code)
|
||||
var parts := _segment_jump_parts(segment)
|
||||
for part: String in parts:
|
||||
var key := part.to_lower()
|
||||
jump_counts[key] = jump_counts.get(key, 0) + 1
|
||||
|
|
@ -148,7 +148,10 @@ func _validate_category(
|
|||
)
|
||||
jump_type_failed = true
|
||||
if parts.size() > 1:
|
||||
if code.to_upper().contains("SEQ"):
|
||||
if (
|
||||
segment.jump_kind == PathSegment.JumpKind.SEQUENCE
|
||||
or code.to_upper().contains("SEQ")
|
||||
):
|
||||
sequence_count += 1
|
||||
else:
|
||||
combination_count += 1
|
||||
|
|
@ -366,6 +369,13 @@ func _validate_category(
|
|||
_pass(report, "category_duration")
|
||||
|
||||
|
||||
static func _segment_jump_parts(segment: PathSegment) -> PackedStringArray:
|
||||
var parts := segment.get_jump_parts()
|
||||
if parts.size() == 1 and parts[0].contains("+"):
|
||||
return _jump_parts(parts[0])
|
||||
return parts
|
||||
|
||||
|
||||
## Splits a jump code like "3Lz+2T+SEQ" into its listed jumps. Euler (Eu) and
|
||||
## the SEQ marker are not listed jumps and do not count for repetition.
|
||||
static func _jump_parts(code: String) -> PackedStringArray:
|
||||
|
|
|
|||
|
|
@ -116,8 +116,13 @@ const COMPACT_LAYOUT_WIDTH := 1280.0
|
|||
@onready var element_dialog_type_option: OptionButton = %ElementDialogTypeOption
|
||||
@onready var element_code_option: OptionButton = %ElementCodeOption
|
||||
@onready var element_code_edit: LineEdit = %ElementCodeEdit
|
||||
@onready var element_level_label: Label = %ElementLevelLabel
|
||||
@onready var element_level_option: OptionButton = %ElementLevelOption
|
||||
@onready var element_value_label: Label = %ElementValueLabel
|
||||
@onready var jump_combination_box: VBoxContainer = %JumpCombinationBox
|
||||
@onready var jump_kind_option: OptionButton = %JumpKindOption
|
||||
@onready var jump_second_option: OptionButton = %JumpSecondOption
|
||||
@onready var jump_third_option: OptionButton = %JumpThirdOption
|
||||
@onready var element_features_button: Button = %ElementFeaturesButton
|
||||
@onready var element_feature_hint: Label = %ElementFeatureHint
|
||||
@onready var element_feature_menu: PopupMenu = %ElementFeatureMenu
|
||||
|
|
@ -176,6 +181,8 @@ var _element_catalog: ElementCatalog
|
|||
var _level_rules: ElementLevelRules
|
||||
var _adult_rules: AdultCategoryRules
|
||||
var _dialog_features: PackedStringArray = PackedStringArray()
|
||||
var _dialog_jump_kind: PathSegment.JumpKind = PathSegment.JumpKind.SOLO
|
||||
var _dialog_combination_jumps: PackedStringArray = PackedStringArray()
|
||||
var _show_score_info: bool = false
|
||||
var _show_score_assumptions: bool = false
|
||||
var _preset_speed: float = DEFAULT_SPEED_MPS
|
||||
|
|
@ -643,20 +650,26 @@ func _score_info_lines() -> PackedStringArray:
|
|||
var lines := PackedStringArray()
|
||||
lines.append("[b]Enthalten[/b]")
|
||||
lines.append("- Base Value jedes Elements aus Katalog und gewähltem Level")
|
||||
lines.append("- ChSq mit festem Level 1")
|
||||
lines.append("- ChSq und ChSp mit festem Level 1")
|
||||
lines.append("- strukturierte Sprungkombinationen als Summe ihrer Sprünge")
|
||||
lines.append("- nur Elemente mit gültigem Katalogwert")
|
||||
lines.append("")
|
||||
lines.append("[b]Nicht enthalten[/b]")
|
||||
lines.append("[b]Nicht im Basiswert enthalten[/b]")
|
||||
lines.append("- GOE / Ausführungsqualität")
|
||||
lines.append("- 1,1-Faktor für Sprünge in der zweiten Programmhälfte")
|
||||
lines.append("- Programmkomponenten (PCS)")
|
||||
lines.append("- Abzüge (Stürze, Zeitüberschreitungen usw.)")
|
||||
lines.append("- Kombinationen und Freitext-Codes ohne Katalogwert")
|
||||
lines.append("- Programmtyp und Adult-spezifische Regeln")
|
||||
lines.append("- nicht katalogisierte Kombinationen und Freitext-Codes")
|
||||
lines.append("- Programmtyp und Adult-spezifische Sonderregeln")
|
||||
lines.append("")
|
||||
lines.append(
|
||||
"[b]Ergebnis[/b]\nDer angezeigte Wert ist ein technischer Basiswert, "
|
||||
+ "keine vorhergesagte Gesamtpunktzahl."
|
||||
"[b]Punktschätzung[/b]\nPCS und Sturzabzug werden separat in der "
|
||||
+ "Punktschätzung angesetzt."
|
||||
)
|
||||
lines.append("")
|
||||
lines.append(
|
||||
"[b]Ergebnis[/b]\nDer Basiswert ist ein technischer Wert, keine "
|
||||
+ "vorhergesagte Gesamtpunktzahl."
|
||||
)
|
||||
return lines
|
||||
|
||||
|
|
@ -800,6 +813,14 @@ func _help_content() -> String:
|
|||
"- Sprünge haben keinen Level; ihr Base Value hängt von Rotation und "
|
||||
+ "Sprungtyp ab."
|
||||
)
|
||||
lines.append(
|
||||
"- Sprungkombinationen werden strukturiert gewählt: erster Sprung plus "
|
||||
+ "bis zu zwei weitere, als Kombination oder Folge. Die Base Values "
|
||||
+ "werden summiert."
|
||||
)
|
||||
lines.append(
|
||||
"- Alte Freitext-Kombinationen wie 3Lz+2T bleiben als Fallback lesbar."
|
||||
)
|
||||
lines.append(
|
||||
"- ChSq (Choreo-Sequenz) und ChSp (Choreographic Spin) sind fest "
|
||||
+ "Level 1."
|
||||
|
|
@ -1065,6 +1086,18 @@ func _clean_feature_codes(features: PackedStringArray) -> PackedStringArray:
|
|||
return cleaned
|
||||
|
||||
|
||||
func _clean_jump_combination(extras: PackedStringArray) -> PackedStringArray:
|
||||
var cleaned := PackedStringArray()
|
||||
for raw: String in extras:
|
||||
var code := raw.strip_edges().left(PathSegment.ELEMENT_CODE_MAX_LENGTH)
|
||||
if code.is_empty():
|
||||
continue
|
||||
cleaned.append(code)
|
||||
if cleaned.size() >= PathSegment.JUMP_MAX_PARTS - 1:
|
||||
break
|
||||
return cleaned
|
||||
|
||||
|
||||
func _open_feature_menu() -> void:
|
||||
if not _populate_feature_menu():
|
||||
return
|
||||
|
|
@ -1164,7 +1197,32 @@ func update_element_value_hint() -> void:
|
|||
element_value_label.text = "Base Value: –"
|
||||
return
|
||||
|
||||
var value := _element_catalog.get_base_value(code, level, type)
|
||||
var value := -1.0
|
||||
if (
|
||||
type == PathSegment.ElementType.JUMP
|
||||
and _dialog_jump_kind != PathSegment.JumpKind.SOLO
|
||||
):
|
||||
var parts := PackedStringArray()
|
||||
if not code.is_empty():
|
||||
parts.append(code)
|
||||
for extra: String in _dialog_combination_jumps:
|
||||
var part := extra.strip_edges()
|
||||
if not part.is_empty():
|
||||
parts.append(part)
|
||||
if not parts.is_empty():
|
||||
value = 0.0
|
||||
for part: String in parts:
|
||||
var part_value := _element_catalog.get_base_value(
|
||||
part,
|
||||
0,
|
||||
PathSegment.ElementType.JUMP
|
||||
)
|
||||
if part_value < 0.0:
|
||||
value = -1.0
|
||||
break
|
||||
value += part_value
|
||||
else:
|
||||
value = _element_catalog.get_base_value(code, level, type)
|
||||
if value < 0.0:
|
||||
element_value_label.text = (
|
||||
"Base Value: – (Kürzel nicht im Katalog %s)" % _element_catalog.season
|
||||
|
|
@ -1375,17 +1433,94 @@ func _on_element_code_option_selected(index: int) -> void:
|
|||
update_element_value_hint()
|
||||
|
||||
|
||||
func _populate_jump_extra_options() -> void:
|
||||
for option: OptionButton in [jump_second_option, jump_third_option]:
|
||||
option.clear()
|
||||
option.add_item("— kein weiterer Sprung —", 0)
|
||||
option.set_item_metadata(0, "")
|
||||
if _element_catalog == null:
|
||||
continue
|
||||
for family: String in _element_catalog.get_codes(
|
||||
PathSegment.ElementType.JUMP
|
||||
):
|
||||
var definition := _element_catalog.find(family)
|
||||
var label := family
|
||||
if definition != null and not definition.display_name.is_empty():
|
||||
label = "%s — %s" % [family, definition.display_name]
|
||||
var item_id := option.item_count
|
||||
option.add_item(label, item_id)
|
||||
option.set_item_metadata(item_id, family)
|
||||
|
||||
|
||||
func _on_jump_kind_selected(index: int) -> void:
|
||||
_dialog_jump_kind = jump_kind_option.get_item_id(index)
|
||||
if _dialog_jump_kind == PathSegment.JumpKind.SOLO:
|
||||
_dialog_combination_jumps = PackedStringArray()
|
||||
jump_second_option.select(0)
|
||||
jump_third_option.select(0)
|
||||
_update_jump_controls()
|
||||
update_element_value_hint()
|
||||
|
||||
|
||||
func _on_jump_extra_selected(_index: int) -> void:
|
||||
var extras := PackedStringArray()
|
||||
for option: OptionButton in [jump_second_option, jump_third_option]:
|
||||
if option.selected < 0:
|
||||
continue
|
||||
var metadata: Variant = option.get_item_metadata(option.selected)
|
||||
var code := str(metadata).strip_edges() if metadata != null else ""
|
||||
if not code.is_empty():
|
||||
extras.append(code)
|
||||
_dialog_combination_jumps = extras
|
||||
update_element_value_hint()
|
||||
|
||||
|
||||
func _update_jump_controls() -> void:
|
||||
var is_jump := (
|
||||
_dialog_element_type() == PathSegment.ElementType.JUMP
|
||||
)
|
||||
jump_combination_box.visible = is_jump
|
||||
element_level_label.visible = not is_jump
|
||||
element_level_option.visible = not is_jump
|
||||
element_features_button.visible = not is_jump
|
||||
element_feature_hint.visible = not is_jump
|
||||
var show_extras := (
|
||||
is_jump and _dialog_jump_kind != PathSegment.JumpKind.SOLO
|
||||
)
|
||||
jump_second_option.visible = show_extras
|
||||
jump_third_option.visible = show_extras
|
||||
|
||||
|
||||
func _select_jump_extra(option: OptionButton, code: String) -> void:
|
||||
var needle := code.strip_edges()
|
||||
for index: int in range(option.item_count):
|
||||
var metadata: Variant = option.get_item_metadata(index)
|
||||
if metadata != null and str(metadata) == needle:
|
||||
option.select(index)
|
||||
return
|
||||
option.select(0)
|
||||
|
||||
|
||||
func _on_element_dialog_type_selected(index: int) -> void:
|
||||
var type: PathSegment.ElementType = element_dialog_type_option.get_item_id(index)
|
||||
var segment := get_selected_segment()
|
||||
if segment != null and type != segment.element_type:
|
||||
_dialog_features = PackedStringArray()
|
||||
if type != PathSegment.ElementType.JUMP:
|
||||
_dialog_jump_kind = PathSegment.JumpKind.SOLO
|
||||
_dialog_combination_jumps = PackedStringArray()
|
||||
jump_kind_option.select(
|
||||
jump_kind_option.get_item_index(PathSegment.JumpKind.SOLO)
|
||||
)
|
||||
jump_second_option.select(0)
|
||||
jump_third_option.select(0)
|
||||
var current := _dialog_element_code()
|
||||
_populate_code_options(type)
|
||||
_select_code_in_option(
|
||||
type,
|
||||
"" if type == PathSegment.ElementType.NONE else current
|
||||
)
|
||||
_update_jump_controls()
|
||||
_update_level_control_state()
|
||||
update_element_feature_hint()
|
||||
update_element_value_hint()
|
||||
|
|
@ -1435,26 +1570,38 @@ func set_selected_element(
|
|||
var features := (
|
||||
segment.element_features if segment != null else PackedStringArray()
|
||||
)
|
||||
var jump_kind := (
|
||||
segment.jump_kind if segment != null else PathSegment.JumpKind.SOLO
|
||||
)
|
||||
var combination := (
|
||||
segment.combination_jumps if segment != null else PackedStringArray()
|
||||
)
|
||||
if segment != null and type != segment.element_type:
|
||||
features = PackedStringArray()
|
||||
jump_kind = PathSegment.JumpKind.SOLO
|
||||
combination = PackedStringArray()
|
||||
return set_selected_element_with_features(
|
||||
type,
|
||||
code,
|
||||
level,
|
||||
features,
|
||||
duration
|
||||
duration,
|
||||
jump_kind,
|
||||
combination
|
||||
)
|
||||
|
||||
|
||||
## Applies type, code, pending features, derived level and duration in one
|
||||
## undo step. Used by the element dialog so feature and level changes stay
|
||||
## Applies type, code, pending features, derived level, jump combination and
|
||||
## duration in one undo step. Used by the element dialog so all edits stay
|
||||
## together.
|
||||
func set_selected_element_with_features(
|
||||
type: PathSegment.ElementType,
|
||||
code: String,
|
||||
level: int,
|
||||
features: PackedStringArray,
|
||||
duration: float = -1.0
|
||||
duration: float = -1.0,
|
||||
jump_kind: PathSegment.JumpKind = PathSegment.JumpKind.SOLO,
|
||||
combination_jumps: PackedStringArray = PackedStringArray()
|
||||
) -> bool:
|
||||
var segment := get_selected_segment()
|
||||
if segment == null:
|
||||
|
|
@ -1467,6 +1614,13 @@ func set_selected_element_with_features(
|
|||
var cleaned := code.strip_edges().left(PathSegment.ELEMENT_CODE_MAX_LENGTH)
|
||||
var clamped := clampi(level, 0, PathSegment.ELEMENT_MAX_LEVEL)
|
||||
var cleaned_features := _clean_feature_codes(features)
|
||||
var cleaned_kind := jump_kind
|
||||
var cleaned_combination := _clean_jump_combination(combination_jumps)
|
||||
if type != PathSegment.ElementType.JUMP:
|
||||
cleaned_kind = PathSegment.JumpKind.SOLO
|
||||
cleaned_combination = PackedStringArray()
|
||||
elif cleaned_kind == PathSegment.JumpKind.SOLO:
|
||||
cleaned_combination = PackedStringArray()
|
||||
if type != PathSegment.ElementType.NONE:
|
||||
var normalized := _normalize_element_input(type, cleaned, clamped)
|
||||
cleaned = str(normalized["code"])
|
||||
|
|
@ -1478,6 +1632,8 @@ func set_selected_element_with_features(
|
|||
cleaned = ""
|
||||
clamped = 0
|
||||
cleaned_features = PackedStringArray()
|
||||
cleaned_kind = PathSegment.JumpKind.SOLO
|
||||
cleaned_combination = PackedStringArray()
|
||||
clamped_duration = 0.0
|
||||
elif duration >= 0.0:
|
||||
clamped_duration = clampf(
|
||||
|
|
@ -1495,6 +1651,8 @@ func set_selected_element_with_features(
|
|||
and segment.element_code == cleaned
|
||||
and segment.element_level == clamped
|
||||
and segment.element_features == cleaned_features
|
||||
and segment.jump_kind == cleaned_kind
|
||||
and segment.combination_jumps == cleaned_combination
|
||||
and segment.element_duration_seconds == clamped_duration
|
||||
):
|
||||
return false
|
||||
|
|
@ -1502,6 +1660,7 @@ func set_selected_element_with_features(
|
|||
_record_undo()
|
||||
segment.set_element(type, cleaned, clamped)
|
||||
segment.set_element_features(cleaned_features)
|
||||
segment.set_jump_combination(cleaned_kind, cleaned_combination)
|
||||
segment.set_element_duration(maxf(clamped_duration, 0.0))
|
||||
if type != PathSegment.ElementType.NONE:
|
||||
# Keep the placement defaults on the last real element type.
|
||||
|
|
@ -1592,12 +1751,30 @@ func _setup_element_controls() -> void:
|
|||
for level: int in range(1, PathSegment.ELEMENT_MAX_LEVEL + 1):
|
||||
element_level_option.add_item("Level %d" % level, level)
|
||||
|
||||
jump_kind_option.clear()
|
||||
jump_kind_option.add_item(
|
||||
"Einzelsprung",
|
||||
PathSegment.JumpKind.SOLO
|
||||
)
|
||||
jump_kind_option.add_item(
|
||||
"Kombination",
|
||||
PathSegment.JumpKind.COMBINATION
|
||||
)
|
||||
jump_kind_option.add_item(
|
||||
"Folge (SEQ)",
|
||||
PathSegment.JumpKind.SEQUENCE
|
||||
)
|
||||
_populate_jump_extra_options()
|
||||
|
||||
element_code_edit.text_changed.connect(_on_element_code_text_changed)
|
||||
element_code_option.item_selected.connect(_on_element_code_option_selected)
|
||||
element_level_option.item_selected.connect(_on_element_value_option_selected)
|
||||
element_dialog_type_option.item_selected.connect(
|
||||
_on_element_dialog_type_selected
|
||||
)
|
||||
jump_kind_option.item_selected.connect(_on_jump_kind_selected)
|
||||
jump_second_option.item_selected.connect(_on_jump_extra_selected)
|
||||
jump_third_option.item_selected.connect(_on_jump_extra_selected)
|
||||
element_features_button.pressed.connect(_open_feature_menu)
|
||||
element_feature_menu.hide_on_item_selection = false
|
||||
element_feature_menu.hide_on_checkable_item_selection = false
|
||||
|
|
@ -1695,6 +1872,18 @@ func _open_element_dialog() -> void:
|
|||
type_index = 0
|
||||
element_dialog_type_option.select(type_index)
|
||||
_dialog_features = segment.element_features.duplicate()
|
||||
_dialog_jump_kind = segment.jump_kind
|
||||
_dialog_combination_jumps = segment.combination_jumps.duplicate()
|
||||
jump_kind_option.select(
|
||||
jump_kind_option.get_item_index(_dialog_jump_kind)
|
||||
)
|
||||
jump_second_option.select(0)
|
||||
jump_third_option.select(0)
|
||||
if _dialog_combination_jumps.size() >= 1:
|
||||
_select_jump_extra(jump_second_option, _dialog_combination_jumps[0])
|
||||
if _dialog_combination_jumps.size() >= 2:
|
||||
_select_jump_extra(jump_third_option, _dialog_combination_jumps[1])
|
||||
_update_jump_controls()
|
||||
_populate_code_options(segment.element_type)
|
||||
var level_index := element_level_option.get_item_index(segment.element_level)
|
||||
if level_index < 0:
|
||||
|
|
@ -1732,7 +1921,9 @@ func _on_element_confirmed() -> void:
|
|||
_dialog_element_code(),
|
||||
level,
|
||||
_dialog_features,
|
||||
element_duration_spin.value
|
||||
element_duration_spin.value,
|
||||
_dialog_jump_kind,
|
||||
_dialog_combination_jumps
|
||||
)
|
||||
|
||||
|
||||
|
|
@ -2001,6 +2192,8 @@ func _clone_segment(source: PathSegment) -> PathSegment:
|
|||
clone.element_code = source.element_code
|
||||
clone.element_level = source.element_level
|
||||
clone.element_features = source.element_features.duplicate()
|
||||
clone.jump_kind = source.jump_kind
|
||||
clone.combination_jumps = source.combination_jumps.duplicate()
|
||||
clone.element_duration_seconds = source.element_duration_seconds
|
||||
clone.label = source.label
|
||||
clone.template = source.template
|
||||
|
|
|
|||
|
|
@ -93,6 +93,22 @@ func _capture() -> void:
|
|||
controller.open_validation_dialog()
|
||||
elif args.size() > 3 and args[3] == "help":
|
||||
controller.help_button.pressed.emit()
|
||||
elif args.size() > 3 and args[3] == "combo":
|
||||
controller.select_segment(jump.segment_id)
|
||||
controller.element_button.pressed.emit()
|
||||
var combo_kind := controller.jump_kind_option.get_item_index(
|
||||
PathSegment.JumpKind.COMBINATION
|
||||
)
|
||||
controller.jump_kind_option.select(combo_kind)
|
||||
controller.jump_kind_option.item_selected.emit(combo_kind)
|
||||
for index: int in range(controller.jump_second_option.item_count):
|
||||
var metadata: Variant = controller.jump_second_option.get_item_metadata(
|
||||
index
|
||||
)
|
||||
if metadata != null and str(metadata) == "2T":
|
||||
controller.jump_second_option.select(index)
|
||||
controller.jump_second_option.item_selected.emit(index)
|
||||
break
|
||||
elif args.size() > 3 and args[3] == "adultgold":
|
||||
controller.set_adult_category("gold")
|
||||
controller.open_validation_dialog()
|
||||
|
|
|
|||
|
|
@ -33,6 +33,7 @@ func _init() -> void:
|
|||
_test_gold_limits()
|
||||
_test_valid_gold()
|
||||
_test_duration_and_repetitions()
|
||||
_test_structured_jump()
|
||||
_test_unknown_category()
|
||||
_finish()
|
||||
|
||||
|
|
@ -187,8 +188,26 @@ func _test_valid_gold() -> void:
|
|||
func _test_duration_and_repetitions() -> void:
|
||||
var routine := _make_routine("gold")
|
||||
var section := routine.sections[0]
|
||||
for code: String in ["2T", "2T", "2T", "2S+2S", "2Lo+2Lo", "2T+2T"]:
|
||||
for code: String in ["2T", "2T", "2T"]:
|
||||
_add_jump(section, code)
|
||||
_add_jump(
|
||||
section,
|
||||
"2S",
|
||||
PathSegment.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2S"])
|
||||
)
|
||||
_add_jump(
|
||||
section,
|
||||
"2Lo",
|
||||
PathSegment.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2Lo"])
|
||||
)
|
||||
_add_jump(
|
||||
section,
|
||||
"2T",
|
||||
PathSegment.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2T"])
|
||||
)
|
||||
_set_total_duration(section, 200.0)
|
||||
|
||||
var report := _validator.validate_report(routine)
|
||||
|
|
@ -209,6 +228,39 @@ func _test_duration_and_repetitions() -> void:
|
|||
_check(_has_message(report, "Kürdauer"), "duration message")
|
||||
|
||||
|
||||
func _test_structured_jump() -> void:
|
||||
var routine := _make_routine("gold")
|
||||
var section := routine.sections[0]
|
||||
_add_jump(
|
||||
section,
|
||||
"2T",
|
||||
PathSegment.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2S"])
|
||||
)
|
||||
_add_jump(
|
||||
section,
|
||||
"1A",
|
||||
PathSegment.JumpKind.SEQUENCE,
|
||||
PackedStringArray(["2T"])
|
||||
)
|
||||
_set_total_duration(section, 170.0)
|
||||
|
||||
var report := _validator.validate_report(routine)
|
||||
_check(
|
||||
report.get_check("category_combinations").passed == 1,
|
||||
"one combination and one sequence fit the Gold limit"
|
||||
)
|
||||
_check(
|
||||
report.get_check("category_repetitions").passed == 1,
|
||||
"structured combination parts count towards repetitions"
|
||||
)
|
||||
_check_approx(
|
||||
report.base_value_total,
|
||||
5.00,
|
||||
"structured combination and sequence base values are summed"
|
||||
)
|
||||
|
||||
|
||||
func _test_unknown_category() -> void:
|
||||
var routine := _make_routine("unknown")
|
||||
var report := _validator.validate_report(routine)
|
||||
|
|
@ -230,11 +282,17 @@ func _make_routine(category: String) -> Routine:
|
|||
return routine
|
||||
|
||||
|
||||
func _add_jump(section: RoutineSection, code: String) -> PathSegment:
|
||||
func _add_jump(
|
||||
section: RoutineSection,
|
||||
code: String,
|
||||
kind: PathSegment.JumpKind = PathSegment.JumpKind.SOLO,
|
||||
extras: PackedStringArray = PackedStringArray()
|
||||
) -> PathSegment:
|
||||
var segment: PathSegment = PathSegmentModel.new()
|
||||
segment.segment_id = "jump-%d" % section.segments.size()
|
||||
segment.curve = _make_point_curve(Vector2.ZERO)
|
||||
segment.set_element(PathSegment.ElementType.JUMP, code, 0)
|
||||
segment.set_jump_combination(kind, extras)
|
||||
section.segments.append(segment)
|
||||
return segment
|
||||
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ func _init() -> void:
|
|||
_test_rink_geometry()
|
||||
_test_segment_timing()
|
||||
_test_element_markers()
|
||||
_test_jump_combinations()
|
||||
_test_section_aggregation()
|
||||
_test_routine_validation()
|
||||
_finish()
|
||||
|
|
@ -287,6 +288,80 @@ func _test_element_markers() -> void:
|
|||
)
|
||||
|
||||
|
||||
func _test_jump_combinations() -> void:
|
||||
var jump: PathSegment = PathSegmentModel.new()
|
||||
jump.segment_id = "seg-combination"
|
||||
var curve := Curve2D.new()
|
||||
curve.add_point(Vector2(0.0, 0.0))
|
||||
jump.curve = curve
|
||||
jump.set_element(PathSegmentModel.ElementType.JUMP, "3Lz", 0)
|
||||
|
||||
jump.set_jump_combination(
|
||||
PathSegmentModel.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2T"])
|
||||
)
|
||||
_check(jump.get_element_caption() == "3Lz+2T", "combination caption")
|
||||
_check(
|
||||
jump.get_jump_parts() == PackedStringArray(["3Lz", "2T"]),
|
||||
"combination parts"
|
||||
)
|
||||
_check(jump.is_valid(), "two-jump combination is valid")
|
||||
|
||||
jump.set_jump_combination(
|
||||
PathSegmentModel.JumpKind.SEQUENCE,
|
||||
PackedStringArray(["2A", "2T"])
|
||||
)
|
||||
_check(
|
||||
jump.get_element_caption() == "3Lz+2A+2T+SEQ",
|
||||
"sequence caption"
|
||||
)
|
||||
_check(jump.get_jump_parts().size() == 3, "three-jump sequence parts")
|
||||
_check(jump.is_valid(), "three-jump sequence is valid")
|
||||
|
||||
jump.set_jump_combination(
|
||||
PathSegmentModel.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2T", "2Lo", "2S"])
|
||||
)
|
||||
_check(
|
||||
jump.get_jump_parts().size() == PathSegmentModel.JUMP_MAX_PARTS,
|
||||
"combinations are capped at three jumps"
|
||||
)
|
||||
_check(jump.is_valid(), "capped combination is valid")
|
||||
|
||||
jump.combination_jumps = PackedStringArray(["2T", "2Lo", "2S"])
|
||||
_check(
|
||||
not jump.is_valid()
|
||||
and _contains_error(jump.validate(), "must not exceed 3 jumps"),
|
||||
"more than three jumps are rejected"
|
||||
)
|
||||
|
||||
jump.jump_kind = PathSegmentModel.JumpKind.SOLO
|
||||
jump.combination_jumps = PackedStringArray(["2T"])
|
||||
_check(
|
||||
not jump.is_valid()
|
||||
and _contains_error(jump.validate(), "combination jumps need"),
|
||||
"solo jumps reject extra combination jumps"
|
||||
)
|
||||
|
||||
jump.set_element(PathSegmentModel.ElementType.SPIN, "CCoSp", 2)
|
||||
_check(
|
||||
jump.jump_kind == PathSegmentModel.JumpKind.SOLO
|
||||
and jump.combination_jumps.is_empty(),
|
||||
"changing to a spin clears jump combination fields"
|
||||
)
|
||||
|
||||
jump.set_element(PathSegmentModel.ElementType.JUMP, "3Lz", 0)
|
||||
jump.set_jump_combination(
|
||||
PathSegmentModel.JumpKind.COMBINATION,
|
||||
PackedStringArray()
|
||||
)
|
||||
_check(
|
||||
not jump.is_valid()
|
||||
and _contains_error(jump.validate(), "needs at least one more jump"),
|
||||
"an empty combination is rejected"
|
||||
)
|
||||
|
||||
|
||||
func _test_section_aggregation() -> void:
|
||||
var section: RoutineSection = RoutineSectionModel.new()
|
||||
section.section_id = "section-steps"
|
||||
|
|
|
|||
|
|
@ -259,6 +259,40 @@ func _test_segment_integration() -> void:
|
|||
"segment integration resolves a choreographic spin"
|
||||
)
|
||||
|
||||
var combo: PathSegment = PathSegmentModel.new()
|
||||
combo.segment_id = "combo"
|
||||
combo.curve = _make_point_curve(Vector2.ZERO)
|
||||
combo.set_element(PathSegment.ElementType.JUMP, "3Lz", 0)
|
||||
combo.set_jump_combination(
|
||||
PathSegment.JumpKind.COMBINATION,
|
||||
PackedStringArray(["2T"])
|
||||
)
|
||||
_check_approx(
|
||||
_catalog.get_segment_base_value(combo),
|
||||
7.20,
|
||||
"structured combination sums 3Lz + 2T"
|
||||
)
|
||||
|
||||
combo.set_jump_combination(
|
||||
PathSegment.JumpKind.SEQUENCE,
|
||||
PackedStringArray(["2A", "2T"])
|
||||
)
|
||||
_check_approx(
|
||||
_catalog.get_segment_base_value(combo),
|
||||
10.50,
|
||||
"structured sequence sums 3Lz + 2A + 2T"
|
||||
)
|
||||
|
||||
var legacy_combo: PathSegment = PathSegmentModel.new()
|
||||
legacy_combo.segment_id = "legacy-combo"
|
||||
legacy_combo.curve = _make_point_curve(Vector2.ZERO)
|
||||
legacy_combo.set_element(PathSegment.ElementType.JUMP, "3Lz+2T", 0)
|
||||
_check_approx(
|
||||
_catalog.get_segment_base_value(legacy_combo),
|
||||
7.20,
|
||||
"legacy free-text combination still sums its jumps"
|
||||
)
|
||||
|
||||
var jump: PathSegment = PathSegmentModel.new()
|
||||
jump.segment_id = "jump"
|
||||
jump.curve = _make_point_curve(Vector2.ZERO)
|
||||
|
|
|
|||
|
|
@ -1397,6 +1397,56 @@ func _run() -> void:
|
|||
)
|
||||
controller.validation_dialog.hide()
|
||||
|
||||
# Structured jump combination in the element dialog.
|
||||
controller.new_routine()
|
||||
var combo_marker := controller.add_element_marker(
|
||||
Vector2(0.0, 0.0),
|
||||
PathSegment.ElementType.JUMP,
|
||||
"2T",
|
||||
0
|
||||
)
|
||||
controller.select_segment(combo_marker.segment_id)
|
||||
controller.element_button.pressed.emit()
|
||||
_check(
|
||||
controller.jump_combination_box.visible,
|
||||
"the jump combination controls are visible for jumps"
|
||||
)
|
||||
var combo_kind_index := controller.jump_kind_option.get_item_index(
|
||||
PathSegment.JumpKind.COMBINATION
|
||||
)
|
||||
controller.jump_kind_option.select(combo_kind_index)
|
||||
controller.jump_kind_option.item_selected.emit(combo_kind_index)
|
||||
_check(
|
||||
controller.jump_second_option.visible,
|
||||
"choosing a combination reveals the second jump"
|
||||
)
|
||||
_select_option_by_metadata(controller.jump_second_option, "2S")
|
||||
_check(
|
||||
controller.element_value_label.text.contains("2,60"),
|
||||
"the dialog base value sums the combination jumps"
|
||||
)
|
||||
controller.element_dialog.confirmed.emit()
|
||||
controller.element_dialog.hide()
|
||||
_check(
|
||||
combo_marker.get_element_caption() == "2T+2S",
|
||||
"the confirmed marker stores a structured combination"
|
||||
)
|
||||
_check_approx(
|
||||
controller.get_element_catalog().get_segment_base_value(combo_marker),
|
||||
2.60,
|
||||
"the structured combination has the summed base value"
|
||||
)
|
||||
_check(controller.undo(), "the structured combination can be undone")
|
||||
combo_marker = controller.get_active_section().get_segment_by_id(
|
||||
combo_marker.segment_id
|
||||
)
|
||||
_check(
|
||||
combo_marker != null
|
||||
and combo_marker.combination_jumps.is_empty()
|
||||
and combo_marker.get_element_caption() == "2T",
|
||||
"undo restores the solo jump"
|
||||
)
|
||||
|
||||
controller.help_button.pressed.emit()
|
||||
_check(controller.help_dialog.visible, "help button opens the help dialog")
|
||||
_check(
|
||||
|
|
@ -1419,6 +1469,18 @@ func _check(condition: bool, message: String) -> void:
|
|||
_failures.append(message)
|
||||
|
||||
|
||||
func _select_option_by_metadata(
|
||||
option: OptionButton,
|
||||
code: String
|
||||
) -> void:
|
||||
for index: int in range(option.item_count):
|
||||
var metadata: Variant = option.get_item_metadata(index)
|
||||
if metadata != null and str(metadata) == code:
|
||||
option.select(index)
|
||||
option.item_selected.emit(index)
|
||||
return
|
||||
|
||||
|
||||
func _select_dialog_code(
|
||||
controller: WhiteboardController,
|
||||
code: String
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue