fix(camera-ai): auto-prefer bundled runtime

This commit is contained in:
KINDNICK 2026-08-07 01:21:47 +09:00
parent 36ae6f11c4
commit 2f71eecfd0
3 changed files with 46 additions and 18 deletions

View File

@ -208,3 +208,6 @@
- Added a self-contained `RuntimeData~` reference bundle (263 prepared songs).
- The packaged worker auto-discovers the bundle; raw CW-AI source audio and a separate checkout are no longer required for generation.
- Generation caches remain project-local and writable.
## 0.4.4
- Automatically prefers bundled `RuntimeData~`, including Unity Git PackageCache installs, over stale serialized external roots.

View File

@ -4182,24 +4182,18 @@ namespace Streamingle.Editor
var normalizedProjectRoot = string.IsNullOrWhiteSpace(projectRoot)
? Environment.CurrentDirectory
: Path.GetFullPath(projectRoot);
var candidates = new[]
{
configuredRoot,
// Self-contained package install: RuntimeData~ is shipped
// beside the editor scripts, so artists do not need a
// separate CW-AI checkout.
Path.Combine(
normalizedProjectRoot,
"Packages",
"com.mingle.cw-ai",
"RuntimeData~"),
var candidates = new List<string>();
// Prefer the self-contained package, including Unity's resolved
// Git PackageCache path. A stale serialized external CW-AI root
// must not silently override the bundled reference library.
candidates.AddRange(EnumeratePackagedRuntimeRoots(normalizedProjectRoot));
candidates.Add(configuredRoot);
candidates.Add(normalizedProjectRoot);
candidates.Add(Path.Combine(
Directory.GetParent(normalizedProjectRoot)?.FullName ??
normalizedProjectRoot,
Path.Combine(
Directory.GetParent(normalizedProjectRoot)?.FullName ??
normalizedProjectRoot,
"CW-AI"),
Environment.CurrentDirectory
};
"CW-AI"));
candidates.Add(Environment.CurrentDirectory);
foreach (var candidate in candidates)
{
@ -4230,6 +4224,37 @@ namespace Streamingle.Editor
"CW-AI");
}
private static IEnumerable<string> EnumeratePackagedRuntimeRoots(
string projectRoot)
{
yield return Path.Combine(
projectRoot,
"Packages",
"com.mingle.cw-ai",
"RuntimeData~");
var packageCache = Path.Combine(projectRoot, "Library", "PackageCache");
if (!Directory.Exists(packageCache))
{
yield break;
}
IEnumerable<string> matches;
try
{
matches = Directory.EnumerateDirectories(
packageCache,
"com.mingle.cw-ai@*",
SearchOption.TopDirectoryOnly);
}
catch (Exception)
{
yield break;
}
foreach (var match in matches.OrderByDescending(path => path))
{
yield return Path.Combine(match, "RuntimeData~");
}
}
private static string ResolveProjectCacheRoot()
{
var projectRoot = Directory.GetParent(Application.dataPath)?.FullName

View File

@ -1,6 +1,6 @@
{
"name": "com.mingle.cw-ai",
"version": "0.4.3",
"version": "0.4.4",
"displayName": "Mingle Camera Work AI",
"description": "Self-contained high-quality Unity Timeline camera generation with an embedded prepared reference library, per-shot editable clips, and A/B review tools.",
"unity": "6000.0",