diff --git a/Packages/com.chocopoi.vrc.avatarlib b/Packages/com.chocopoi.vrc.avatarlib index 6da88b8a..21becb07 160000 --- a/Packages/com.chocopoi.vrc.avatarlib +++ b/Packages/com.chocopoi.vrc.avatarlib @@ -1 +1 @@ -Subproject commit 6da88b8aa56ae282c62d42b57399ce17cf1b67a3 +Subproject commit 21becb073746bfbccac942077b9e2e6c3177ce17 diff --git a/Packages/com.chocopoi.vrc.dressingtools/Editor/UI/Presenters/Modules/AnimationGenerationWearableModuleEditorPresenter.cs b/Packages/com.chocopoi.vrc.dressingtools/Editor/UI/Presenters/Modules/AnimationGenerationWearableModuleEditorPresenter.cs index 06260501..73909230 100644 --- a/Packages/com.chocopoi.vrc.dressingtools/Editor/UI/Presenters/Modules/AnimationGenerationWearableModuleEditorPresenter.cs +++ b/Packages/com.chocopoi.vrc.dressingtools/Editor/UI/Presenters/Modules/AnimationGenerationWearableModuleEditorPresenter.cs @@ -286,17 +286,22 @@ private void UpdateToggles(Transform root, List toggles, List + { + "---" + }; + if (mesh == null) { - return null; + return names.ToArray(); } - string[] names = new string[mesh.blendShapeCount]; - for (var i = 0; i < names.Length; i++) + for (var i = 0; i < mesh.blendShapeCount; i++) { - names[i] = mesh.GetBlendShapeName(i); + names.Add(mesh.GetBlendShapeName(i)); } - return names; + + return names.ToArray(); } private void UpdateBlendshapes(Transform root, List blendshapes, List blendshapeDataList, Action updateView = null) @@ -341,10 +346,11 @@ private void UpdateBlendshapes(Transform root, List bl blendshapeData.availableBlendshapeNames = GetBlendshapeNames(newMesh); blendshapeData.selectedBlendshapeIndex = 0; blendshapeData.value = 0; + blendshapeData.isInvalid = true; - blendshape.blendshapeName = blendshapeData.availableBlendshapeNames[blendshapeData.selectedBlendshapeIndex]; - blendshape.value = blendshapeData.value; - _parentView.UpdateAvatarPreview(); + // blendshape.blendshapeName = blendshapeData.availableBlendshapeNames[blendshapeData.selectedBlendshapeIndex]; + // blendshape.value = blendshapeData.value; + // _parentView.UpdateAvatarPreview(); } else { @@ -353,8 +359,15 @@ private void UpdateBlendshapes(Transform root, List bl }; blendshapeData.blendshapeNameChangeEvent = () => { - blendshape.blendshapeName = blendshapeData.availableBlendshapeNames[blendshapeData.selectedBlendshapeIndex]; - _parentView.UpdateAvatarPreview(); + if (blendshapeData.selectedBlendshapeIndex != 0) + { + blendshape.blendshapeName = blendshapeData.availableBlendshapeNames[blendshapeData.selectedBlendshapeIndex]; + _parentView.UpdateAvatarPreview(); + } + else + { + blendshapeData.isInvalid = true; + } }; blendshapeData.sliderChangeEvent = () => { @@ -612,6 +625,7 @@ private void UpdateCustomizables() { _module.wearableCustomizables.Remove(wearable); _view.Customizables.Remove(customizableData); + UpdateCustomizableAvatarTogglesAndBlendshapes(wearable, customizableData); }; customizableData.customizableSettingsChangeEvent = () => diff --git a/Packages/com.chocopoi.vrc.dressingtools/Editor/UI/Views/Modules/AnimationGenerationWearableModuleEditor.cs b/Packages/com.chocopoi.vrc.dressingtools/Editor/UI/Views/Modules/AnimationGenerationWearableModuleEditor.cs index e88e0137..1dcf46c1 100644 --- a/Packages/com.chocopoi.vrc.dressingtools/Editor/UI/Views/Modules/AnimationGenerationWearableModuleEditor.cs +++ b/Packages/com.chocopoi.vrc.dressingtools/Editor/UI/Views/Modules/AnimationGenerationWearableModuleEditor.cs @@ -259,6 +259,11 @@ private void DrawCustomizable(CustomizableViewData customizable) BeginFoldoutBoxWithButtonRight(ref customizable.foldout, customizable.name, "x Remove", customizable.removeButtonClickEvent); if (customizable.foldout) { + if (customizable.IsInvalid()) + { + HelpBox("This customizable is invalid.", MessageType.Error); + } + TextField("Name", ref customizable.name, customizable.customizableSettingsChangeEvent); Popup("Type:", ref customizable.type, new string[] { "Toggle", "Blendshape" }, customizable.customizableSettingsChangeEvent); diff --git a/Packages/com.chocopoi.vrc.dressingtools/Editor/UIBase/Views/Modules/IAnimationGenerationWearableModuleEditorView.cs b/Packages/com.chocopoi.vrc.dressingtools/Editor/UIBase/Views/Modules/IAnimationGenerationWearableModuleEditorView.cs index e35bc49d..f3b31b95 100644 --- a/Packages/com.chocopoi.vrc.dressingtools/Editor/UIBase/Views/Modules/IAnimationGenerationWearableModuleEditorView.cs +++ b/Packages/com.chocopoi.vrc.dressingtools/Editor/UIBase/Views/Modules/IAnimationGenerationWearableModuleEditorView.cs @@ -155,6 +155,35 @@ public CustomizableViewData() addWearableBlendshapeEvent = null; removeButtonClickEvent = null; } + + public bool IsInvalid() + { + var result = false; + + result |= name == null || name == ""; + + foreach (var toggle in avatarToggles) + { + result |= toggle.isInvalid; + } + + foreach (var toggle in wearableToggles) + { + result |= toggle.isInvalid; + } + + foreach (var blendshape in avatarBlendshapes) + { + result |= blendshape.isInvalid; + } + + foreach (var blendshape in wearableBlendshapes) + { + result |= blendshape.isInvalid; + } + + return result; + } } internal interface IAnimationGenerationWearableModuleEditorView : IEditorView