diff --git a/Assets/_ModularAvatar/EditModeTests/AnimateAddedBones/AnimateAddedBones.cs b/Assets/_ModularAvatar/EditModeTests/AnimateAddedBones/AnimateAddedBones.cs index 10844096..ae884368 100644 --- a/Assets/_ModularAvatar/EditModeTests/AnimateAddedBones/AnimateAddedBones.cs +++ b/Assets/_ModularAvatar/EditModeTests/AnimateAddedBones/AnimateAddedBones.cs @@ -22,7 +22,7 @@ namespace modular_avatar_tests.AnimateAddedBones var layerName = "merged"; - var motion = findFxMotion(prefab, layerName); + var motion = findFxClip(prefab, layerName); var cubeObject = prefab.transform.Find("Armature/Hips").GetChild(0).gameObject; Assert.True(cubeObject.name.StartsWith("Cube$")); diff --git a/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.anim b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.anim new file mode 100644 index 00000000..5b6274dd --- /dev/null +++ b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.anim @@ -0,0 +1,53 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!74 &7400000 +AnimationClip: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DBTP + serializedVersion: 6 + m_Legacy: 0 + m_Compressed: 0 + m_UseHighQualityCurve: 1 + m_RotationCurves: [] + m_CompressedRotationCurves: [] + m_EulerCurves: [] + m_PositionCurves: [] + m_ScaleCurves: [] + m_FloatCurves: [] + m_PPtrCurves: [] + m_SampleRate: 60 + m_WrapMode: 0 + m_Bounds: + m_Center: {x: 0, y: 0, z: 0} + m_Extent: {x: 0, y: 0, z: 0} + m_ClipBindingConstant: + genericBindings: [] + pptrCurveMapping: [] + m_AnimationClipSettings: + serializedVersion: 2 + m_AdditiveReferencePoseClip: {fileID: 0} + m_AdditiveReferencePoseTime: 0 + m_StartTime: 0 + m_StopTime: 1 + m_OrientationOffsetY: 0 + m_Level: 0 + m_CycleOffset: 0 + m_HasAdditiveReferencePose: 0 + m_LoopTime: 0 + m_LoopBlend: 0 + m_LoopBlendOrientation: 0 + m_LoopBlendPositionY: 0 + m_LoopBlendPositionXZ: 0 + m_KeepOriginalOrientation: 0 + m_KeepOriginalPositionY: 1 + m_KeepOriginalPositionXZ: 0 + m_HeightFromFeet: 0 + m_Mirror: 0 + m_EditorCurves: [] + m_EulerEditorCurves: [] + m_HasGenericRootTransform: 0 + m_HasMotionFloatCurves: 0 + m_Events: [] diff --git a/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.anim.meta b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.anim.meta new file mode 100644 index 00000000..454c0925 --- /dev/null +++ b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.anim.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 822fa250a223d354b8f2c1e5e4a71beb +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 7400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.controller b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.controller new file mode 100644 index 00000000..285c92e8 --- /dev/null +++ b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.controller @@ -0,0 +1,115 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1107 &-2231289259402408727 +AnimatorStateMachine: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: merged + m_ChildStates: + - serializedVersion: 1 + m_State: {fileID: 6794198557188456209} + m_Position: {x: 30, y: 220, z: 0} + m_ChildStateMachines: [] + m_AnyStateTransitions: [] + m_EntryTransitions: [] + m_StateMachineTransitions: {} + m_StateMachineBehaviours: [] + m_AnyStatePosition: {x: 50, y: 20, z: 0} + m_EntryPosition: {x: 50, y: 120, z: 0} + m_ExitPosition: {x: 800, y: 120, z: 0} + m_ParentStateMachinePosition: {x: 800, y: 20, z: 0} + m_DefaultState: {fileID: 6794198557188456209} +--- !u!206 &-43520952576507180 +BlendTree: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blend Tree + m_Childs: + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 822fa250a223d354b8f2c1e5e4a71beb, type: 2} + m_Threshold: 0 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: A + m_Mirror: 0 + - serializedVersion: 2 + m_Motion: {fileID: 7400000, guid: 822fa250a223d354b8f2c1e5e4a71beb, type: 2} + m_Threshold: 1 + m_Position: {x: 0, y: 0} + m_TimeScale: 1 + m_CycleOffset: 0 + m_DirectBlendParameter: B + m_Mirror: 0 + m_BlendParameter: Blend + m_BlendParameterY: Blend + m_MinThreshold: 0 + m_MaxThreshold: 1 + m_UseAutomaticThresholds: 1 + m_NormalizedBlendValues: 0 + m_BlendType: 4 +--- !u!91 &9100000 +AnimatorController: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: DBTP + serializedVersion: 5 + m_AnimatorParameters: + - m_Name: A + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + - m_Name: B + m_Type: 1 + m_DefaultFloat: 0 + m_DefaultInt: 0 + m_DefaultBool: 0 + m_Controller: {fileID: 9100000} + m_AnimatorLayers: + - serializedVersion: 5 + m_Name: merged + m_StateMachine: {fileID: -2231289259402408727} + m_Mask: {fileID: 0} + m_Motions: [] + m_Behaviours: [] + m_BlendingMode: 0 + m_SyncedLayerIndex: -1 + m_DefaultWeight: 0 + m_IKPass: 0 + m_SyncedLayerAffectsTiming: 0 + m_Controller: {fileID: 9100000} +--- !u!1102 &6794198557188456209 +AnimatorState: + serializedVersion: 6 + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_Name: Blend Tree + m_Speed: 1 + m_CycleOffset: 0 + m_Transitions: [] + m_StateMachineBehaviours: [] + m_Position: {x: 50, y: 50, z: 0} + m_IKOnFeet: 0 + m_WriteDefaultValues: 1 + m_Mirror: 0 + m_SpeedParameterActive: 0 + m_MirrorParameterActive: 0 + m_CycleOffsetParameterActive: 0 + m_TimeParameterActive: 0 + m_Motion: {fileID: -43520952576507180} + m_Tag: + m_SpeedParameter: + m_MirrorParameter: + m_CycleOffsetParameter: + m_TimeParameter: diff --git a/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.controller.meta b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.controller.meta new file mode 100644 index 00000000..6d385523 --- /dev/null +++ b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DBTP.controller.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 10117b7b37cd8844c93d0c5c18929fcf +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 9100000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.cs b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.cs new file mode 100644 index 00000000..a93e8396 --- /dev/null +++ b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.cs @@ -0,0 +1,28 @@ +using nadena.dev.modular_avatar.core.editor; +using NUnit.Framework; +using UnityEditor; +using UnityEditor.Animations; +using UnityEngine; + +namespace modular_avatar_tests.DirectBlendTreeParameters +{ + public class DirectBlendTreeParameters : TestBase + { + [Test] + public void RemapsDirectBlendTreeParameters() + { + var prefab = CreatePrefab("DirectBlendTreeParameters.prefab"); + AvatarProcessor.ProcessAvatar(prefab); + + var layerName = "merged"; + + var motion = findFxMotion(prefab, layerName); + var blendTree = motion as BlendTree; + Assert.NotNull(blendTree); + + var children = blendTree.children; + Assert.AreEqual(children[0].directBlendParameter, "A"); //not remapped + Assert.AreEqual(children[1].directBlendParameter, "C"); //remapped + } + } +} \ No newline at end of file diff --git a/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.cs.meta b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.cs.meta new file mode 100644 index 00000000..e529ed8c --- /dev/null +++ b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 355678dd0cdf4503b1b6545427ff5e8e +timeCreated: 1679719502 \ No newline at end of file diff --git a/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.prefab b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.prefab new file mode 100644 index 00000000..eba85d56 --- /dev/null +++ b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.prefab @@ -0,0 +1,390 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!1 &358086172465847897 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4301418309833736947} + - component: {fileID: 8166779794048720401} + - component: {fileID: 3545031262107578409} + m_Layer: 0 + m_Name: GameObject + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4301418309833736947 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 358086172465847897} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: [] + m_Father: {fileID: 4724854421498416451} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &8166779794048720401 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 358086172465847897} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 71a96d4ea0c344f39e277d82035bf9bd, type: 3} + m_Name: + m_EditorClassIdentifier: + parameters: + - nameOrPrefix: B + remapTo: C + internalParameter: 0 + isPrefix: 0 + syncType: 0 + defaultValue: 0 + saved: 0 +--- !u!114 &3545031262107578409 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 358086172465847897} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 1bb122659f724ebf85fe095ac02dc339, type: 3} + m_Name: + m_EditorClassIdentifier: + animator: {fileID: 9100000, guid: 10117b7b37cd8844c93d0c5c18929fcf, type: 2} + layerType: 5 + deleteAttachedAnimator: 0 + pathMode: 0 + matchAvatarWriteDefaults: 0 +--- !u!1 &6524782399038551043 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 4724854421498416451} + - component: {fileID: 2239338889414089943} + - component: {fileID: 3030341108566167033} + - component: {fileID: 5629002289773137650} + m_Layer: 0 + m_Name: DirectBlendTreeParameters + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!4 &4724854421498416451 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6524782399038551043} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 4.1121078, y: 0.04631436, z: -0.7135619} + m_LocalScale: {x: 1, y: 1, z: 1} + m_Children: + - {fileID: 4301418309833736947} + m_Father: {fileID: 0} + m_RootOrder: 0 + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!114 &2239338889414089943 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6524782399038551043} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 542108242, guid: 67cc4cb7839cd3741b63733d5adf0442, type: 3} + m_Name: + m_EditorClassIdentifier: + Name: + ViewPosition: {x: 0, y: 1.6, z: 0.2} + Animations: 0 + ScaleIPD: 1 + lipSync: 0 + lipSyncJawBone: {fileID: 0} + lipSyncJawClosed: {x: 0, y: 0, z: 0, w: 1} + lipSyncJawOpen: {x: 0, y: 0, z: 0, w: 1} + VisemeSkinnedMesh: {fileID: 0} + MouthOpenBlendShapeName: Facial_Blends.Jaw_Down + VisemeBlendShapes: [] + unityVersion: + portraitCameraPositionOffset: {x: 0, y: 0, z: 0} + portraitCameraRotationOffset: {x: 0, y: 1, z: 0, w: -0.00000004371139} + customExpressions: 0 + expressionsMenu: {fileID: 0} + expressionParameters: {fileID: 0} + enableEyeLook: 0 + customEyeLookSettings: + eyeMovement: + confidence: 0.5 + excitement: 0.5 + leftEye: {fileID: 0} + rightEye: {fileID: 0} + eyesLookingStraight: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingUp: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingDown: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingLeft: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyesLookingRight: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidType: 0 + upperLeftEyelid: {fileID: 0} + upperRightEyelid: {fileID: 0} + lowerLeftEyelid: {fileID: 0} + lowerRightEyelid: {fileID: 0} + eyelidsDefault: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsClosed: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsLookingUp: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsLookingDown: + upper: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + lower: + linked: 1 + left: {x: 0, y: 0, z: 0, w: 0} + right: {x: 0, y: 0, z: 0, w: 0} + eyelidsSkinnedMesh: {fileID: 0} + eyelidsBlendshapes: + customizeAnimationLayers: 0 + baseAnimationLayers: + - isEnabled: 0 + type: 0 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 4 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 5 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + specialAnimationLayers: + - isEnabled: 0 + type: 6 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 7 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + - isEnabled: 0 + type: 8 + animatorController: {fileID: 0} + mask: {fileID: 0} + isDefault: 1 + AnimationPreset: {fileID: 0} + animationHashSet: [] + autoFootsteps: 1 + autoLocomotion: 1 + collider_head: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_torso: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_footR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_footL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_handR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_handL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerIndexL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerMiddleL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerRingL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerLittleL: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerIndexR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerMiddleR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerRingR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} + collider_fingerLittleR: + isMirrored: 1 + state: 0 + transform: {fileID: 0} + radius: 0 + height: 0 + position: {x: 0, y: 0, z: 0} + rotation: {x: 0, y: 0, z: 0, w: 1} +--- !u!114 &3030341108566167033 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6524782399038551043} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: -1427037861, guid: 4ecd63eff847044b68db9453ce219299, type: 3} + m_Name: + m_EditorClassIdentifier: + launchedFromSDKPipeline: 0 + completedSDKPipeline: 0 + blueprintId: + contentType: 0 + assetBundleUnityVersion: + fallbackStatus: 0 +--- !u!95 &5629002289773137650 +Animator: + serializedVersion: 3 + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 6524782399038551043} + m_Enabled: 1 + m_Avatar: {fileID: 0} + m_Controller: {fileID: 0} + m_CullingMode: 0 + m_UpdateMode: 0 + m_ApplyRootMotion: 0 + m_LinearVelocityBlending: 0 + m_WarningMessage: + m_HasTransformHierarchy: 1 + m_AllowConstantClipSamplingOptimization: 1 + m_KeepAnimatorControllerStateOnDisable: 0 diff --git a/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.prefab.meta b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.prefab.meta new file mode 100644 index 00000000..1b6669f0 --- /dev/null +++ b/Assets/_ModularAvatar/EditModeTests/DirectBlendTreeParameters/DirectBlendTreeParameters.prefab.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 70484dfc143c0904cb1facfb29d5ee16 +PrefabImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Assets/_ModularAvatar/EditModeTests/SimpleArmatureToggle/SimpleArmatureToggle.cs b/Assets/_ModularAvatar/EditModeTests/SimpleArmatureToggle/SimpleArmatureToggle.cs index 5a33406b..d0ce1b81 100644 --- a/Assets/_ModularAvatar/EditModeTests/SimpleArmatureToggle/SimpleArmatureToggle.cs +++ b/Assets/_ModularAvatar/EditModeTests/SimpleArmatureToggle/SimpleArmatureToggle.cs @@ -17,7 +17,7 @@ namespace modular_avatar_tests.SimpleArmatureToggle AvatarProcessor.ProcessAvatar(prefab); var layerName = "merged"; - var motion = findFxMotion(prefab, layerName); + var motion = findFxClip(prefab, layerName); var obj1 = prefab.transform.Find("Armature/Hips").GetChild(1); var obj2 = prefab.transform.Find("Armature/Hips/Chest").GetChild(0); @@ -26,7 +26,7 @@ namespace modular_avatar_tests.SimpleArmatureToggle typeof(GameObject), "m_IsActive"); var binding2 = EditorCurveBinding.FloatCurve(RuntimeUtil.AvatarRootPath(obj2.gameObject), typeof(GameObject), "m_IsActive"); - + Assert.NotNull(AnimationUtility.GetEditorCurve(motion, binding1)); Assert.NotNull(AnimationUtility.GetEditorCurve(motion, binding2)); } diff --git a/Assets/_ModularAvatar/EditModeTests/TestBase.cs b/Assets/_ModularAvatar/EditModeTests/TestBase.cs index bb20d435..7ad1d665 100644 --- a/Assets/_ModularAvatar/EditModeTests/TestBase.cs +++ b/Assets/_ModularAvatar/EditModeTests/TestBase.cs @@ -62,15 +62,20 @@ namespace modular_avatar_tests } - protected static AnimationClip findFxMotion(GameObject prefab, string layerName) + protected static AnimationClip findFxClip(GameObject prefab, string layerName) + { + var motion = findFxMotion(prefab, layerName) as AnimationClip; + Assert.NotNull(motion); + return motion; + } + + protected static Motion findFxMotion(GameObject prefab, string layerName) { var layer = findFxLayer(prefab, layerName); var state = layer.stateMachine.states[0].state; Assert.NotNull(state); - var motion = state.motion as AnimationClip; - Assert.NotNull(motion); - return motion; + return state.motion; } protected static AnimatorState FindStateInLayer(AnimatorControllerLayer layer, string stateName) diff --git a/Assets/_ModularAvatar/EditModeTests/TransformMappingThroughSwitchedObject/TransformMappingThroughSwitchedObject.cs b/Assets/_ModularAvatar/EditModeTests/TransformMappingThroughSwitchedObject/TransformMappingThroughSwitchedObject.cs index 5f97151c..c0016c9e 100644 --- a/Assets/_ModularAvatar/EditModeTests/TransformMappingThroughSwitchedObject/TransformMappingThroughSwitchedObject.cs +++ b/Assets/_ModularAvatar/EditModeTests/TransformMappingThroughSwitchedObject/TransformMappingThroughSwitchedObject.cs @@ -17,7 +17,7 @@ namespace modular_avatar_tests.TransformMappingThroughSwitchedObject var prefab = CreatePrefab("TransformMappingThroughSwitchedObject.prefab"); AvatarProcessor.ProcessAvatar(prefab); - var motion = findFxMotion(prefab, "child_controller"); + var motion = findFxClip(prefab, "child_controller"); var binding = EditorCurveBinding.FloatCurve("Armature/Hips", typeof(Transform), "localEulerAnglesRaw.x"); var curve = AnimationUtility.GetEditorCurve(motion, binding); diff --git a/Packages/nadena.dev.modular-avatar/Editor/RenameParametersHook.cs b/Packages/nadena.dev.modular-avatar/Editor/RenameParametersHook.cs index 0e28d828..512e83ab 100644 --- a/Packages/nadena.dev.modular-avatar/Editor/RenameParametersHook.cs +++ b/Packages/nadena.dev.modular-avatar/Editor/RenameParametersHook.cs @@ -327,13 +327,20 @@ namespace nadena.dev.modular_avatar.core.editor blendTree.blendParameter = remap(remaps, blendTree.blendParameter); blendTree.blendParameterY = remap(remaps, blendTree.blendParameterY); - foreach (var childMotion in blendTree.children) + var children = blendTree.children; + for (int i = 0; i < children.Length; i++) { + var childMotion = children[i]; if (childMotion.motion is BlendTree subTree) { ProcessBlendtree(subTree, remaps); } + + childMotion.directBlendParameter = remap(remaps, childMotion.directBlendParameter); + children[i] = childMotion; } + + blendTree.children = children; } private void ProcessDriver(VRCAvatarParameterDriver driver, ImmutableDictionary remaps)