mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2024-12-29 02:35:06 +08:00
fix: type corrections not applied to substatemachine exit transitions (#751)
Closes: #748
This commit is contained in:
parent
e31a33b82c
commit
0ff1da0734
@ -22,10 +22,13 @@
|
||||
* SOFTWARE.
|
||||
*/
|
||||
|
||||
#region
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using nadena.dev.modular_avatar.editor.ErrorReporting;
|
||||
using nadena.dev.ndmf;
|
||||
using nadena.dev.ndmf.util;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Animations;
|
||||
@ -37,11 +40,13 @@ using VRC.SDK3.Avatars.Components;
|
||||
using VRC.SDKBase;
|
||||
#endif
|
||||
|
||||
#endregion
|
||||
|
||||
namespace nadena.dev.modular_avatar.animation
|
||||
{
|
||||
internal class AnimatorCombiner
|
||||
{
|
||||
private readonly ndmf.BuildContext _context;
|
||||
private readonly BuildContext _context;
|
||||
private readonly AnimatorController _combined;
|
||||
|
||||
private readonly DeepClone _deepClone;
|
||||
@ -68,7 +73,7 @@ namespace nadena.dev.modular_avatar.animation
|
||||
public VRC_AnimatorLayerControl.BlendableLayer? BlendableLayer;
|
||||
#endif
|
||||
|
||||
public AnimatorCombiner(ndmf.BuildContext context, String assetName)
|
||||
public AnimatorCombiner(BuildContext context, String assetName)
|
||||
{
|
||||
_combined = new AnimatorController();
|
||||
if (context.AssetContainer != null && EditorUtility.IsPersistent(context.AssetContainer))
|
||||
@ -141,6 +146,18 @@ namespace nadena.dev.modular_avatar.animation
|
||||
.SelectMany(FixupTransition).ToArray();
|
||||
asm.anyStateTransitions = asm.anyStateTransitions
|
||||
.SelectMany(FixupTransition).ToArray();
|
||||
|
||||
foreach (var stateMachine in asm.stateMachines)
|
||||
{
|
||||
var ssm = stateMachine.stateMachine;
|
||||
|
||||
var stateMachineTransitions = asm.GetStateMachineTransitions(ssm);
|
||||
if (stateMachineTransitions.Length > 0)
|
||||
{
|
||||
asm.SetStateMachineTransitions(ssm,
|
||||
stateMachineTransitions.SelectMany(FixupTransition).ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -180,6 +180,23 @@ public class ConvertTransitionTypes : TestBase
|
||||
AssertTransitions(layer, "int", "eq1", 0, ("int", AnimatorConditionMode.Equals, 1f));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void SubStateMachineExitTransitions()
|
||||
{
|
||||
var prefab = CreatePrefab("ConvertTransitionTypes.prefab");
|
||||
|
||||
AvatarProcessor.ProcessAvatar(prefab);
|
||||
|
||||
var layer = findFxLayer(prefab, "sub_state_machine");
|
||||
|
||||
var rootStateMachine = layer.stateMachine;
|
||||
var ssm1 = layer.stateMachine.stateMachines[0].stateMachine;
|
||||
var exitTransitions = rootStateMachine.GetStateMachineTransitions(ssm1);
|
||||
|
||||
AssertSingleTransition(exitTransitions[0], ("int", AnimatorConditionMode.Greater, 0.1f));
|
||||
AssertSingleTransition(exitTransitions[1], ("int", AnimatorConditionMode.Less, -0.1f));
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CrossLayerTypeConsistency()
|
||||
{
|
||||
|
@ -506,6 +506,23 @@ AnimatorState:
|
||||
m_MirrorParameter:
|
||||
m_CycleOffsetParameter:
|
||||
m_TimeParameter:
|
||||
--- !u!1109 &-1214348927005070382
|
||||
AnimatorTransition:
|
||||
m_ObjectHideFlags: 1
|
||||
m_CorrespondingSourceObject: {fileID: 0}
|
||||
m_PrefabInstance: {fileID: 0}
|
||||
m_PrefabAsset: {fileID: 0}
|
||||
m_Name:
|
||||
m_Conditions:
|
||||
- m_ConditionMode: 7
|
||||
m_ConditionEvent: int
|
||||
m_EventTreshold: 0
|
||||
m_DstStateMachine: {fileID: 0}
|
||||
m_DstState: {fileID: 0}
|
||||
m_Solo: 0
|
||||
m_Mute: 0
|
||||
m_IsExit: 1
|
||||
serializedVersion: 1
|
||||
--- !u!91 &9100000
|
||||
AnimatorController:
|
||||
m_ObjectHideFlags: 0
|
||||
@ -1034,7 +1051,10 @@ AnimatorStateMachine:
|
||||
- {fileID: 1712637675519008892}
|
||||
m_EntryTransitions:
|
||||
- {fileID: 6284330602530841453}
|
||||
m_StateMachineTransitions: {}
|
||||
m_StateMachineTransitions:
|
||||
- first: {fileID: -2155158836370751539}
|
||||
second:
|
||||
- {fileID: -1214348927005070382}
|
||||
m_StateMachineBehaviours: []
|
||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||
|
Loading…
Reference in New Issue
Block a user