avnd ui: resolve file-path templates before syncing them to custom items#2114
Open
bltzr wants to merge 1 commit into
Open
avnd ui: resolve file-path templates before syncing them to custom items#2114bltzr wants to merge 1 commit into
bltzr wants to merge 1 commit 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
Member
Author
|
I think this is the reason why Granola's sound file port would not load the waveform at scenario load. |
jcelerier
reviewed
Jul 13, 2026
| 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); |
Member
There was a problem hiding this comment.
arf, this is incurring the qobject_cast cost *2 on every widget creation, that's not great :/
Member
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
Member
There was a problem hiding this comment.
This way instead of being done at run-time it is done 100% at compile-time
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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