Add external renderer plugin API - #2340
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
Renderers.GetDefaultRenderer does not honor newly listed external renderer defaults from Preferences, making the new default-renderer option ineffective.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR introduces an external renderer plugin API (v1 public preview), adding discovery/identity for external renderers, exposing renderer-declared capabilities/expressions/analysis/cache services, and integrating those renderers into both UI selection and singer/oto workflows.
Changes:
- Add external renderer discovery/registry plus plugin surface types (metadata, analysis provider, cache/analysis services).
- Integrate stable renderer IDs into track settings selection and render-phrase hashing.
- Add UI entry point to generate renderer-provided analysis files and add targeted registry/compatibility tests.
File summaries
| File | Description |
|---|---|
| OpenUtau/Views/SingersDialog.axaml.cs | Adds a context-menu flow for generating external renderer analysis from selected oto sources. |
| OpenUtau/Views/SingersDialog.axaml | Adds a context menu entry for “Generate renderer analysis”. |
| OpenUtau/ViewModels/TrackHeaderViewModel.cs | Updates renderer selection menu to use stable renderer IDs; adds error handling around renderer selection. |
| OpenUtau/Strings/Strings.axaml | Adds localized strings for renderer analysis generation UI. |
| OpenUtau.Test/Render/ExternalRendererRegistryTest.cs | Adds unit tests covering discovery, identity, analysis generation, and runtime/manifest compatibility checks. |
| OpenUtau.Core/Ustx/UTrack.cs | Enhances render settings validation with stable renderer identity + controlled fallback and load error reporting. |
| OpenUtau.Core/Render/RenderPhrase.cs | Switches render cache hash contribution to stable renderer ID rather than ToString(). |
| OpenUtau.Core/Render/Renderers.cs | Adds renderer options (Id/Name), external renderer integration, and stable renderer identity helpers. |
| OpenUtau.Core/Render/ExternalRendererRegistry.cs | Introduces the external renderer registry: discovery, loading, analysis orchestration, and collectible load contexts. |
| OpenUtau.Core/Render/ExternalRendererPlugin.cs | Adds the public plugin API types: attribute, metadata, analysis provider interfaces, and cache/analysis services. |
| OpenUtau.Core/Commands/TrackCommands.cs | Makes renderer changes fail-fast (no silent fallback) when explicitly selecting a renderer. |
| OpenUtau.Core/Classic/ToolsManager.cs | Hooks external renderer discovery into the resampler search path. |
| OpenUtau.Core/Classic/ResamplerManifest.cs | Extends YAML manifest model to include renderer + analysis metadata blocks. |
| OpenUtau.Core/Classic/ResamplerItem.cs | Allows injecting a resampler override for classic rendering paths. |
| OpenUtau.Core/Classic/ExeResampler.cs | Makes ExeResampler public (for broader use/interop). |
| OpenUtau.Core/Classic/ClassicRenderer.cs | Adds resampler override support and renderer name override to keep stable identity. |
Review details
Suppressed comments (1)
OpenUtau.Core/Render/Renderers.cs:68
GetDefaultRenderercurrently only honors the "Classic" preference; aftergetRendererOptions()started listing external renderer IDs, selecting an external default renderer in Preferences will still fall back to the first supported renderer. This makes the new preference option ineffective.
public static string GetDefaultRenderer(USingerType singerType) {
if (Preferences.Default.DefaultRenderer == "Classic" && singerType == USingerType.Classic) {
return CLASSIC;
} else {
return GetSupportedRenderers(singerType)[0];
- Files reviewed: 16/16 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
🟡 Changes recommended
It contains confirmed resource-lifetime and robustness issues (renderer disposal on settings replacement and null/malformed plugin results crashing the host) that should be addressed before approval.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Review details
Suppressed comments (1)
OpenUtau.Core/Commands/TrackCommands.cs:165
- Undoing a renderer change also replaces track.RendererSettings without disposing the current Renderer instance, which can keep external renderer load contexts alive and prevent plugin cleanup/unload.
public override void Unexecute() {
var settings = oldSettings.Clone();
settings.Validate(track);
track.RendererSettings = settings;
}
- Files reviewed: 16/16 changed files
- Comments generated: 2
- Review effort level: Lite
…7/OpenUtau into external-renderer-api
…-api # Conflicts: # OpenUtau.Core/Render/RenderPhrase.cs # OpenUtau.Core/Ustx/UTrack.cs
Summary
This introduces API version 1 as a public preview for renderer developers.