scenario load: preserve control values across a port-set change - #2111
scenario load: preserve control values across a port-set change#2111bltzr wants to merge 2 commits into
Conversation
When an avnd process's port count changes (e.g. an updated add-on that gained a port), opening an existing scenario runs ProcessModel::check_all_ports(), which recreates the ports with default values and migrates the saved data via the 3-arg reloadPortsInNewProcess(). That path called loadData() without DontReloadValue, so ControlInlet::loadData dropped every value and the process reloaded with all defaults (soundfile path blank, every control reset to its init value). Pass DontReloadValue there, exactly as LoadPresetCommand already does, so a matched port (guarded by type()==type() && name()==name()) keeps its value. This is the same fix as 6fed47b ("presets: fix that values sometimes did not reload"), applied to the scenario-load migration path. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AvD2PFHZtW6pfsh3gGhayg
jcelerier
left a comment
There was a problem hiding this comment.
need to test this as there's various cases in which this could break
| { | ||
| new_p->loadData(old_p.data); | ||
| // Preserve values across a port-set change (e.g. an updated add-on that | ||
| // gained a port): without DontReloadValue, loadData drops the value and |
There was a problem hiding this comment.
Can you ask Claude to not put this kind of slop comments ? 😁
Review feedback on ossia#2111: the multi-line rationale block was excessive; keep a single line stating the intent. Co-Authored-By: Claude <noreply@anthropic.com>
|
Comment trimmed (9bf42e5). On the cases that could break — the restore only fires inside the pre-existing positional guard (
Side note found while auditing: since 03ef545 the flag reads inverted — passing |
|
@claude fix the broken build due to changed flag |
Problem
When an avnd process's port count changes — e.g. an add-on gains a new port in an update — opening a scenario saved with the older version reloads that process with every value reset to default (soundfile path blank, all controls back to their init values). This breaks backward-compat for any existing document once an object grows a port.
Cause
The count mismatch makes
ProcessModel::check_all_ports()recreate the ports (with default values) and migrate the saved data through the 3-argDataflow::reloadPortsInNewProcess(). That path calledloadData(old_p.data)withoutDontReloadValue, andControlInlet::loadDatadrops the value unless that flag is set — so the recreated ports keep their defaults.Fix
Pass
Process::PortLoadDataFlags::DontReloadValuein that migration, exactly asLoadPresetCommandalready does. It's guarded by the existingtype()==type() && name()==name()match, so a value is only ever restored into an identical port.This is the same fix as 6fed47b ("presets: fix that values sometimes did not reload"), applied to the scenario-load migration path rather than the preset path.
🤖 Generated with Claude Code
https://claude.ai/code/session_01AvD2PFHZtW6pfsh3gGhayg