From 1a0b5ae712c67c2bddcb03c3aea33c12000d8925 Mon Sep 17 00:00:00 2001 From: Krysiek Date: Sat, 23 Sep 2023 14:11:51 +0200 Subject: [PATCH] Refactor validation for avatar applier, remove unused GUI code --- .../Service/Applier/AvatarApplierInterface.cs | 9 ++ .../Editor/Service/Applier/CuteLayers.cs | 134 ++++-------------- .../Editor/Service/Applier/CuteParams.cs | 58 +------- .../Editor/Service/Applier/CutePrefab.cs | 60 +------- .../Editor/Service/Applier/CuteSubmenu.cs | 89 +++--------- .../Editor/Service/AvatarApplyService.cs | 2 +- .../Applier => Utils}/AnimatorCloner.cs | 2 + .../Applier => Utils}/AnimatorCloner.cs.meta | 2 +- 8 files changed, 75 insertions(+), 281 deletions(-) rename Packages/pl.krysiek.cutedancer/Editor/{Service/Applier => Utils}/AnimatorCloner.cs (99%) rename Packages/pl.krysiek.cutedancer/Editor/{Service/Applier => Utils}/AnimatorCloner.cs.meta (83%) diff --git a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/AvatarApplierInterface.cs b/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/AvatarApplierInterface.cs index 0f1246c..ddfd1d8 100644 --- a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/AvatarApplierInterface.cs +++ b/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/AvatarApplierInterface.cs @@ -2,11 +2,20 @@ namespace VRF { + public enum ApplyStatus { + EMPTY, + ADD, + REMOVE, + UPDATE, + BLOCKED + } + interface AvatarApplierInterface { void SetAvatar(AvatarDescriptor avatar); void HandleAdd(); void HandleRemove(); + ApplyStatus GetStatus(); } } \ No newline at end of file diff --git a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteLayers.cs b/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteLayers.cs index e5b6e9d..0f64463 100644 --- a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteLayers.cs +++ b/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteLayers.cs @@ -12,95 +12,28 @@ namespace VRF { public class CuteLayers : AvatarApplierInterface { - enum Status - { - FORM, EMPTY, ADDED, MISSING, DIFFERENCE, UNKNOWN - } - // TODO read from build configuration static string ACTION_CTRL = Path.Combine("Assets", "CuteDancer", "Build", "CuteDancer-Action.controller"); static string FX_CTRL = Path.Combine("Assets", "CuteDancer", "Build", "CuteDancer-FX.controller"); - Status validStat = Status.FORM; AvatarDescriptor avatar; AnimatorController actionCtrl; AnimatorController fxCtrl; - bool actionWD = false; - bool fxWD = false; + public bool ActionWD { get; set; } + public bool FxWD { get; set; } - public void RenderForm() + public CuteLayers() { - validStat = Validate(); - - GUIStyle labelStyle = new GUIStyle(EditorStyles.largeLabel); - labelStyle.wordWrap = true; - - GUILayout.Label("Select Action and FX controllers used by your avatar.", EditorStyles.largeLabel); - var newActionCtrl = EditorGUILayout.ObjectField("Action", actionCtrl, typeof(AnimatorController), false, GUILayout.ExpandWidth(true)) as AnimatorController; - actionWD = EditorGUILayout.Toggle(new GUIContent("Write Defaults", "VRChat default is OFF, but most avatars has this setting set to ON."), actionWD); - var newFxCtrl = EditorGUILayout.ObjectField("FX", fxCtrl, typeof(AnimatorController), false, GUILayout.ExpandWidth(true)) as AnimatorController; - fxWD = EditorGUILayout.Toggle(new GUIContent("Write Defaults", "VRChat default is OFF, but most avatars has this setting set to ON."), fxWD); - - GUILayout.Space(10); - - GUILayout.BeginHorizontal(); - - if (validStat == Status.DIFFERENCE) - { - CuteButtons.RenderButton("Update animator layers", CuteIcons.ADD, HandleUpdate); - } - else - { - CuteButtons.RenderButton("Add animator layers", CuteIcons.ADD, () => HandleAdd(), - !(validStat == Status.EMPTY || validStat == Status.MISSING)); - } - - CuteButtons.RenderButton("Remove", CuteIcons.REMOVE, () => HandleRemove(), - !(validStat == Status.ADDED || validStat == Status.UNKNOWN), GUILayout.Width(150)); - - GUILayout.EndHorizontal(); - } - - public void RenderStatus() - { - switch (validStat) - { - case Status.FORM: - CuteInfoBox.RenderInfoBox(CuteIcons.INFO, "Please select animator controllers."); - break; - case Status.EMPTY: - CuteInfoBox.RenderInfoBox(CuteIcons.WARN, "Layers are not added."); - break; - case Status.MISSING: - CuteInfoBox.RenderInfoBox(CuteIcons.WARN, "Layers are not added (missing controllers will be created)."); - break; - case Status.ADDED: - CuteInfoBox.RenderInfoBox(CuteIcons.OK, "Layers are added."); - break; - case Status.DIFFERENCE: - CuteInfoBox.RenderInfoBox(CuteIcons.WARN, "Layers are out of date. Press update button to fix it."); - break; - case Status.UNKNOWN: - CuteInfoBox.RenderInfoBox(CuteIcons.ERROR, "Layers are in mixed state. You can still try to remove any existing layers using Remove button and re-add them."); - break; - } + ActionWD = false; + FxWD = false; } public void SetAvatar(AvatarDescriptor avatarDescriptor) { avatar = avatarDescriptor; - actionCtrl = Array.Find(avatarDescriptor.baseAnimationLayers, layer => layer.type == AvatarDescriptor.AnimLayerType.Action).animatorController as AnimatorController; - fxCtrl = Array.Find(avatarDescriptor.baseAnimationLayers, layer => layer.type == AvatarDescriptor.AnimLayerType.FX).animatorController as AnimatorController; - - if (actionCtrl) - { - actionWD = CuteAnimators.IsAnimatorUsingWD(actionCtrl); - } - if (fxCtrl) - { - fxWD = CuteAnimators.IsAnimatorUsingWD(fxCtrl); - } + actionCtrl = Array.Find(avatarDescriptor.baseAnimationLayers, layer => layer.type == AnimLayerType.Action).animatorController as AnimatorController; + fxCtrl = Array.Find(avatarDescriptor.baseAnimationLayers, layer => layer.type == AnimLayerType.FX).animatorController as AnimatorController; } public void ClearForm() @@ -117,35 +50,35 @@ public void HandleAdd() void HandleAdd(bool silent = false) { - if (!actionCtrl && !CreateController(AvatarDescriptor.AnimLayerType.Action, $"{avatar.name}-Action", silent)) + if (!actionCtrl && !CreateController(AnimLayerType.Action, $"{avatar.name}-Action", silent)) { return; } - if (!fxCtrl && !CreateController(AvatarDescriptor.AnimLayerType.FX, $"{avatar.name}-FX", silent)) + if (!fxCtrl && !CreateController(AnimLayerType.FX, $"{avatar.name}-FX", silent)) { return; } DoBackup(); - AnimatorController srcActionCtrl = AssetDatabase.LoadAssetAtPath(ACTION_CTRL, typeof(AnimatorController)) as AnimatorController; - AnimatorController srcFxCtrl = AssetDatabase.LoadAssetAtPath(FX_CTRL, typeof(AnimatorController)) as AnimatorController; + AnimatorController srcActionCtrl = AssetDatabase.LoadAssetAtPath(ACTION_CTRL); + AnimatorController srcFxCtrl = AssetDatabase.LoadAssetAtPath(FX_CTRL); - Array.ForEach(srcActionCtrl.layers, l => Array.ForEach(l.stateMachine.states, s => s.state.writeDefaultValues = actionWD)); - Array.ForEach(srcFxCtrl.layers, l => Array.ForEach(l.stateMachine.states, s => s.state.writeDefaultValues = fxWD)); + Array.ForEach(srcActionCtrl.layers, l => Array.ForEach(l.stateMachine.states, s => s.state.writeDefaultValues = ActionWD)); + Array.ForEach(srcFxCtrl.layers, l => Array.ForEach(l.stateMachine.states, s => s.state.writeDefaultValues = FxWD)); Debug.Log("Merging controllers [source=" + srcActionCtrl.name + ", desitnation=" + actionCtrl.name + "]"); - VRF.VRLabs.AV3Manager.AnimatorCloner.MergeControllers(actionCtrl, srcActionCtrl); + VRLabs.AV3Manager.AnimatorCloner.MergeControllers(actionCtrl, srcActionCtrl); Debug.Log("Merging controllers [source=" + srcFxCtrl.name + ", desitnation=" + fxCtrl.name + "]"); - VRF.VRLabs.AV3Manager.AnimatorCloner.MergeControllers(fxCtrl, srcFxCtrl); - - Array.ForEach(srcActionCtrl.layers, l => Array.ForEach(l.stateMachine.states, s => s.state.writeDefaultValues = true)); - Array.ForEach(srcFxCtrl.layers, l => Array.ForEach(l.stateMachine.states, s => s.state.writeDefaultValues = true)); + VRLabs.AV3Manager.AnimatorCloner.MergeControllers(fxCtrl, srcFxCtrl); + + EditorUtility.ClearDirty(srcActionCtrl); + EditorUtility.ClearDirty(srcFxCtrl); AssetDatabase.SaveAssets(); - CuteAnimators.UpdateVrcAnimatorLayerControlAfterClone(actionCtrl, !actionWD); + CuteAnimators.UpdateVrcAnimatorLayerControlAfterClone(actionCtrl, !ActionWD); } public void HandleRemove() @@ -155,7 +88,7 @@ public void HandleRemove() void HandleRemove(bool silent = false) { - if (validStat == Status.UNKNOWN) + if (GetStatus() == ApplyStatus.BLOCKED) { if (!EditorUtility.DisplayDialog("CuteScript", "The script will try to remove CuteDance layers from your animators if any exists.\n\nThey are matched by name though, so it may not help.", "Let's try", "Cancel")) { @@ -228,26 +161,18 @@ void DoBackup() CuteBackup.CreateBackup(AssetDatabase.GetAssetPath(fxCtrl)); } - // TODO temporary validation, true - instaled, false - not - public bool TempValidate() - { - var status = Validate(); - return status == Status.ADDED || status == Status.DIFFERENCE || status == Status.UNKNOWN; - } - - Status Validate() + public ApplyStatus GetStatus() { if (!avatar) { - return Status.FORM; + return ApplyStatus.EMPTY; } if (!actionCtrl || !fxCtrl) { - return Status.MISSING; + return ApplyStatus.ADD; } - - AnimatorController srcActionCtrl = AssetDatabase.LoadAssetAtPath(ACTION_CTRL, typeof(AnimatorController)) as AnimatorController; - AnimatorController srcFxCtrl = AssetDatabase.LoadAssetAtPath(FX_CTRL, typeof(AnimatorController)) as AnimatorController; + AnimatorController srcActionCtrl = AssetDatabase.LoadAssetAtPath(ACTION_CTRL); + AnimatorController srcFxCtrl = AssetDatabase.LoadAssetAtPath(FX_CTRL); bool actionHasLayers = CheckLayersExists(actionCtrl, srcActionCtrl, out bool actionDiffs); bool fxHasLayers = CheckLayersExists(fxCtrl, srcFxCtrl, out bool fxDiffs); @@ -256,16 +181,15 @@ Status Validate() { if (actionDiffs || fxDiffs) { - return Status.DIFFERENCE; + return ApplyStatus.UPDATE; } - return Status.ADDED; + return ApplyStatus.REMOVE; } if (!actionHasLayers && !fxHasLayers) { - return Status.EMPTY; + return ApplyStatus.ADD; } - return Status.UNKNOWN; - + return ApplyStatus.BLOCKED; } bool CheckLayersExists(AnimatorController controller, AnimatorController refCtrl, out bool diffs) diff --git a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteParams.cs b/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteParams.cs index 936d684..b3ad939 100644 --- a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteParams.cs +++ b/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteParams.cs @@ -15,57 +15,9 @@ public class CuteParams : AvatarApplierInterface // TODO read from build configuration static string PARAMS_REF = Path.Combine("Assets", "CuteDancer", "Build", "CuteDancer-VRCParams.asset"); - enum Status - { - FORM, EMPTY, ADDED, MISSING - } - - Status validStat = Status.FORM; AvatarDescriptor avatar; ExpressionParameters expressionParams; - public void RenderForm() - { - validStat = Validate(); - - GUIStyle labelStyle = new GUIStyle(EditorStyles.largeLabel); - labelStyle.wordWrap = true; - - GUILayout.Label("Select expression parameters used by your avatar", labelStyle); - expressionParams = EditorGUILayout.ObjectField("Expression Parameters", expressionParams, typeof(ExpressionParameters), false, GUILayout.ExpandWidth(true)) as ExpressionParameters; - - GUILayout.Space(10); - - GUILayout.BeginHorizontal(); - - CuteButtons.RenderButton("Add expression parameters", CuteIcons.ADD, HandleAdd, - validStat == Status.ADDED || validStat == Status.FORM); - CuteButtons.RenderButton("Remove", CuteIcons.REMOVE, HandleRemove, - validStat != Status.ADDED, - GUILayout.Width(150)); - - GUILayout.EndHorizontal(); - } - - public void RenderStatus() - { - switch (validStat) - { - case Status.FORM: - CuteInfoBox.RenderInfoBox(CuteIcons.INFO, "Please select expression parameters asset."); - break; - case Status.EMPTY: - CuteInfoBox.RenderInfoBox(CuteIcons.WARN, "Expression parameters are not added."); - break; - case Status.ADDED: - CuteInfoBox.RenderInfoBox(CuteIcons.OK, "Expression parameters are added."); - break; - case Status.MISSING: - CuteInfoBox.RenderInfoBox(CuteIcons.WARN, "Expression parameters are not added (missing expression parameters asset will be created)."); - break; - } - } - public void SetAvatar(AvatarDescriptor avatarDescriptor) { avatar = avatarDescriptor; @@ -146,15 +98,15 @@ void DoBackup() CuteBackup.CreateBackup(AssetDatabase.GetAssetPath(expressionParams)); } - Status Validate() + public ApplyStatus GetStatus() { if (!avatar) { - return Status.FORM; + return ApplyStatus.EMPTY; } if (!expressionParams) { - return Status.MISSING; + return ApplyStatus.ADD; } ExpressionParameters paramsRef = AssetDatabase.LoadAssetAtPath(PARAMS_REF, typeof(ExpressionParameters)) as ExpressionParameters; @@ -169,9 +121,9 @@ Status Validate() }); if (notFound) { - return Status.EMPTY; + return ApplyStatus.ADD; } - return Status.ADDED; + return ApplyStatus.REMOVE; } bool CreateExpressionParams() diff --git a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CutePrefab.cs b/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CutePrefab.cs index 42ef5e2..65ded2f 100644 --- a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CutePrefab.cs +++ b/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CutePrefab.cs @@ -21,54 +21,6 @@ enum Status } GameObject avatar; - Status validStat = Status.FORM; - - public void RenderForm() - { - validStat = Validate(); - - GUIStyle labelStyle = new GUIStyle(EditorStyles.largeLabel); - labelStyle.wordWrap = true; - GUILayout.Label("Add music and contact prefabs using the button below or drag & drop them to the root of your avatar", - labelStyle); - labelStyle.fontStyle = FontStyle.Italic; - - GUILayout.BeginHorizontal(); - - if (validStat == Status.ADDED_PARTIAL || validStat == Status.DIFFERENCE) - { - CuteButtons.RenderButton("Update prefabs", CuteIcons.ADD, HandleUpdate); - } - else - { - CuteButtons.RenderButton("Add prefabs", CuteIcons.ADD, HandleAdd, validStat == Status.FORM || validStat == Status.ADDED); - } - CuteButtons.RenderButton("Remove", CuteIcons.REMOVE, HandleRemove, validStat == Status.FORM || validStat == Status.EMPTY, GUILayout.Width(150)); - - GUILayout.EndHorizontal(); - } - - public void RenderStatus() - { - switch (validStat) - { - case Status.FORM: - CuteInfoBox.RenderInfoBox(CuteIcons.INFO, "Avatar not selected."); - break; - case Status.EMPTY: - CuteInfoBox.RenderInfoBox(CuteIcons.WARN, "Prefabs are not added."); - break; - case Status.ADDED: - CuteInfoBox.RenderInfoBox(CuteIcons.OK, "Prefab are added."); - break; - case Status.ADDED_PARTIAL: - CuteInfoBox.RenderInfoBox(CuteIcons.WARN, "Some of required prefabs are missing."); - break; - case Status.DIFFERENCE: - CuteInfoBox.RenderInfoBox(CuteIcons.WARN, "Prefabs on the avatar are out of date. Press update button to fix it."); - break; - } - } public void SetAvatar(AvatarDescriptor avatarDescriptor) { @@ -80,11 +32,11 @@ public void ClearForm() avatar = null; } - Status Validate() + public ApplyStatus GetStatus() { if (!avatar) { - return Status.FORM; + return ApplyStatus.EMPTY; } Transform musicInstance = avatar.transform.Find("CuteDancer-Music"); @@ -94,18 +46,18 @@ Status Validate() { if (IsPrefabModified(musicInstance.gameObject) || IsPrefabModified(contactInstance.gameObject)) { - return Status.DIFFERENCE; + return ApplyStatus.UPDATE; } - return Status.ADDED; + return ApplyStatus.REMOVE; } if (!musicInstance && !contactInstance) { - return Status.EMPTY; + return ApplyStatus.ADD; } - return Status.ADDED_PARTIAL; + return ApplyStatus.UPDATE; } bool IsPrefabModified(GameObject instance) diff --git a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteSubmenu.cs b/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteSubmenu.cs index 05bf879..3e5089b 100644 --- a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteSubmenu.cs +++ b/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/CuteSubmenu.cs @@ -15,58 +15,9 @@ public class CuteSubmenu : AvatarApplierInterface static string CUTE_MENU = Path.Combine("Assets", "CuteDancer", "Build", "CuteDancer-VRCMenu.asset"); // TODO read from build configuration static string DANCE_ICON = Path.Combine("Packages", "pl.krysiek.cutedancer", "Runtime", "Icons", "CuteDancer.png"); - enum Status - { - FORM, EMPTY, ADDED, FULL, MISSING - } - - Status validStat = Status.FORM; AvatarDescriptor avatar; ExpressionsMenu expressionMenu; - public void RenderForm() - { - validStat = Validate(); - - GUIStyle labelStyle = new GUIStyle(EditorStyles.largeLabel); - labelStyle.wordWrap = true; - - GUILayout.Label("Select expression menu used by your avatar", labelStyle); - expressionMenu = EditorGUILayout.ObjectField("Expressions Menu", expressionMenu, typeof(ExpressionsMenu), false, GUILayout.ExpandWidth(true)) as ExpressionsMenu; - - GUILayout.Space(10); - - GUILayout.BeginHorizontal(); - - CuteButtons.RenderButton("Add expression submenu", CuteIcons.ADD, HandleAdd, - validStat == Status.FORM || validStat == Status.ADDED || validStat == Status.FULL); - CuteButtons.RenderButton("Remove", CuteIcons.REMOVE, HandleRemove, validStat != Status.ADDED, GUILayout.Width(150)); - - GUILayout.EndHorizontal(); - } - - public void RenderStatus() - { - switch (Validate()) - { - case Status.FORM: - CuteInfoBox.RenderInfoBox(CuteIcons.INFO, "Please select expression menu asset where CuteDancer submenu will be added."); - break; - case Status.ADDED: - CuteInfoBox.RenderInfoBox(CuteIcons.OK, "CuteDancer submenu is added."); - break; - case Status.EMPTY: - CuteInfoBox.RenderInfoBox(CuteIcons.WARN, "CuteDancer submenu is not added."); - break; - case Status.MISSING: - CuteInfoBox.RenderInfoBox(CuteIcons.WARN, "CuteDancer submenu is not added (missing expression menu asset will be created)."); - break; - case Status.FULL: - CuteInfoBox.RenderInfoBox(CuteIcons.ERROR, "No slots available in selected expression menu.\nPlease select another menu or remove unused control from the menu."); - break; - } - } - public void SetAvatar(AvatarDescriptor avatarDescriptor) { avatar = avatarDescriptor; @@ -79,26 +30,29 @@ public void ClearForm() expressionMenu = null; } - Status Validate() + public ApplyStatus GetStatus() { if (avatar == null) { - return Status.FORM; + return ApplyStatus.EMPTY; } if (expressionMenu == null) { - return Status.MISSING; + return ApplyStatus.ADD; } - ExpressionsMenu cuteMenu = AssetDatabase.LoadAssetAtPath(CUTE_MENU, typeof(ExpressionsMenu)) as ExpressionsMenu; - if (expressionMenu.controls.Exists(menuEntry => menuEntry.subMenu == cuteMenu)) - { - return Status.ADDED; + ExpressionsMenu cuteMenu = AssetDatabase.LoadAssetAtPath(CUTE_MENU); + if (expressionMenu.controls.Exists(menuEntry => menuEntry.subMenu == cuteMenu)) { + return ApplyStatus.REMOVE; + } + Texture2D cuteIcon = AssetDatabase.LoadAssetAtPath(DANCE_ICON); + if (expressionMenu.controls.Exists(menuEntry => menuEntry.name == "CuteDancer") || expressionMenu.controls.Exists(menuEntry => menuEntry.icon == cuteIcon)) { + return ApplyStatus.UPDATE; } if (expressionMenu.controls.ToArray().Length >= 8) { - return Status.FULL; + return ApplyStatus.BLOCKED; } - return Status.EMPTY; + return ApplyStatus.ADD; } public void HandleAdd() @@ -112,12 +66,13 @@ public void HandleAdd() ExpressionsMenu cuteMenu = AssetDatabase.LoadAssetAtPath(CUTE_MENU, typeof(ExpressionsMenu)) as ExpressionsMenu; - var menuEntry = new ExpressionsMenu.Control(); - - menuEntry.name = "CuteDancer"; - menuEntry.icon = AssetDatabase.LoadAssetAtPath(DANCE_ICON, typeof(Texture2D)) as Texture2D; - menuEntry.type = ExpressionsMenu.Control.ControlType.SubMenu; - menuEntry.subMenu = cuteMenu; + var menuEntry = new ExpressionsMenu.Control + { + name = "CuteDancer", + icon = AssetDatabase.LoadAssetAtPath(DANCE_ICON, typeof(Texture2D)) as Texture2D, + type = ExpressionsMenu.Control.ControlType.SubMenu, + subMenu = cuteMenu + }; Debug.Log("Adding expression menu control to menu [name=" + expressionMenu.name + "]"); expressionMenu.controls.Add(menuEntry); @@ -147,15 +102,15 @@ void DoBackup() bool CreateExpressionMenu() { - var path = $"Assets/{avatar.name}-ExpressionMenu.asset"; - var ok = EditorUtility.DisplayDialog("CuteScript", $"It seems your avatar does not have expression menu. Empty one will be created and assigned to your avatar.\n\nNew asset will be saved under path:\n{path}", "Create it!", "Cancel"); + string path = $"Assets/{avatar.name}-ExpressionMenu.asset"; + bool ok = EditorUtility.DisplayDialog("CuteScript", $"It seems your avatar does not have expression menu. Empty one will be created and assigned to your avatar.\n\nNew asset will be saved under path:\n{path}", "Create it!", "Cancel"); if (!ok) { EditorUtility.DisplayDialog("CuteScript", "Operation aborted. Expresion Menu is NOT added!", "OK"); return false; } - var emptyMenu = ScriptableObject.CreateInstance(typeof(ExpressionsMenu)) as ExpressionsMenu; + ExpressionsMenu emptyMenu = ScriptableObject.CreateInstance(typeof(ExpressionsMenu)) as ExpressionsMenu; emptyMenu.controls = new List(); AssetDatabase.CreateAsset(emptyMenu, path); diff --git a/Packages/pl.krysiek.cutedancer/Editor/Service/AvatarApplyService.cs b/Packages/pl.krysiek.cutedancer/Editor/Service/AvatarApplyService.cs index 25ea1e6..2e00ad3 100644 --- a/Packages/pl.krysiek.cutedancer/Editor/Service/AvatarApplyService.cs +++ b/Packages/pl.krysiek.cutedancer/Editor/Service/AvatarApplyService.cs @@ -55,7 +55,7 @@ public void RemoveFromAvatar() // TODO temporary validation, return true if installed, false if not public bool Validate() { - return cuteLayers.TempValidate(); + return cuteLayers.GetStatus() != ApplyStatus.ADD; } } diff --git a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/AnimatorCloner.cs b/Packages/pl.krysiek.cutedancer/Editor/Utils/AnimatorCloner.cs similarity index 99% rename from Packages/pl.krysiek.cutedancer/Editor/Service/Applier/AnimatorCloner.cs rename to Packages/pl.krysiek.cutedancer/Editor/Utils/AnimatorCloner.cs index 8d72a13..c5db6de 100644 --- a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/AnimatorCloner.cs +++ b/Packages/pl.krysiek.cutedancer/Editor/Utils/AnimatorCloner.cs @@ -2,6 +2,8 @@ // Licensed under MIT License // source: https://github.com/VRLabs/Avatars-3.0-Manager/blob/main/Editor/AnimatorCloner.cs +// TODO consider add package as a dependency and use original class + #if VRC_SDK_VRCSDK3 using System; using System.Collections.Generic; diff --git a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/AnimatorCloner.cs.meta b/Packages/pl.krysiek.cutedancer/Editor/Utils/AnimatorCloner.cs.meta similarity index 83% rename from Packages/pl.krysiek.cutedancer/Editor/Service/Applier/AnimatorCloner.cs.meta rename to Packages/pl.krysiek.cutedancer/Editor/Utils/AnimatorCloner.cs.meta index 712feee..85b19fd 100644 --- a/Packages/pl.krysiek.cutedancer/Editor/Service/Applier/AnimatorCloner.cs.meta +++ b/Packages/pl.krysiek.cutedancer/Editor/Utils/AnimatorCloner.cs.meta @@ -1,5 +1,5 @@ fileFormatVersion: 2 -guid: c76843cd4dd6d3747b1e49407ba11a05 +guid: acc0f087fb6290249a130cb765fecafa MonoImporter: externalObjects: {} serializedVersion: 2