chore: fixing broken tests

This commit is contained in:
bd_ 2023-04-15 16:38:55 +09:00
parent 20dae6e5cb
commit 4295767be7
3 changed files with 15 additions and 3 deletions

View File

@ -98,13 +98,16 @@ namespace modular_avatar_tests
var boneProxy = proxy.AddComponent<ModularAvatarBoneProxy>(); var boneProxy = proxy.AddComponent<ModularAvatarBoneProxy>();
boneProxy.target = bone.transform; boneProxy.target = bone.transform;
boneProxy.attachmentMode = attachmentMode; boneProxy.attachmentMode = attachmentMode;
// Prevent the bone from being optimized away
var proxyTransform = boneProxy.transform;
proxyTransform.gameObject.AddComponent<MeshRenderer>();
bone.transform.localPosition = Vector3.one; bone.transform.localPosition = Vector3.one;
bone.transform.localRotation = Quaternion.Euler(123, 45, 6); bone.transform.localRotation = Quaternion.Euler(123, 45, 6);
AvatarProcessor.ProcessAvatar(root); AvatarProcessor.ProcessAvatar(root);
Assert.AreEqual(proxy.transform.parent, bone.transform); Assert.AreEqual(proxyTransform.parent, bone.transform);
if (expectSnapPos) if (expectSnapPos)
{ {

View File

@ -56,6 +56,8 @@ namespace nadena.dev.modular_avatar.core.editor
public AnimatorController DeepCloneAnimator(RuntimeAnimatorController controller) public AnimatorController DeepCloneAnimator(RuntimeAnimatorController controller)
{ {
if (controller == null) return null;
var merger = new AnimatorCombiner(this); var merger = new AnimatorCombiner(this);
switch (controller) switch (controller)
{ {

View File

@ -31,6 +31,8 @@ namespace nadena.dev.modular_avatar.core.editor
.Where(item => item != null) .Where(item => item != null)
.ToImmutableHashSet(); .ToImmutableHashSet();
if (actionMenus.IsEmpty) return;
// Generate the root blendtree and animation; insert into the FX layer // Generate the root blendtree and animation; insert into the FX layer
var animLayers = avatar.baseAnimationLayers; var animLayers = avatar.baseAnimationLayers;
int fxLayerIndex = -1; int fxLayerIndex = -1;
@ -89,7 +91,11 @@ namespace nadena.dev.modular_avatar.core.editor
layerList.Insert(0, GenerateBlendshapeBaseLayer(avatar)); layerList.Insert(0, GenerateBlendshapeBaseLayer(avatar));
rootBlendTree.defaultWeight = 1; rootBlendTree.defaultWeight = 1;
layerList.Insert(0, rootBlendTree); layerList.Insert(0, rootBlendTree);
layerList[1].defaultWeight = 1; if (layerList.Count > 1)
{
layerList[1].defaultWeight = 1;
}
controller.layers = layerList.ToArray(); controller.layers = layerList.ToArray();
foreach (var action in avatar.GetComponentsInChildren<MenuAction>(true)) foreach (var action in avatar.GetComponentsInChildren<MenuAction>(true))
@ -211,7 +217,8 @@ namespace nadena.dev.modular_avatar.core.editor
descriptor.expressionParameters = expParams; descriptor.expressionParameters = expParams;
} }
List<VRCExpressionParameters.Parameter> expParameters = expParams.parameters.ToList(); List<VRCExpressionParameters.Parameter> expParameters =
expParams.parameters?.ToList() ?? new List<VRCExpressionParameters.Parameter>();
List<BlendTree> blendTrees = new List<BlendTree>(); List<BlendTree> blendTrees = new List<BlendTree>();
Dictionary<ActionController, List<ModularAvatarMenuItem>> groupedItems = Dictionary<ActionController, List<ModularAvatarMenuItem>> groupedItems =