avnd ui: resolve file-path templates before syncing them to custom items - #2114
avnd ui: resolve file-path templates before syncing them to custom items#2114bltzr wants to merge 2 commits into
Conversation
File-chooser port values are stored in the document as path templates (<PROJECT>:..., <LIBRARY>:..., or document-relative). Score's own file widgets resolve them via score::locateFilePath, but the avnd layout builder pushed the raw template string into custom ui items' `value`, so an add-on widget bound to a soundfile/file/folder port received a path it could not use (e.g. a waveform widget that decodes the file in edit mode could never find it after the document moved or used project-relative paths). Resolve through score::locateFilePath in setupControl, both for the initial sync and in the valueChanged connections, whenever the inlet is a FileChooserBase or FolderChooser and the value is a non-empty string. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AvD2PFHZtW6pfsh3gGhayg
|
I think this is the reason why Granola's sound file port would not load the waveform at scenario load. |
| using avnd_port_type = pmf_member_type_t<decltype(item.model)>; | ||
| avnd_port_type p; | ||
| oscr::from_ossia_value(p, inl->value(), item.value); | ||
| oscr::from_ossia_value(p, resolveFilePath(inl->value(), inl, doc), item.value); |
There was a problem hiding this comment.
arf, this is incurring the qobject_cast cost *2 on every widget creation, that's not great :/
There was a problem hiding this comment.
the correct way here would be to do it statically: from avnd_port_type we know whether something is a file port, folder port, or something else. I'd add a separate "SetGUIValue" struct that follows the existing patterns for pattern-matching avendish port types at compile-time with concepts
There was a problem hiding this comment.
This way instead of being done at run-time it is done 100% at compile-time
Address review: replace the per-widget qobject_cast checks with a SetGUIValue struct specialized through avendish port concepts (soundfile_port, midifile_port, file_port, folder widget), so the file/folder-only path resolution is selected at compile time. Co-Authored-By: Claude <noreply@anthropic.com>
|
Reworked as suggested (6446921): the runtime One conscious delta: |
Problem
File-chooser port values are stored in the document as path templates (
<PROJECT>:...,<LIBRARY>:..., or document-relative). Score's own file widgets resolve them throughscore::locateFilePath, but the avnd layout builder pushed the raw template string into custom UI items'value.So an add-on widget bound to a soundfile/file/folder port received a path it cannot use — e.g. a waveform widget that decodes the file to display it in edit mode could never find
<PROJECT>:samples/foo.wav. Values worked during execution only because the engine resolves paths on its own side, which made panels that depend on the path (waveform displays, folder pickers) appear empty until playback started.Fix
Resolve through
score::locateFilePathinLayoutBuilder::setupControl, both for the initial sync and in thevalueChangedconnections, whenever the inlet is aProcess::FileChooserBaseorProcess::FolderChooserand the value is a non-empty string. Other value types and non-file ports are untouched.Verified with an avnd add-on (Granola) whose custom waveform widget decodes the Sound port's file: with this change the widget receives
/abs/path/samples/foo.wavat document load and can display the waveform in edit mode, matching the behavior of score's built-in file widgets.🤖 Generated with Claude Code
https://claude.ai/code/session_01AvD2PFHZtW6pfsh3gGhayg