mirror of
https://github.com/bdunderscore/modular-avatar.git
synced 2025-04-24 21:38:59 +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.
|
* SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#region
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using nadena.dev.modular_avatar.editor.ErrorReporting;
|
using nadena.dev.modular_avatar.editor.ErrorReporting;
|
||||||
|
using nadena.dev.ndmf;
|
||||||
using nadena.dev.ndmf.util;
|
using nadena.dev.ndmf.util;
|
||||||
using UnityEditor;
|
using UnityEditor;
|
||||||
using UnityEditor.Animations;
|
using UnityEditor.Animations;
|
||||||
@ -37,11 +40,13 @@ using VRC.SDK3.Avatars.Components;
|
|||||||
using VRC.SDKBase;
|
using VRC.SDKBase;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
namespace nadena.dev.modular_avatar.animation
|
namespace nadena.dev.modular_avatar.animation
|
||||||
{
|
{
|
||||||
internal class AnimatorCombiner
|
internal class AnimatorCombiner
|
||||||
{
|
{
|
||||||
private readonly ndmf.BuildContext _context;
|
private readonly BuildContext _context;
|
||||||
private readonly AnimatorController _combined;
|
private readonly AnimatorController _combined;
|
||||||
|
|
||||||
private readonly DeepClone _deepClone;
|
private readonly DeepClone _deepClone;
|
||||||
@ -68,7 +73,7 @@ namespace nadena.dev.modular_avatar.animation
|
|||||||
public VRC_AnimatorLayerControl.BlendableLayer? BlendableLayer;
|
public VRC_AnimatorLayerControl.BlendableLayer? BlendableLayer;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
public AnimatorCombiner(ndmf.BuildContext context, String assetName)
|
public AnimatorCombiner(BuildContext context, String assetName)
|
||||||
{
|
{
|
||||||
_combined = new AnimatorController();
|
_combined = new AnimatorController();
|
||||||
if (context.AssetContainer != null && EditorUtility.IsPersistent(context.AssetContainer))
|
if (context.AssetContainer != null && EditorUtility.IsPersistent(context.AssetContainer))
|
||||||
@ -141,6 +146,18 @@ namespace nadena.dev.modular_avatar.animation
|
|||||||
.SelectMany(FixupTransition).ToArray();
|
.SelectMany(FixupTransition).ToArray();
|
||||||
asm.anyStateTransitions = asm.anyStateTransitions
|
asm.anyStateTransitions = asm.anyStateTransitions
|
||||||
.SelectMany(FixupTransition).ToArray();
|
.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));
|
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]
|
[Test]
|
||||||
public void CrossLayerTypeConsistency()
|
public void CrossLayerTypeConsistency()
|
||||||
{
|
{
|
||||||
|
@ -506,6 +506,23 @@ AnimatorState:
|
|||||||
m_MirrorParameter:
|
m_MirrorParameter:
|
||||||
m_CycleOffsetParameter:
|
m_CycleOffsetParameter:
|
||||||
m_TimeParameter:
|
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
|
--- !u!91 &9100000
|
||||||
AnimatorController:
|
AnimatorController:
|
||||||
m_ObjectHideFlags: 0
|
m_ObjectHideFlags: 0
|
||||||
@ -1034,7 +1051,10 @@ AnimatorStateMachine:
|
|||||||
- {fileID: 1712637675519008892}
|
- {fileID: 1712637675519008892}
|
||||||
m_EntryTransitions:
|
m_EntryTransitions:
|
||||||
- {fileID: 6284330602530841453}
|
- {fileID: 6284330602530841453}
|
||||||
m_StateMachineTransitions: {}
|
m_StateMachineTransitions:
|
||||||
|
- first: {fileID: -2155158836370751539}
|
||||||
|
second:
|
||||||
|
- {fileID: -1214348927005070382}
|
||||||
m_StateMachineBehaviours: []
|
m_StateMachineBehaviours: []
|
||||||
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
m_AnyStatePosition: {x: 50, y: 20, z: 0}
|
||||||
m_EntryPosition: {x: 50, y: 120, z: 0}
|
m_EntryPosition: {x: 50, y: 120, z: 0}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user