Model emotional arc and production directions

This commit is contained in:
Codex
2026-09-13 13:48:05 +02:00
parent 20c541421f
commit ece652b2e4
3 changed files with 99 additions and 1 deletions
@@ -186,6 +186,46 @@ public extension SongProject {
maqam = ManualAutoValue(mode: .auto)
}
func emotionalArcPoint(for pointID: String) -> EmotionalArcPoint? {
emotionalArc.first { $0.id == pointID }
}
func emotionalArcPoints(forSectionID sectionID: String) -> [EmotionalArcPoint] {
emotionalArc.filter { $0.sectionID == sectionID }
}
mutating func upsertEmotionalArcPoint(_ point: EmotionalArcPoint) {
if let index = emotionalArc.firstIndex(where: { $0.id == point.id }) {
emotionalArc[index] = point
} else {
emotionalArc.append(point)
}
}
mutating func removeEmotionalArcPoint(id pointID: String) {
emotionalArc.removeAll { $0.id == pointID }
}
func productionDirection(for directionID: String) -> ProductionDirection? {
productionDirections.first { $0.id == directionID }
}
func productionDirections(forSectionID sectionID: String) -> [ProductionDirection] {
productionDirections.filter { $0.sectionID == sectionID }
}
mutating func upsertProductionDirection(_ direction: ProductionDirection) {
if let index = productionDirections.firstIndex(where: { $0.id == direction.id }) {
productionDirections[index] = direction
} else {
productionDirections.append(direction)
}
}
mutating func removeProductionDirection(id directionID: String) {
productionDirections.removeAll { $0.id == directionID }
}
var selectedInstrumentTracks: [InstrumentTrack] {
instruments.filter(\.selected)
}