Skip to content

Commit a96faa9

Browse files
committed
feat: generated path concat avatar name
1 parent 73909ec commit a96faa9

File tree

7 files changed

+40
-8
lines changed

7 files changed

+40
-8
lines changed

Assets/UnityBox/AdvancedCostumeController/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [0.2.0] - 2026-02-23
4+
5+
### Added
6+
7+
- 生成路径自动追加当前 Avatar 名称作为子目录,防止切换不同 Avatar 生成时互相覆盖
8+
39
## [0.1.1] - 2026-02-23
410

511
### Fixed

Assets/UnityBox/AdvancedCostumeController/Editor/AnimationBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ private AnimationClip CreateBaseClip()
494494

495495
private string EnsureAnimFolder(string subfolder = null)
496496
{
497-
string folder = Path.Combine(config.GeneratedFolder, "Animations");
497+
string folder = Path.Combine(config.GetResolvedGeneratedFolder(), "Animations");
498498
if (!string.IsNullOrEmpty(subfolder))
499499
folder = Path.Combine(folder, subfolder);
500500
if (!Directory.Exists(folder))

Assets/UnityBox/AdvancedCostumeController/Editor/Generator.cs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ public void Execute(
3131
Dictionary<GameObject, int> outfitIndexMap,
3232
OutfitData defaultOutfit)
3333
{
34-
string controllerPath = Path.Combine(config.GeneratedFolder, "CostumeController.controller").Replace("\\", "/");
34+
var resolvedFolder = config.GetResolvedGeneratedFolder();
35+
string controllerPath = Path.Combine(resolvedFolder, "CostumeController.controller").Replace("\\", "/");
3536
if (File.Exists(controllerPath))
3637
{
3738
if (!EditorUtility.DisplayDialog("覆盖确认",
@@ -70,9 +71,9 @@ public void Execute(
7071
}
7172

7273
EditorUtility.DisplayProgressBar("生成中", "创建动画控制器...", 0.7f);
73-
if (!Directory.Exists(config.GeneratedFolder))
74+
if (!Directory.Exists(resolvedFolder))
7475
{
75-
Directory.CreateDirectory(config.GeneratedFolder);
76+
Directory.CreateDirectory(resolvedFolder);
7677
AssetDatabase.Refresh();
7778
}
7879

@@ -210,7 +211,7 @@ private bool ShowPreflightDialog(List<OutfitData> outfits, OutfitData defaultOut
210211
sb.AppendLine("即将生成,摘要:");
211212
sb.AppendLine($"- 服装数量:{outfits.Count}");
212213
sb.AppendLine($"- 部件数量:{outfits.Sum(o => o.Parts.Count)}");
213-
sb.AppendLine($"- 输出目录:{config.GeneratedFolder}");
214+
sb.AppendLine($"- 输出目录:{config.GetResolvedGeneratedFolder()}");
214215
sb.AppendLine($"- 默认服装:{defaultOutfit?.Name ?? "未设置"}");
215216
if (config.EnableCustomMixer)
216217
sb.AppendLine($"- 混搭模式:已启用 ({config.CustomMixerName})");

Assets/UnityBox/AdvancedCostumeController/Editor/Models.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Collections.Generic;
22
using UnityEngine;
3+
using VRC.SDK3.Avatars.Components;
34

45
namespace UnityBox.AdvancedCostumeController
56
{
@@ -59,5 +60,25 @@ public class ACCConfig
5960
public bool EnableParts = false;
6061
public bool EnableCustomMixer = false;
6162
public string CustomMixerName = "CustomMix";
63+
64+
/// <summary>
65+
/// 获取实际的生成目录(在 GeneratedFolder 后追加当前 Avatar 名称)
66+
/// 防止切换不同 Avatar 生成时互相覆盖
67+
/// </summary>
68+
public string GetResolvedGeneratedFolder()
69+
{
70+
string avatarName = null;
71+
if (CostumesRoot != null)
72+
{
73+
var descriptor = CostumesRoot.GetComponentInParent<VRCAvatarDescriptor>();
74+
if (descriptor != null)
75+
avatarName = descriptor.gameObject.name;
76+
else
77+
avatarName = CostumesRoot.transform.root.gameObject.name;
78+
}
79+
if (string.IsNullOrEmpty(avatarName))
80+
return GeneratedFolder;
81+
return GeneratedFolder.TrimEnd('/') + "/" + avatarName;
82+
}
6283
}
6384
}

Assets/UnityBox/AdvancedCostumeController/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "top.sealoong.unitybox.advanced-costume-controller",
33
"displayName": "Advanced Costume Controller",
4-
"version": "0.1.1",
4+
"version": "0.2.0",
55
"description": "A VRChat avatar editor tool for quickly setting up costume/outfit switching with Modular Avatar menus and animations.",
66
"unity": "2022.3",
77
"author": {

Assets/UnityBox/BlendshapeControllerGenerator/Editor/BlendshapeControllerGenerator.cs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -517,7 +517,11 @@ private void Generate()
517517
private bool GenerateForMesh(SkinnedMeshRenderer mr, List<string> names, List<bool> sels, List<BlendParamType> types, List<bool> inverts, List<float> offs, List<float> ons, int clipIndexOffset, int totalClips, string usePrefix)
518518
{
519519
string meshName = mr != null ? mr.gameObject.name : "Mesh";
520-
string meshSubFolder = Path.Combine(outputFolder, meshName).Replace("\\", "/");
520+
// 在输出目录后追加 Avatar 名称,防止多个 Avatar 生成时互相覆盖
521+
string resolvedOutputFolder = avatarRoot != null
522+
? Path.Combine(outputFolder, avatarRoot.name).Replace("\\", "/")
523+
: outputFolder;
524+
string meshSubFolder = Path.Combine(resolvedOutputFolder, meshName).Replace("\\", "/");
521525
string baseControllerNameForFile = string.IsNullOrWhiteSpace(controllerName) ? meshName : Path.GetFileNameWithoutExtension(controllerName);
522526
string controllerPath = Path.Combine(meshSubFolder, baseControllerNameForFile + ".controller").Replace("\\", "/");
523527
string baseControllerNameForMenu = meshName;

Assets/UnityBox/BlendshapeControllerGenerator/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "top.sealoong.unitybox.blendshape-controller-generator",
33
"displayName": "Blendshape Controller Generator",
4-
"version": "0.1.0",
4+
"version": "0.1.1",
55
"description": "A VRChat avatar editor tool for generating blendshape animation controllers with Modular Avatar integration.",
66
"unity": "2022.3",
77
"author": {

0 commit comments

Comments
 (0)