Apply changes to a typed region as patches to its own header
Instrument.Patches works out the opcode changes that make region i read as an updated Region, checking them against the reader, and Instrument.Apply makes them in the document. Only the changed settings are touched, always in the region's own header, so unknown opcodes and what other regions inherit stay as they are. A change the header can't hold is an error and changes nothing. FlatRegion gains Own, Inherited and Header to trace a region to its source, and regionLines lists a region's opcodes with the field each sets. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -18,6 +18,7 @@ func (f *Flat) Instrument() *Instrument {
|
||||
}
|
||||
curves, stops := readCurves(f.Curves)
|
||||
e := evaluator{cc: controllerValues(f.Control), curves: curves, stops: stops}
|
||||
inst.eval = e
|
||||
regions := make([]Opcodes, len(f.Regions))
|
||||
for i, fr := range f.Regions {
|
||||
ops := fr.Opcodes
|
||||
@@ -33,6 +34,7 @@ func (f *Flat) Instrument() *Instrument {
|
||||
}
|
||||
}
|
||||
inst.Regions = append(inst.Regions, r)
|
||||
inst.sources = append(inst.sources, fr)
|
||||
}
|
||||
inst.Controls = e.controls(f.Control, inst.Regions)
|
||||
inst.Keyswitches = keyswitchRange(regions)
|
||||
|
||||
Reference in New Issue
Block a user