├── CHANGELOG.md
├── CHANGELOG.md.meta
├── Documentation~
├── ATTODO.txt
├── ATTODO.txt.meta
├── AnimationPlayer.md
├── Motivation.txt
├── Motivation.txt.meta
├── rune_skovbo_johansen_thesis.pdf
└── rune_skovbo_johansen_thesis.pdf.meta
├── Editor.meta
├── Editor
├── AnimationPlayer.Editor.asmdef
├── AnimationPlayer.Editor.asmdef.meta
├── AnimationPlayerEditor.cs
├── AnimationPlayerEditor.cs.meta
├── AnimationStatePreviewer.cs
├── AnimationStatePreviewer.cs.meta
├── AnimationStateWrapperEditor.cs
├── AnimationStateWrapperEditor.cs.meta
├── AnimationTransitionDrawer.cs
├── AnimationTransitionDrawer.cs.meta
├── AssemblyInfo.cs
├── AssemblyInfo.cs.meta
├── EditorUtilities.cs
├── EditorUtilities.cs.meta
├── MetaDataDrawer.cs
├── MetaDataDrawer.cs.meta
├── PersistedVal.cs
├── PersistedVal.cs.meta
├── SerializedPropertyExtension.meta
├── SerializedPropertyExtension
│ ├── SerializedPropertyExtension.cs
│ ├── SerializedPropertyExtension.cs.meta
│ ├── SerializedPropertyHelper.cs
│ └── SerializedPropertyHelper.cs.meta
├── StateDataDrawer.cs
├── StateDataDrawer.cs.meta
├── StateSelectionAndAdditionDrawer.cs
├── StateSelectionAndAdditionDrawer.cs.meta
├── TypeRegisterForEditor.cs
├── TypeRegisterForEditor.cs.meta
├── csc.rsp
└── csc.rsp.meta
├── GraphVisualizerFork.meta
├── GraphVisualizerFork
├── GraphVisualizer.meta
└── GraphVisualizer
│ ├── Editor.meta
│ ├── Editor
│ ├── Graph.meta
│ ├── Graph
│ │ ├── Graph.cs
│ │ ├── Graph.cs.meta
│ │ ├── Layouts.meta
│ │ ├── Layouts
│ │ │ ├── IGraphLayout.cs
│ │ │ ├── IGraphLayout.cs.meta
│ │ │ ├── ReingoldTilford.cs
│ │ │ └── ReingoldTilford.cs.meta
│ │ ├── Node.cs
│ │ ├── Node.cs.meta
│ │ ├── Renderer.meta
│ │ └── Renderer
│ │ │ ├── DefaultGraphRenderer.cs
│ │ │ ├── DefaultGraphRenderer.cs.meta
│ │ │ ├── IGraphRenderer.cs
│ │ │ └── IGraphRenderer.cs.meta
│ ├── PlayableGraphVisualizer.cs
│ ├── PlayableGraphVisualizer.cs.meta
│ ├── PlayableGraphVisualizerWindow.cs
│ ├── PlayableGraphVisualizerWindow.cs.meta
│ ├── PlayableNodes.meta
│ ├── PlayableNodes
│ │ ├── AnimationClipPlayableNode.cs
│ │ ├── AnimationClipPlayableNode.cs.meta
│ │ ├── AnimationLayerMixerPlayableNode.cs
│ │ ├── AnimationLayerMixerPlayableNode.cs.meta
│ │ ├── PlayableNode.cs
│ │ ├── PlayableNode.cs.meta
│ │ ├── PlayableOutputNode.cs
│ │ ├── PlayableOutputNode.cs.meta
│ │ ├── SharedPlayableNode.cs
│ │ └── SharedPlayableNode.cs.meta
│ ├── Resources.meta
│ ├── Resources
│ │ ├── Node.png
│ │ └── Node.png.meta
│ ├── Unity.PlayableGraphVisualizer.Editor.asmdef
│ └── Unity.PlayableGraphVisualizer.Editor.asmdef.meta
│ ├── Runtime.meta
│ └── Runtime
│ ├── GraphVisualizerClient.cs
│ ├── GraphVisualizerClient.cs.meta
│ ├── Unity.PlayableGraphVisualizer.asmdef
│ └── Unity.PlayableGraphVisualizer.asmdef.meta
├── LICENSE.md
├── LICENSE.md.meta
├── README.md
├── README.md.meta
├── Runtime.meta
├── Runtime
├── AnimationEvent.cs
├── AnimationEvent.cs.meta
├── AnimationJobs.meta
├── AnimationJobs
│ ├── IKAnimationPlayerConnection.cs
│ ├── IKAnimationPlayerConnection.cs.meta
│ ├── TwoBoneIKConnection.cs
│ ├── TwoBoneIKConnection.cs.meta
│ ├── TwoBoneIKJob.cs
│ └── TwoBoneIKJob.cs.meta
├── AnimationLayer.cs
├── AnimationLayer.cs.meta
├── AnimationLayerType.cs
├── AnimationLayerType.cs.meta
├── AnimationPlayer.asmdef
├── AnimationPlayer.asmdef.meta
├── AnimationPlayer.cs
├── AnimationPlayer.cs.meta
├── AnimationPlayerExtensions.cs
├── AnimationPlayerExtensions.cs.meta
├── AnimationPlayerState.cs
├── AnimationPlayerState.cs.meta
├── AnimationPlayerUpdater.cs
├── AnimationPlayerUpdater.cs.meta
├── AnimationStateCollection.cs
├── AnimationStateCollection.cs.meta
├── AnimationStateWrapper.cs
├── AnimationStateWrapper.cs.meta
├── ArrayExtensions.cs
├── ArrayExtensions.cs.meta
├── AssemblyInfo.cs
├── AssemblyInfo.cs.meta
├── BlendTree1D.cs
├── BlendTree1D.cs.meta
├── BlendTree2D.cs
├── BlendTree2D.cs.meta
├── BlendTreeController1D.cs
├── BlendTreeController1D.cs.meta
├── BlendTreeController2D.cs
├── BlendTreeController2D.cs.meta
├── BlendTreeEntry.cs
├── BlendTreeEntry.cs.meta
├── BlenderPlayableBehaviour.cs
├── BlenderPlayableBehaviour.cs.meta
├── ClipSwapCollection.cs
├── ClipSwapCollection.cs.meta
├── ExtensionMethods.meta
├── ExtensionMethods
│ ├── AssemblyHelper.cs
│ ├── AssemblyHelper.cs.meta
│ ├── ExtensionMethods.cs
│ ├── ExtensionMethods.cs.meta
│ ├── PlayableUtilities.cs
│ └── PlayableUtilities.cs.meta
├── PlayRandomClip.cs
├── PlayRandomClip.cs.meta
├── Sequence.cs
├── Sequence.cs.meta
├── SerializedGUID.cs
├── SerializedGUID.cs.meta
├── SingleClip.cs
├── SingleClip.cs.meta
├── SingleClipPlayer.cs
├── SingleClipPlayer.cs.meta
├── StateTransition.cs
├── StateTransition.cs.meta
├── csc.rsp
└── csc.rsp.meta
├── Samples~
└── DevelopmentSamples
│ ├── TestAssets.meta
│ └── TestAssets
│ ├── CubeController.controller
│ ├── CubeController.controller.meta
│ ├── CubeMask.mask
│ ├── CubeMask.mask.meta
│ ├── EmptyWithIK.controller
│ ├── EmptyWithIK.controller.meta
│ ├── FromStandardAssets.meta
│ ├── FromStandardAssets
│ ├── HumanoidCrouch.fbx
│ ├── HumanoidCrouch.fbx.meta
│ ├── HumanoidIdle.fbx
│ ├── HumanoidIdle.fbx.meta
│ ├── HumanoidIdleJumpUp.fbx
│ ├── HumanoidIdleJumpUp.fbx.meta
│ ├── HumanoidJumpAndFall.fbx
│ ├── HumanoidJumpAndFall.fbx.meta
│ ├── HumanoidMidAir.fbx
│ ├── HumanoidMidAir.fbx.meta
│ ├── HumanoidRun.fbx
│ ├── HumanoidRun.fbx.meta
│ ├── HumanoidRunTurn.fbx
│ ├── HumanoidRunTurn.fbx.meta
│ ├── HumanoidRunTurnSharp.fbx
│ ├── HumanoidRunTurnSharp.fbx.meta
│ ├── HumanoidStandTurn.fbx
│ ├── HumanoidStandTurn.fbx.meta
│ ├── HumanoidWalk.fbx
│ ├── HumanoidWalk.fbx.meta
│ ├── HumanoidWalkTurn.fbx
│ ├── HumanoidWalkTurn.fbx.meta
│ ├── HumanoidWalkTurnSharp.fbx
│ └── HumanoidWalkTurnSharp.fbx.meta
│ ├── High.anim
│ ├── High.anim.meta
│ ├── Idle_lookAround_teri.anim
│ ├── Idle_lookAround_teri.anim.meta
│ ├── Low.anim
│ ├── Low.anim.meta
│ ├── Materials.meta
│ ├── Materials
│ ├── CoatFlap.mat
│ ├── CoatFlap.mat.meta
│ ├── Material.mat
│ ├── Material.mat.meta
│ ├── Material_001.mat
│ ├── Material_001.mat.meta
│ ├── Material_003.mat
│ ├── Material_003.mat.meta
│ ├── Material_004.mat
│ ├── Material_004.mat.meta
│ ├── Material_005.mat
│ ├── Material_005.mat.meta
│ ├── Metal.mat
│ ├── Metal.mat.meta
│ ├── Pants.mat
│ ├── Pants.mat.meta
│ ├── RG_PBR2_Material.mat
│ ├── RG_PBR2_Material.mat.meta
│ ├── RG_PBR2_Material_001.mat
│ ├── RG_PBR2_Material_001.mat.meta
│ ├── Shirt.mat
│ ├── Shirt.mat.meta
│ ├── Teri_RGB.mat
│ └── Teri_RGB.mat.meta
│ ├── Mid.anim
│ ├── Mid.anim.meta
│ ├── RunJog.controller
│ ├── RunJog.controller.meta
│ ├── TeriMask.mask
│ ├── TeriMask.mask.meta
│ ├── Teri_63_Allanimations.blend
│ ├── Teri_63_Allanimations.blend.meta
│ ├── Teri_RGB.png
│ ├── Teri_RGB.png.meta
│ ├── Teri_TestPlayer.prefab
│ ├── Teri_TestPlayer.prefab.meta
│ ├── Test2DBlend.unity
│ ├── Test2DBlend.unity.meta
│ ├── TestCharacter_SimpleHumanoidRig.blend
│ ├── TestCharacter_SimpleHumanoidRig.blend.meta
│ ├── TestController.controller
│ ├── TestController.controller.meta
│ ├── TestScene.unity
│ ├── TestScene.unity.meta
│ ├── TestScene2.unity
│ ├── TestScene2.unity.meta
│ ├── TestScripts.meta
│ ├── TestScripts
│ ├── BlendTest.cs
│ ├── BlendTest.cs.meta
│ ├── CompareAnimatorAnimationPlayer.cs
│ ├── CompareAnimatorAnimationPlayer.cs.meta
│ ├── TestScript.cs
│ └── TestScript.cs.meta
│ ├── idle_RFoot_teri.anim
│ └── idle_RFoot_teri.anim.meta
├── Tests.meta
├── Tests
├── Editor.meta
└── Editor
│ ├── AnimationPlayer.Editor.Tests.asmdef
│ ├── AnimationPlayer.Editor.Tests.asmdef.meta
│ ├── TestSetValue.cs
│ └── TestSetValue.cs.meta
├── package.json
└── package.json.meta
/CHANGELOG.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/CHANGELOG.md
--------------------------------------------------------------------------------
/CHANGELOG.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ac7f711d7e7e8f6449a1f564658f666f
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Documentation~/ATTODO.txt:
--------------------------------------------------------------------------------
1 | - means "should do"
2 | + means "done!"
3 | * means "working on RIGHT THE FUCK NOW"
4 |
5 | Animation states:
6 | - Have the states get a GUID rather than an index, to support reordering and stuff better.
7 | - Different kinds of states:
8 | * blend trees
9 | * 2D (almost finished, need to implement the good algo!)
10 | + allow state reordering
11 | - add speed to blend tree entries, not just the entire blend tree
12 | - When updating thresholds on 1D trees, do the Unity thing and reorder the states?
13 | - sequences (state A into state B into state C, etc.)
14 | - this can be used to change into a specific idle state after standing still.
15 | * random (bunch of states, selects a random one when you enter)
16 | - nested
17 | - allow one kind of state to be a part of a different kind of state. So a random can contain blend trees and blend trees can contain blend trees and whatnot
18 | - Check if it's possible to loop/not loop in the state, and how expensive that is compared to the native (stupid) way of doing it
19 | + Add support for dragging animation clips over the list of states to generate a new state
20 | + Also add support for dragging in the .fbx or .blend or whatever (ModelImporter), and add all clips in it
21 | + If you drag in several, create a "Do you want to add many clips or blend tree" menu
22 | - Add select random to the "do you want to add etc." menu
23 | * Preview (oh my!)
24 | + preview for single-clip states
25 | + preview for other kinds of states
26 | - allow for setting blend vars on previews
27 | - previews for transitions
28 | + make sure the time slider gives the actual animation time! Now it's going to desynchronize (although the relative value is good)
29 | + reset to bind pose after the preview is done
30 | * Animation events!
31 | + Make own tab for animation events
32 | + Define API.
33 | + Make sure events are called
34 | - Make settings:
35 | - min blend factor - default to 0. Only call the event if the current blend factor is larger than this
36 | - Play only first/repeat. If the animation loops, do we want this to happen every time, or just the first one?
37 | - Make it possible to play an animation relative to the current position. This will make Unity-created animations for eg. doors be a _LOT_ easier, and faster to boot.
38 | - Add support for mirroring.
39 |
40 | Animation transitions:
41 | - Redo entire layout. Having the transitions store from and to is silly, and the current "default" implementation is wonk. Here's a better version:
42 | - The Animation Layer has a array "B" where each entry is a (int targetState, Transition transition).
43 | - The Animation Layer also has an array "A" where each entry is (int firstIndex, int numTransitions)
44 | - All the transitions for state i are stored between B[A[i].firstIndex] and B[A[i].firstIndex + A[i].numTransitions]
45 | - The default transition from state i to state j is the earliest transition from state i that targets j.
46 | - This layout is pretty error-free
47 |
48 | + Transition-by-clip:
49 | If you're transitioning from A to B, specify a clip C so the transition is A->C->B.
50 | This will be usefull for run-stops and such.
51 | Have to figure out if C here is a clip, another state in the state view, or another state in a special view.
52 | + Several ways of transitioning between two states
53 | probably want default transition and named transition
54 | * Better layout! Show list of all defined transitions
55 | + There's a list of all transitions defined from the current state
56 | - Should have a list of ALL transitions?
57 |
58 | Misc
59 | - Move AnimationPlayer.Update to it's own method that runs after Update, using the new player loop system, when it's available (2018.1)
60 | - Update on that - that's a bit hard. There's an easy part - where we generate a list of AnimationPlayers and have the static method added to the
61 | Player Loop that iterates the AnimationPlayers is easy. The hard part is not fucking with the user's use of the player loop system.
62 | - Add delete buttons to blend trees etc.
63 | - Ensure that all public methods in AnimationPlayer have int overload, so it's not neccessary to pay the cost of sending in strings
64 | - Make the cached values in the editor be per-layer where appropriate (selected from/to state for transitions)
65 | - Make a caching system that doesn't depend on EditorPrefs? Cluttering the registry is an ugly hack.
66 | - But then where?
67 | - Add re-order support to things? Or better view for states
68 | + reorder for blend trees done.
69 | - Metadata:
70 | - list all transitions (with go-to buttons)
71 | + list all fbx/.anim files referenced
72 | + list all clips used
73 | - list all blend variables
74 | - make sure all of these lists update when stuff is added. On changing tab is not enough, could have two inspectors open
75 | + AnimationPlayer should have internal BlendVarControllers, so there's not duplication between SetBlendVar and GetBlendVarController().SetValue
76 | - Dump info about which animations have been played for how long, often, etc.
77 | - Make the Drag And Drop hint when dragging objects only show up if dragged objects are animation clips or has animation clips as sub assets.
78 | - Make EVERYTHING have tooltips
79 | - Make sure nothing nullrefs for empty clips anywhere.
80 |
81 | Issues:
82 | - Calling Play("MyState") every frame will cause MyState to never play, if wherever you're calling from executes Update before the AnimationPlayer.
83 | This is because the timer for when the transition was started gets reset to this frame every time you call it. I don't have any good solutions for
84 | this, but then again, calling Play("Attack") in Update is a bit insane.
85 |
86 | Possible optimizations:
87 | - We do what the Animator's doing, and have all the states that's in the AnimationPlayer added to the mixer, with the vast majority of them with weight 0.
88 | It might be that it would be faster to only have the states that have a non-zero weight in the mixer. That would require re-writing quite a bit, and would make the
89 | visualizer less usefull, so only do it if there's an actual gain to be had.
90 | - Do a check for GC!
--------------------------------------------------------------------------------
/Documentation~/ATTODO.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a53131e8539a4394ea3d3dad9a8d3cc2
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Documentation~/AnimationPlayer.md:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Documentation~/AnimationPlayer.md
--------------------------------------------------------------------------------
/Documentation~/Motivation.txt.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bd6f2cdaf19bd8b49ac65fe2d03999f7
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Documentation~/rune_skovbo_johansen_thesis.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Documentation~/rune_skovbo_johansen_thesis.pdf
--------------------------------------------------------------------------------
/Documentation~/rune_skovbo_johansen_thesis.pdf.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8b529aff9676ed343a6c9ec64a4baf44
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cb324097b5bada841b130974e05f10fe
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor/AnimationPlayer.Editor.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "AnimationPlayer.Editor",
3 | "references": [
4 | "AnimationPlayer"
5 | ],
6 | "optionalUnityReferences": [],
7 | "includePlatforms": [
8 | "Editor"
9 | ],
10 | "excludePlatforms": [],
11 | "allowUnsafeCode": false,
12 | "overrideReferences": false,
13 | "precompiledReferences": [],
14 | "autoReferenced": true,
15 | "defineConstraints": []
16 | }
--------------------------------------------------------------------------------
/Editor/AnimationPlayer.Editor.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bf4f4b18002277b4296c72f66f8978d1
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Editor/AnimationPlayerEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5453c1c8520420e4e80c4ebbd1db13d2
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/AnimationStatePreviewer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 145033d3971642ca91b975d94fa703c5
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/AnimationStateWrapperEditor.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityEditor;
3 |
4 | namespace Animation_Player {
5 | [CustomEditor(typeof(AnimationStateWrapper))]
6 | public class AnimationStateWrapperEditor : Editor {
7 | private AnimationStateWrapper animationStateWrapper;
8 | private AnimationStateWrapper.Type currentType;
9 |
10 | private void OnEnable() {
11 | animationStateWrapper = (AnimationStateWrapper) target;
12 | currentType = animationStateWrapper.type;
13 | }
14 |
15 | public override void OnInspectorGUI() {
16 | animationStateWrapper.type = (AnimationStateWrapper.Type) EditorGUILayout.EnumPopup(animationStateWrapper.type);
17 | if (currentType != animationStateWrapper.type) {
18 | ResetType(currentType);
19 | currentType = animationStateWrapper.type;
20 | }
21 |
22 | GUILayout.Space(10f);
23 | DrawCurrentSelectedState(currentType);
24 | }
25 |
26 | private void DrawCurrentSelectedState(AnimationStateWrapper.Type type) {
27 | bool markDirty = false;
28 | StateDataDrawer.ReloadCheck();
29 | AnimationPlayerState selectedState = null;
30 | if (type == AnimationStateWrapper.Type.BlendTree1D)
31 | selectedState = animationStateWrapper.blendTree1D;
32 | else if (type == AnimationStateWrapper.Type.BlendTree2D)
33 | selectedState = animationStateWrapper.blendTree2D;
34 | else if (type == AnimationStateWrapper.Type.PlayRandomClip)
35 | selectedState = animationStateWrapper.playRandomClip;
36 | else if (type == AnimationStateWrapper.Type.SingleClip)
37 | selectedState = animationStateWrapper.singleClip;
38 |
39 | if (selectedState != null)
40 | StateDataDrawer.DrawStateData(selectedState, ref markDirty);
41 |
42 | if (markDirty)
43 | EditorUtility.SetDirty(animationStateWrapper);
44 | }
45 |
46 | private void ResetType(AnimationStateWrapper.Type type) {
47 | if (type == AnimationStateWrapper.Type.BlendTree1D)
48 | animationStateWrapper.blendTree1D = null;
49 | else if (type == AnimationStateWrapper.Type.BlendTree2D)
50 | animationStateWrapper.blendTree2D = null;
51 | else if (type == AnimationStateWrapper.Type.PlayRandomClip)
52 | animationStateWrapper.playRandomClip = null;
53 | else if (type == AnimationStateWrapper.Type.SingleClip)
54 | animationStateWrapper.singleClip = null;
55 |
56 | EditorUtility.SetDirty(animationStateWrapper);
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/Editor/AnimationStateWrapperEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 60a68330ba2840748ac0153d326bf792
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/AnimationTransitionDrawer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7f221d166e784f52817d08d51ac66d26
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("AnimationPlayer.Editor.Tests")]
--------------------------------------------------------------------------------
/Editor/AssemblyInfo.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 630f103107beac74c9b371a2e7ed683e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/EditorUtilities.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a240b797fd134900968e9592d398373e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/MetaDataDrawer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 151319c325cb4151be8a4a36931a6a8f
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/PersistedVal.cs:
--------------------------------------------------------------------------------
1 | using UnityEditor;
2 | using UnityEngine;
3 |
4 | namespace Animation_Player
5 | {
6 | ///
7 | /// Persisted (to EditorPrefs) int value for edit mode that survives assembly reloads.
8 | /// Use for making editors not reset when you recompile scripts.
9 | ///
10 | /// Uses the edited element's instanceID (or any int, but you know) to match value with object.
11 | ///
12 | public abstract class PersistedVal
13 | {
14 | private readonly string key;
15 | private T cachedVal;
16 |
17 | protected PersistedVal(string key)
18 | {
19 | this.key = key;
20 | cachedVal = Get();
21 | }
22 |
23 | public void SetTo(T value)
24 | {
25 | if (ToInt(value) != ToInt(cachedVal))
26 | {
27 | EditorPrefs.SetInt(key, ToInt(value));
28 | cachedVal = value;
29 | }
30 | }
31 |
32 | private T Get()
33 | {
34 | return ToType(EditorPrefs.GetInt(key, 0));
35 | }
36 |
37 | public static implicit operator T(PersistedVal p)
38 | {
39 | return p.Get();
40 | }
41 |
42 | protected abstract int ToInt(T val);
43 |
44 | protected abstract T ToType(int i);
45 |
46 | public override string ToString()
47 | {
48 | return cachedVal.ToString();
49 | }
50 | }
51 |
52 | public class PersistedInt : PersistedVal
53 | {
54 | public PersistedInt(string key) : base(key) { }
55 |
56 | protected override int ToInt(int val)
57 | {
58 | return val;
59 | }
60 |
61 | protected override int ToType(int i)
62 | {
63 | return i;
64 | }
65 | }
66 |
67 | public class PersistedShortPair : PersistedVal<(short first, short second)>
68 | {
69 | public PersistedShortPair(string key) : base(key) { }
70 |
71 | protected override int ToInt((short first, short second) val)
72 | {
73 | return (val.first << 16) + val.second;
74 | }
75 |
76 | protected override (short first, short second) ToType(int i)
77 | {
78 | var first = (short) (i >> 16);
79 | var second = (short) i;
80 |
81 | return (first, second);
82 | }
83 |
84 | public void Deconstruct(out short first, out short second) {
85 | (short, short) value = this;
86 | first = value.Item1;
87 | second = value.Item2;
88 | }
89 | }
90 |
91 | public class PersistedBool : PersistedVal
92 | {
93 | public PersistedBool(string key) : base(key) { }
94 |
95 | protected override int ToInt(bool val)
96 | {
97 | return val ? 1 : 0;
98 | }
99 |
100 | protected override bool ToType(int i)
101 | {
102 | return i != 0;
103 | }
104 | }
105 | }
--------------------------------------------------------------------------------
/Editor/PersistedVal.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2c41bee59ff94c19929afadb4341e0e3
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/SerializedPropertyExtension.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ed359156fd3d24f47acc7b70bb2aa1df
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Editor/SerializedPropertyExtension/SerializedPropertyExtension.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 110c1159c9194c9d98b9731038ed2a9a
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/SerializedPropertyExtension/SerializedPropertyHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 665a65d7fd68d4849bf694b3be9abbe0
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/StateDataDrawer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9066b04a31f44c4394ec4c1be6462b3f
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/StateSelectionAndAdditionDrawer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 22fc84f992ca4bedadd025629aeb853c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/TypeRegisterForEditor.cs:
--------------------------------------------------------------------------------
1 | namespace Animation_Player
2 | {
3 | // internal class AnimationLayerContainer : ValueContainer {}
4 | }
--------------------------------------------------------------------------------
/Editor/TypeRegisterForEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fdec704d8fcb4e0d8323d05bfaa90cc0
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Editor/csc.rsp:
--------------------------------------------------------------------------------
1 | -nowarn:0649
--------------------------------------------------------------------------------
/Editor/csc.rsp.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ebdb581242596a5429613c943451f0b5
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/GraphVisualizerFork.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bb788e40d12374c45863b6fe1276eab4
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 65249a7ae48f4904cb8d8a9d1e530cbc
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e31b321e847f0564297ea05721c0ad2e
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 569c993bef0ef6146b1b8cbb904bdfde
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Graph.cs:
--------------------------------------------------------------------------------
1 | using System.Collections;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 |
5 | namespace GraphVisualizer
6 | {
7 | public abstract class Graph : IEnumerable
8 | {
9 | private readonly List m_Nodes = new List();
10 |
11 | public ReadOnlyCollection nodes
12 | {
13 | get { return m_Nodes.AsReadOnly(); }
14 | }
15 |
16 | protected class NodeWeight
17 | {
18 | public object node { get; set; }
19 | public float weight { get; set; }
20 | }
21 |
22 | // Derived class should specify the children of a given node.
23 | protected abstract IEnumerable GetChildren(Node node);
24 |
25 | // Derived class should implement how to populate this graph (usually by calling AddNodeHierarchy()).
26 | protected abstract void Populate();
27 |
28 | public void AddNodeHierarchy(Node root)
29 | {
30 | AddNode(root);
31 |
32 | IEnumerable children = GetChildren(root);
33 | if (children == null)
34 | return;
35 |
36 | foreach (Node child in children)
37 | {
38 | root.AddChild(child);
39 | AddNodeHierarchy(child);
40 | }
41 | }
42 |
43 | public void AddNode(Node node)
44 | {
45 | m_Nodes.Add(node);
46 | }
47 |
48 | public void Clear()
49 | {
50 | m_Nodes.Clear();
51 | }
52 |
53 | public void Refresh()
54 | {
55 | // TODO optimize?
56 | Clear();
57 | Populate();
58 | }
59 |
60 | public IEnumerator GetEnumerator()
61 | {
62 | return m_Nodes.GetEnumerator();
63 | }
64 |
65 | IEnumerator IEnumerable.GetEnumerator()
66 | {
67 | return m_Nodes.GetEnumerator();
68 | }
69 |
70 | public bool IsEmpty()
71 | {
72 | return m_Nodes.Count == 0;
73 | }
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Graph.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 147d962da65506442b417599ddc1ca7e
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Layouts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1ba77f7c2ab935748b7f3d4559ed450c
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Layouts/IGraphLayout.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 |
4 | namespace GraphVisualizer
5 | {
6 | // Interface for a generic graph layout.
7 | public interface IGraphLayout
8 | {
9 | IEnumerable vertices { get; }
10 | IEnumerable edges { get; }
11 |
12 | bool leftToRight { get; }
13 |
14 | void CalculateLayout(Graph graph);
15 | }
16 |
17 | public class Edge
18 | {
19 | // Indices in the vertex array of the layout algorithm.
20 | public Edge(Vertex src, Vertex dest)
21 | {
22 | source = src;
23 | destination = dest;
24 | }
25 |
26 | public Vertex source { get; private set; }
27 |
28 | public Vertex destination { get; private set; }
29 | }
30 |
31 | // One vertex is associated to each node in the graph.
32 | public class Vertex
33 | {
34 | // Center of the node in the graph layout.
35 | public Vector2 position { get; set; }
36 |
37 | // The Node represented by the vertex.
38 | public Node node { get; private set; }
39 |
40 | public Vertex(Node node)
41 | {
42 | this.node = node;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Layouts/IGraphLayout.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5171cb2fc868cda4bbfd28e24fe5d37c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Layouts/ReingoldTilford.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 51bcffb11720b2748b8b520d55c94a12
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Node.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using UnityEngine;
5 |
6 | namespace GraphVisualizer
7 | {
8 | public class Node
9 | {
10 | public object content { get; private set; }
11 | public float weight { get; set; }
12 | public bool active { get; private set; }
13 | public Node parent { get; private set; }
14 | public IList children { get; private set; }
15 |
16 | public Node(object content, float weight = 1.0f, bool active = false)
17 | {
18 | this.content = content;
19 | this.weight = weight;
20 | this.active = active;
21 | children = new List();
22 | }
23 |
24 | public void AddChild(Node child)
25 | {
26 | if (child == this) throw new Exception("Circular graphs not supported.");
27 | if (child.parent == this) return;
28 |
29 | children.Add(child);
30 | child.parent = this;
31 | }
32 |
33 | public int depth
34 | {
35 | get { return GetDepthRecursive(this); }
36 | }
37 |
38 | private static int GetDepthRecursive(Node node)
39 | {
40 | if (node.parent == null) return 1;
41 | return 1 + GetDepthRecursive(node.parent);
42 | }
43 |
44 | public virtual Type GetContentType()
45 | {
46 | return content == null ? null : content.GetType();
47 | }
48 |
49 | public virtual string GetContentTypeName()
50 | {
51 | Type type = GetContentType();
52 | return type == null ? "Null" : type.ToString();
53 | }
54 |
55 | public virtual string GetContentTypeShortName()
56 | {
57 | return GetContentTypeName().Split('.').Last();
58 | }
59 |
60 | public override string ToString()
61 | {
62 | return "Node content: " + GetContentTypeName();
63 | }
64 |
65 | public virtual Color GetColor()
66 | {
67 | Type type = GetContentType();
68 | if (type == null)
69 | return Color.red;
70 |
71 | string shortName = type.ToString().Split('.').Last();
72 | float h = (float)Math.Abs(shortName.GetHashCode()) / int.MaxValue;
73 | return Color.HSVToRGB(h, 0.6f, 1.0f);
74 | }
75 | }
76 | }
77 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Node.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0a5e939f109486342a621dfffb0e92a4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Renderer.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6e6f7481b1110e348aafbed5c3c6f137
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Renderer/DefaultGraphRenderer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d45f2cc7e37418943add43a01253a63d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Renderer/IGraphRenderer.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace GraphVisualizer
4 | {
5 | // Interface for rendering a tree layout to screen.
6 | public interface IGraphRenderer
7 | {
8 | void Draw(IGraphLayout graphLayout, Rect drawingArea);
9 | void Draw(IGraphLayout graphLayout, Rect drawingArea, GraphSettings graphSettings);
10 | }
11 |
12 | // Customization of how the graph will be displayed:
13 | // - size, distances and proportions of nodes
14 | // - legend
15 | public struct GraphSettings
16 | {
17 | // In layout units. If 1, node will be drawn as large as possible to avoid overlapping, and to respect aspect ratio
18 | public float maximumNormalizedNodeSize;
19 |
20 | // when the graph is very simple, the nodes can seem disproportionate relative to the graph. This limits their size
21 | public float maximumNodeSizeInPixels;
22 |
23 | // width / height; 1 represents a square node
24 | public float aspectRatio;
25 |
26 | // Control the display of the legend.
27 | public bool showInspector;
28 |
29 | // Control the display of the legend.
30 | public bool showLegend;
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Graph/Renderer/IGraphRenderer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 47122040c55769e499116b580917bc82
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableGraphVisualizer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine.Animations;
3 | using UnityEngine.Playables;
4 |
5 | namespace GraphVisualizer
6 | {
7 | public class PlayableGraphVisualizer : Graph
8 | {
9 | private PlayableGraph m_PlayableGraph;
10 |
11 | public PlayableGraphVisualizer(PlayableGraph playableGraph)
12 | {
13 | m_PlayableGraph = playableGraph;
14 | }
15 |
16 | protected override void Populate()
17 | {
18 | if (!m_PlayableGraph.IsValid())
19 | return;
20 |
21 | int outputs = m_PlayableGraph.GetOutputCount();
22 | for (int i = 0; i < outputs; i++)
23 | {
24 | var output = m_PlayableGraph.GetOutput(i);
25 | if(output.IsOutputValid())
26 | {
27 | AddNodeHierarchy(CreateNodeFromPlayableOutput(output));
28 | }
29 | }
30 | }
31 |
32 | protected override IEnumerable GetChildren(Node node)
33 | {
34 | // Children are the Playable Inputs.
35 | if(node is PlayableNode)
36 | return GetInputsFromPlayableNode((Playable)node.content);
37 | if(node is PlayableOutputNode)
38 | return GetInputsFromPlayableOutputNode((PlayableOutput)node.content);
39 |
40 | return new List();
41 | }
42 |
43 | private List GetInputsFromPlayableNode(Playable h)
44 | {
45 | var inputs = new List();
46 | if (h.IsValid())
47 | {
48 | for (int port = 0; port < h.GetInputCount(); ++port)
49 | {
50 | Playable playable = h.GetInput(port);
51 | if (playable.IsValid())
52 | {
53 | float weight = h.GetInputWeight(port);
54 | Node node = CreateNodeFromPlayable(playable, weight);
55 | inputs.Add(node);
56 | }
57 | }
58 | }
59 | return inputs;
60 | }
61 |
62 | private List GetInputsFromPlayableOutputNode(PlayableOutput h)
63 | {
64 | var inputs = new List();
65 | if (h.IsOutputValid())
66 | {
67 | Playable playable = h.GetSourcePlayable();
68 | if (playable.IsValid())
69 | {
70 | Node node = CreateNodeFromPlayable(playable, 1);
71 | inputs.Add(node);
72 | }
73 | }
74 | return inputs;
75 | }
76 |
77 | private PlayableNode CreateNodeFromPlayable(Playable h, float weight)
78 | {
79 | var type = h.GetPlayableType();
80 | if (type == typeof(AnimationClipPlayable))
81 | return new AnimationClipPlayableNode(h, weight);
82 | if (type == typeof(AnimationLayerMixerPlayable))
83 | return new AnimationLayerMixerPlayableNode(h, weight);
84 | return new PlayableNode(h, weight);
85 | }
86 |
87 | private PlayableOutputNode CreateNodeFromPlayableOutput(PlayableOutput h)
88 | {
89 | return new PlayableOutputNode(h);
90 | }
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableGraphVisualizer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6916b006634cd21469ca63e6425c528b
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableGraphVisualizerWindow.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0d5877bb4ffe3464b96f021ac399d1a9
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableNodes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6de1d78f98164fba9586bb01c76f0633
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableNodes/AnimationClipPlayableNode.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using UnityEngine.Animations;
3 | using UnityEngine.Playables;
4 |
5 | namespace GraphVisualizer
6 | {
7 | public class AnimationClipPlayableNode : PlayableNode
8 | {
9 | public AnimationClipPlayableNode(Playable content, float weight = 1.0f)
10 | : base(content, weight)
11 | {
12 | }
13 |
14 | public override string ToString()
15 | {
16 | var sb = new StringBuilder();
17 |
18 | sb.AppendLine(base.ToString());
19 |
20 | var p = (Playable) content;
21 | if (p.IsValid())
22 | {
23 | var acp = (AnimationClipPlayable) p;
24 | var clip = acp.GetAnimationClip();
25 | sb.AppendLine(InfoString("Clip", clip ? clip.name : "(none)"));
26 | if (clip)
27 | {
28 | sb.AppendLine(InfoString("ClipLength", clip.length));
29 | }
30 | sb.AppendLine(InfoString("ApplyFootIK", acp.GetApplyFootIK()));
31 | sb.AppendLine(InfoString("ApplyPlayableIK", acp.GetApplyPlayableIK()));
32 | }
33 |
34 | return sb.ToString();
35 | }
36 | }
37 | }
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableNodes/AnimationClipPlayableNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c8a64993dff7471c82e0857c60d771f9
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableNodes/AnimationLayerMixerPlayableNode.cs:
--------------------------------------------------------------------------------
1 | using System.Text;
2 | using UnityEngine.Animations;
3 | using UnityEngine.Playables;
4 |
5 | namespace GraphVisualizer
6 | {
7 | public class AnimationLayerMixerPlayableNode : PlayableNode
8 | {
9 | public AnimationLayerMixerPlayableNode(Playable content, float weight = 1.0f)
10 | : base(content, weight)
11 | {
12 | }
13 |
14 | public override string ToString()
15 | {
16 | var sb = new StringBuilder();
17 |
18 | sb.AppendLine(base.ToString());
19 |
20 | var p = (Playable) content;
21 | if (p.IsValid())
22 | {
23 | var almp = (AnimationLayerMixerPlayable) p;
24 | for (uint i = 0; i < almp.GetInputCount(); ++i)
25 | sb.AppendLine(InfoString(string.Format("IsLayerAdditive #{0}", i + 1), almp.IsLayerAdditive(i)));
26 | }
27 |
28 | return sb.ToString();
29 | }
30 | }
31 | }
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableNodes/AnimationLayerMixerPlayableNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a7134908431664a5f93c280d29638fe6
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableNodes/PlayableNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using UnityEngine.Playables;
4 |
5 | namespace GraphVisualizer
6 | {
7 | public class PlayableNode : SharedPlayableNode
8 | {
9 | public PlayableNode(Playable content, float weight = 1.0f)
10 | : base(content, weight, content.GetPlayState() == PlayState.Playing)
11 | {
12 | }
13 |
14 | public override Type GetContentType()
15 | {
16 | Playable p = Playable.Null;
17 | try
18 | {
19 | p = (Playable) content;
20 | }
21 | catch
22 | {
23 | // Ignore.
24 | }
25 |
26 | return p.IsValid() ? p.GetPlayableType() : null;
27 | }
28 |
29 | public override string GetContentTypeShortName()
30 | {
31 | // Remove the extra Playable at the end of the Playable types.
32 | string shortName = base.GetContentTypeShortName();
33 | string cleanName = RemoveFromEnd(shortName, "Playable");
34 | return string.IsNullOrEmpty(cleanName) ? shortName : cleanName;
35 | }
36 |
37 | public override string ToString()
38 | {
39 | var sb = new StringBuilder();
40 |
41 | sb.AppendLine(InfoString("Handle", GetContentTypeShortName()));
42 |
43 | var p = (Playable) content;
44 | sb.AppendLine(InfoString("IsValid", p.IsValid()));
45 | if (p.IsValid())
46 | {
47 | sb.AppendLine(InfoString("IsDone", p.IsDone()));
48 | sb.AppendLine(InfoString("InputCount", p.GetInputCount()));
49 | sb.AppendLine(InfoString("OutputCount", p.GetOutputCount()));
50 | sb.AppendLine(InfoString("PlayState", p.GetPlayState()));
51 | sb.AppendLine(InfoString("Speed", p.GetSpeed()));
52 | sb.AppendLine(InfoString("Duration", p.GetDuration()));
53 | sb.AppendLine(InfoString("Time", p.GetTime()));
54 | }
55 |
56 | return sb.ToString();
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableNodes/PlayableNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0e774d676f04404684f86d6345ff0db4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableNodes/PlayableOutputNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Text;
3 | using UnityEngine.Playables;
4 | using UnityEditor.Playables;
5 |
6 | namespace GraphVisualizer
7 | {
8 | public class PlayableOutputNode : SharedPlayableNode
9 | {
10 | public PlayableOutputNode(PlayableOutput content)
11 | : base(content, content.GetWeight(), true)
12 | {
13 | }
14 |
15 | public override Type GetContentType()
16 | {
17 | PlayableOutput po = PlayableOutput.Null;
18 | try
19 | {
20 | po = (PlayableOutput) content;
21 | }
22 | catch
23 | {
24 | // Ignore.
25 | }
26 |
27 | return po.IsOutputValid() ? po.GetPlayableOutputType() : null;
28 | }
29 |
30 | public override string GetContentTypeShortName()
31 | {
32 | // Remove the extra Playable at the end of the Playable types.
33 | string shortName = base.GetContentTypeShortName();
34 | string cleanName = RemoveFromEnd(shortName, "PlayableOutput") + "Output";
35 | return string.IsNullOrEmpty(cleanName) ? shortName : cleanName;
36 | }
37 |
38 | public override string ToString()
39 | {
40 | var sb = new StringBuilder();
41 |
42 | sb.AppendLine(InfoString("Handle", GetContentTypeShortName()));
43 |
44 | var po = (PlayableOutput) content;
45 | if (po.IsOutputValid())
46 | {
47 | #if UNITY_2019_1_OR_NEWER
48 | sb.AppendLine(InfoString("Name", po.GetEditorName()));
49 | #endif
50 | sb.AppendLine(InfoString("IsValid", po.IsOutputValid()));
51 | sb.AppendLine(InfoString("Weight", po.GetWeight()));
52 | #if UNITY_2018_2_OR_NEWER
53 | sb.AppendLine(InfoString("SourceOutputPort", po.GetSourceOutputPort()));
54 | #else
55 | sb.AppendLine(InfoString("SourceInputPort", po.GetSourceInputPort()));
56 | #endif
57 | }
58 |
59 | return sb.ToString();
60 | }
61 | }
62 | }
63 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableNodes/PlayableOutputNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c833ea0f9e2c4e728025d542f53eb505
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableNodes/SharedPlayableNode.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace GraphVisualizer
4 | {
5 | public class SharedPlayableNode : Node
6 | {
7 | public SharedPlayableNode(object content, float weight = 1.0f, bool active = false)
8 | : base(content, weight, active)
9 | {
10 | }
11 |
12 | protected static string InfoString(string key, double value)
13 | {
14 | if (Math.Abs(value) < 100000.0)
15 | return string.Format("{0}: {1:#.###}", key, value);
16 | if (value == double.MaxValue)
17 | return string.Format("{0}: +Inf", key);
18 | if (value == double.MinValue)
19 | return string.Format("{0}: -Inf", key);
20 | return string.Format("{0}: {1:E4}", key, value);
21 | }
22 |
23 | protected static string InfoString(string key, int value)
24 | {
25 | return string.Format("{0}: {1:D}", key, value);
26 | }
27 |
28 | protected static string InfoString(string key, object value)
29 | {
30 | return "" + key + ": " + (value ?? "(none)");
31 | }
32 |
33 | protected static string RemoveFromEnd(string str, string suffix)
34 | {
35 | if (str.EndsWith(suffix))
36 | {
37 | return str.Substring(0, str.Length - suffix.Length);
38 | }
39 |
40 | return str;
41 | }
42 | }
43 | }
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/PlayableNodes/SharedPlayableNode.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6c8170737f3d421585799e0ea80b4549
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Resources.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 45ead97298b414d48a80edc5808f19d8
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Resources/Node.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/GraphVisualizerFork/GraphVisualizer/Editor/Resources/Node.png
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Resources/Node.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3fa46d96b130e304983151d9c178b928
3 | TextureImporter:
4 | fileIDToRecycleName: {}
5 | externalObjects: {}
6 | serializedVersion: 9
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 1
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 0
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: -1
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: -1
38 | wrapV: -1
39 | wrapW: -1
40 | nPOTScale: 1
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 0
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 1
52 | alphaIsTransparency: 0
53 | spriteTessellationDetail: -1
54 | textureType: 0
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 2
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 1
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | spriteSheet:
73 | serializedVersion: 2
74 | sprites: []
75 | outline: []
76 | physicsShape: []
77 | bones: []
78 | spriteID:
79 | vertices: []
80 | indices:
81 | edges: []
82 | weights: []
83 | spritePackingTag:
84 | pSDRemoveMatte: 0
85 | pSDShowRemoveMatteOption: 0
86 | userData:
87 | assetBundleName:
88 | assetBundleVariant:
89 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Unity.PlayableGraphVisualizer.Editor.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Unity.PlayableGraphVisualizer.Editor",
3 | "references": [
4 | "Unity.PlayableGraphVisualizer"
5 | ],
6 | "includePlatforms": [
7 | "Editor"
8 | ],
9 | "excludePlatforms": []
10 | }
11 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Editor/Unity.PlayableGraphVisualizer.Editor.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2702b94ed25b25fdda2226e5c974e9e8
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 1ebc3035c53a88d40b60a1484e496e9a
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Runtime/GraphVisualizerClient.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine.Playables;
3 |
4 | // Bridge between runtime and editor code: the graph created in runtime code can call GraphVisualizerClient.Show(...)
5 | // and the EditorWindow will register itself with the client to display any available graph.
6 | public class GraphVisualizerClient
7 | {
8 | private static GraphVisualizerClient s_Instance;
9 | private List m_Graphs = new List();
10 | private Dictionary m_GraphNames = new Dictionary();
11 |
12 | public static GraphVisualizerClient instance
13 | {
14 | get
15 | {
16 | if (s_Instance == null)
17 | s_Instance = new GraphVisualizerClient();
18 | return s_Instance;
19 | }
20 | }
21 |
22 | ~GraphVisualizerClient()
23 | {
24 | m_Graphs.Clear();
25 | }
26 |
27 | public static void Show(PlayableGraph graph)
28 | {
29 | #if UNITY_EDITOR
30 | Show(graph, graph.GetEditorName());
31 | #else
32 | Show(graph, null);
33 | #endif
34 | }
35 |
36 | public static void Show(PlayableGraph graph, string name)
37 | {
38 | if (!instance.m_Graphs.Contains(graph))
39 | {
40 | instance.m_Graphs.Add(graph);
41 | }
42 | instance.m_GraphNames[graph] = name;
43 | }
44 |
45 | public static void Hide(PlayableGraph graph)
46 | {
47 | instance.m_Graphs.Remove(graph);
48 | instance.m_GraphNames.Remove(graph);
49 | }
50 |
51 | public static void ClearGraphs()
52 | {
53 | instance.m_Graphs.Clear();
54 | }
55 |
56 | public static IEnumerable GetGraphs()
57 | {
58 | return instance.m_Graphs;
59 | }
60 |
61 | public static string GetName(PlayableGraph graph)
62 | {
63 | if (instance.m_GraphNames.TryGetValue(graph, out var name))
64 | {
65 | return name;
66 | }
67 | return null;
68 | }
69 | }
70 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Runtime/GraphVisualizerClient.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9114e458dd675a840b81a836551082c4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Runtime/Unity.PlayableGraphVisualizer.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "Unity.PlayableGraphVisualizer",
3 | "references": [],
4 | "includePlatforms": [],
5 | "excludePlatforms": []
6 | }
7 |
--------------------------------------------------------------------------------
/GraphVisualizerFork/GraphVisualizer/Runtime/Unity.PlayableGraphVisualizer.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d8e7b33ba1e4a89fc8a64b6b1e97a6ac
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Baste Nesse Buanes
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/LICENSE.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 89cdaebc7ff607840b9582c906c64849
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/README.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b0285d60c05b9ca4ab95b9e27073226c
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eadcfefb8049ea44b955d4943a7b4d07
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/AnimationEvent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 |
4 | namespace Animation_Player {
5 | [Serializable]
6 | public class AnimationEvent
7 | {
8 | ///
9 | /// Name of the Animation Event, used to bind event receivers.
10 | ///
11 | public string name;
12 | ///
13 | /// At what time in the state the event should be played, in seconds.
14 | ///
15 | public double time;
16 | ///
17 | /// Only play this animation event if it's on the active state. If false, it's also played on states being blended out of.
18 | ///
19 | public bool mustBeActiveState = true;
20 | ///
21 | /// The minimum weight needed for the event to fire. If the weight is less than this, the event will be skipped.
22 | ///
23 | public float minWeight = .5f;
24 |
25 | private readonly List registeredActions = new List();
26 | private readonly List registeredActionsForCurrentState = new List();
27 |
28 | public void RegisterListener(Action listener)
29 | {
30 | registeredActions.Add(listener);
31 | }
32 |
33 | public void ClearRegisteredForCurrentState()
34 | {
35 | registeredActionsForCurrentState.Clear();
36 | }
37 |
38 | public void InvokeRegisteredListeners()
39 | {
40 | foreach (var action in registeredActions)
41 | action();
42 | foreach (var action in registeredActionsForCurrentState)
43 | action();
44 | }
45 |
46 | public void RegisterListenerForCurrentState(Action listener)
47 | {
48 | registeredActionsForCurrentState.Add(listener);
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/Runtime/AnimationEvent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e5b48c3e544b72c4286dcb0c27cb7957
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AnimationJobs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 08fef4f6e21743c42bfd30df6197ecab
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/AnimationJobs/IKAnimationPlayerConnection.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | #if UNITY_2019_1_OR_NEWER
3 | using UnityEngine.Animations;
4 | #else
5 | using UnityEngine.Experimental.Animations;
6 | #endif
7 | using UnityEngine.Playables;
8 |
9 | namespace Animation_Player {
10 | public interface IIKAnimationPlayerConnection {
11 | AnimationScriptPlayable GeneratePlayable(Animator outputAnimator, PlayableGraph graph);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/Runtime/AnimationJobs/IKAnimationPlayerConnection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0ac8622f76760d443aa9cbab6f90d518
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AnimationJobs/TwoBoneIKConnection.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | #if UNITY_2019_1_OR_NEWER
3 | using UnityEngine.Animations;
4 | #else
5 | using UnityEngine.Experimental.Animations;
6 | #endif
7 | using UnityEngine.Playables;
8 |
9 | namespace Animation_Player {
10 | public class TwoBoneIKConnection : MonoBehaviour, IIKAnimationPlayerConnection {
11 | [SerializeField] private Transform effector;
12 | [SerializeField] private Transform top;
13 | [SerializeField] private Transform mid;
14 | [SerializeField] private Transform low;
15 |
16 |
17 | public AnimationScriptPlayable GeneratePlayable(Animator outputAnimator, PlayableGraph graph) {
18 | var job = new TwoBoneIKJob();
19 | job.Setup(outputAnimator, top, mid, low, effector);
20 | return AnimationScriptPlayable.Create(graph, job);
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/Runtime/AnimationJobs/TwoBoneIKConnection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: dfbfe41f7073da64e9c69baac193df44
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AnimationJobs/TwoBoneIKJob.cs:
--------------------------------------------------------------------------------
1 | /*
2 | * Base on https://github.com/Unity-Technologies/animation-jobs-samples/blob/master/Assets/animation-jobs-samples/Samples/Scripts/TwoBoneIK/TwoBoneIK.cs
3 | */
4 |
5 | using UnityEngine;
6 | #if UNITY_2019_1_OR_NEWER
7 | using UnityEngine.Animations;
8 | #else
9 | using UnityEngine.Experimental.Animations;
10 | #endif
11 |
12 | namespace Animation_Player {
13 | public struct TwoBoneIKJob : IAnimationJob {
14 | private TransformSceneHandle effector;
15 | private TransformStreamHandle top;
16 | private TransformStreamHandle mid;
17 | private TransformStreamHandle low;
18 |
19 | public void Setup(Animator animator, Transform topX, Transform midX, Transform lowX, Transform effectorX) {
20 | top = animator.BindStreamTransform(topX);
21 | mid = animator.BindStreamTransform(midX);
22 | low = animator.BindStreamTransform(lowX);
23 |
24 | effector = animator.BindSceneTransform(effectorX);
25 | }
26 |
27 | public void ProcessRootMotion(AnimationStream stream) { }
28 |
29 | public void ProcessAnimation(AnimationStream stream) {
30 | Solve(stream, top, mid, low, effector);
31 | }
32 |
33 | ///
34 | /// Returns the angle needed between v1 and v2 so that their extremities are
35 | /// spaced with a specific length.
36 | ///
37 | /// The angle between v1 and v2.
38 | /// The desired length between the extremities of v1 and v2.
39 | /// First triangle edge.
40 | /// Second triangle edge.
41 | private static float TriangleAngle(float aLen, Vector3 v1, Vector3 v2) {
42 | var aLen1 = v1.magnitude;
43 | var aLen2 = v2.magnitude;
44 | var c = Mathf.Clamp((aLen1 * aLen1 + aLen2 * aLen2 - aLen * aLen) / (aLen1 * aLen2) / 2.0f, -1.0f, 1.0f);
45 | return Mathf.Acos(c);
46 | }
47 |
48 | private static void Solve(AnimationStream stream, TransformStreamHandle topHandle, TransformStreamHandle midHandle, TransformStreamHandle lowHandle,
49 | TransformSceneHandle effectorHandle) {
50 | var aRotation = topHandle.GetRotation(stream);
51 | var bRotation = midHandle.GetRotation(stream);
52 | var eRotation = effectorHandle.GetRotation(stream);
53 |
54 | var aPosition = topHandle.GetPosition(stream);
55 | var bPosition = midHandle.GetPosition(stream);
56 | var cPosition = lowHandle.GetPosition(stream);
57 | var ePosition = effectorHandle.GetPosition(stream);
58 |
59 | var ab = bPosition - aPosition;
60 | var bc = cPosition - bPosition;
61 | var ac = cPosition - aPosition;
62 | var ae = ePosition - aPosition;
63 |
64 | var abcAngle = TriangleAngle(ac.magnitude, ab, bc);
65 | var abeAngle = TriangleAngle(ae.magnitude, ab, bc);
66 | var angle = (abcAngle - abeAngle) * Mathf.Rad2Deg;
67 | var axis = Vector3.Cross(ab, bc).normalized;
68 |
69 | var fromToRotation = Quaternion.AngleAxis(angle, axis);
70 |
71 | var worldQ = fromToRotation * bRotation;
72 | midHandle.SetRotation(stream, worldQ);
73 |
74 | cPosition = lowHandle.GetPosition(stream);
75 | ac = cPosition - aPosition;
76 | var fromTo = Quaternion.FromToRotation(ac, ae);
77 | topHandle.SetRotation(stream, fromTo * aRotation);
78 |
79 | lowHandle.SetRotation(stream, eRotation);
80 | }
81 | }
82 | }
83 |
--------------------------------------------------------------------------------
/Runtime/AnimationJobs/TwoBoneIKJob.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 089e90660f4a11248826966c6a44842c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AnimationLayer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e1483b9c9615a01449fb8ea5e8ded0d0
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AnimationLayerType.cs:
--------------------------------------------------------------------------------
1 | namespace Animation_Player
2 | {
3 | public enum AnimationLayerType
4 | {
5 | Override,
6 | Additive
7 | }
8 | }
--------------------------------------------------------------------------------
/Runtime/AnimationLayerType.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 09b390da5d35dec4db83548392501ac7
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AnimationPlayer.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "AnimationPlayer",
3 | "references": [
4 | "Unity.PlayableGraphVisualizer",
5 | "PlayerLoopInterface"
6 | ],
7 | "optionalUnityReferences": [],
8 | "includePlatforms": [],
9 | "excludePlatforms": [],
10 | "allowUnsafeCode": false,
11 | "overrideReferences": false,
12 | "precompiledReferences": [],
13 | "autoReferenced": true,
14 | "defineConstraints": []
15 | }
--------------------------------------------------------------------------------
/Runtime/AnimationPlayer.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 434dc770b62249b479af387a1c69355f
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/AnimationPlayer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5a358015f49970a46b016ee678237f14
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AnimationPlayerExtensions.cs:
--------------------------------------------------------------------------------
1 | //using System;
2 | //using System.Collections;
3 | //using System.Collections.Generic;
4 | //using UnityEngine;
5 | //
6 | //namespace Animation_Player
7 | //{
8 | // public static class AnimationPlayerExtensions
9 | // {
10 | //
11 | // public static IEnumerable FilterByType(this IEnumerable collection) where T : class
12 | // {
13 | // foreach (var element in collection)
14 | // {
15 | // if (element is T asT)
16 | // yield return asT;
17 | // }
18 | // }
19 | //
20 | // public static T EnsureComponent(this GameObject obj) where T : Component
21 | // {
22 | // var t = obj.GetComponent();
23 | // if (t == null)
24 | // t = obj.AddComponent();
25 | // return t;
26 | // }
27 | //
28 | // public static bool IsInBounds(this List arr, int index)
29 | // {
30 | // if (arr == null)
31 | // return false;
32 | // if (arr.Count == 0)
33 | // return false;
34 | // return index >= 0 && index < arr.Count;
35 | // }
36 | //
37 | // public static V GetOrAdd(this Dictionary dict, K key) where V : new()
38 | // {
39 | // if (dict.TryGetValue(key, out var value))
40 | // return value;
41 | //
42 | // return dict[key] = new V();
43 | // }
44 | //
45 | // public static float Duration(this AnimationCurve curve) {
46 | // if (curve == null) {
47 | // throw new ArgumentNullException(nameof(curve));
48 | // }
49 | //
50 | // if (curve.keys.Length == 0) {
51 | // return 0;
52 | // }
53 | //
54 | // return curve[curve.length - 1].time - curve[0].time;
55 | // }
56 | // }
57 | //}
--------------------------------------------------------------------------------
/Runtime/AnimationPlayerExtensions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 90cb57affd12b4e44bcb93ffb067e802
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AnimationPlayerState.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9110fb5a25e5213488e5f040463f3663
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AnimationPlayerUpdater.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 | using UnityEngine.Profiling;
4 |
5 | namespace Animation_Player {
6 | public static class AnimationPlayerUpdater {
7 |
8 | private static List animationPlayers = new List();
9 |
10 | [RuntimeInitializeOnLoadMethod]
11 | public static void Initialize() {
12 | #if UNITY_2019_3_OR_NEWER
13 | PlayerLoopInterface.InsertSystemAfter(typeof(AnimationPlayerUpdater), Update, typeof(UnityEngine.PlayerLoop.Update));
14 | #else
15 | PlayerLoopInterface.InsertSystemAfter(typeof(AnimationPlayerUpdater), Update, typeof(UnityEngine.Experimental.PlayerLoop.Update));
16 | #endif
17 | }
18 |
19 | private static void Update() {
20 | Profiler.BeginSample("Animation Player Update");
21 | foreach (var animationPlayer in animationPlayers)
22 | animationPlayer.UpdateSelf();
23 | Profiler.EndSample();
24 | }
25 |
26 | internal static void RegisterAnimationPlayer(AnimationPlayer animationPlayer) {
27 | animationPlayers.Add(animationPlayer);
28 | }
29 |
30 | internal static void DeregisterAnimationPlayer(AnimationPlayer animationPlayer) {
31 | animationPlayers.Remove(animationPlayer);
32 | }
33 |
34 | }
35 | }
--------------------------------------------------------------------------------
/Runtime/AnimationPlayerUpdater.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6223bd7c31b14737958243b39df635ba
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AnimationStateCollection.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using UnityEngine;
3 |
4 | namespace Animation_Player
5 | {
6 | [CreateAssetMenu(menuName = "Mesmer/Animation State Collection", order = 78)]
7 | public class AnimationStateCollection : ScriptableObject
8 | {
9 |
10 | public List animStates;
11 | private string[] displayNames;
12 |
13 | public string[] GetDisplayNames()
14 | {
15 | if (displayNames == null || displayNames.Length != animStates.Count)
16 | displayNames = new string[animStates.Count];
17 |
18 | for (int i = 0; i < animStates.Count; i++)
19 | {
20 | if (animStates[i] == null)
21 | displayNames[i] = "[NULL]";
22 | else
23 | displayNames[i] = animStates[i].GetState().Name;
24 | }
25 | return displayNames;
26 | }
27 |
28 | public int GetStateIndexInCollection(AnimationStateWrapper state)
29 | {
30 | for (int i = 0; i < animStates.Count; i++)
31 | {
32 | if (animStates[i] == state)
33 | {
34 | return i;
35 | }
36 | }
37 | return -1;
38 | }
39 |
40 | public AnimationStateWrapper GetAnimationState(int index)
41 | {
42 | if (animStates.Count == 0 || index >= animStates.Count)
43 | {
44 | Debug.LogError("Error: Tried getting invalid animation state");
45 | }
46 | return animStates[index];
47 | }
48 | }
49 | }
--------------------------------------------------------------------------------
/Runtime/AnimationStateCollection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 24604a38b1bbc0f4c8bd8b779f57e684
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AnimationStateWrapper.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace Animation_Player {
4 | [CreateAssetMenu(menuName = "Mesmer/Animation State Object", order = 77)]
5 | public class AnimationStateWrapper : ScriptableObject {
6 | public enum Type {
7 | BlendTree1D,
8 | BlendTree2D,
9 | SingleClip,
10 | PlayRandomClip
11 | }
12 |
13 | //This is what selects what type to show
14 | public Type type;
15 |
16 | //Editor only shows the chosen one
17 | public BlendTree1D blendTree1D;
18 | public BlendTree2D blendTree2D;
19 | public SingleClip singleClip;
20 | public PlayRandomClip playRandomClip;
21 |
22 | public AnimationPlayerState GetState() {
23 | switch (type) {
24 | case Type.BlendTree1D:
25 | return blendTree1D;
26 | case Type.BlendTree2D:
27 | return blendTree2D;
28 | case Type.SingleClip:
29 | return singleClip;
30 | case Type.PlayRandomClip:
31 | return playRandomClip;
32 | default:
33 | Debug.LogError("ERROR: Animation state type error in Animation State Scriptable Object");
34 | return null;
35 | }
36 | }
37 | }
38 | }
--------------------------------------------------------------------------------
/Runtime/AnimationStateWrapper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 03de3f6cf0c1e3542a0e94592946ee45
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/ArrayExtensions.cs:
--------------------------------------------------------------------------------
1 | //using System;
2 | //using System.Collections.Generic;
3 | //using System.Text;
4 | //
5 | //namespace Animation_Player
6 | //{
7 | // public static class ArrayExtensions
8 | // {
9 | // ///
10 | // /// Returns a pretty string representation of an Array. Or anything else that's IEnumerable. Like a list or whatever.
11 | // /// Does basic [element,element] formatting, and also does recursive calls to inner lists. You can also give it a functon to
12 | // /// do even prettier printing, usefull to get IE. a GameObject's name instead of "name (UnityEngine.GameObject)". If the function
13 | // /// isn't supplied, toString is used.
14 | // /// Also turns null into "null" instead of ""
15 | // /// Will cause a stack overflow if you put list A in list B and list B in list A, but you wouldn't do that, would you?
16 | // ///
17 | // /// Some array
18 | // /// An optional function that you can use in place of ToString
19 | // /// The thing that should be put between the array elements. Defaults to a comma.
20 | // /// Should the array be surrounded with [] or not?
21 | // /// The type of the array
22 | // /// A string representation of the array that's easy to read
23 | // public static string PrettyPrint(this IEnumerable array, Func printFunc, string elementDivider, bool surroundWithBrackets)
24 | // {
25 | // if (array == null)
26 | // return "null";
27 | //
28 | // StringBuilder builder = new StringBuilder();
29 | //
30 | // if (surroundWithBrackets)
31 | // builder.Append("[");
32 | //
33 | // bool addedAny = false;
34 | // foreach (T t in array)
35 | // {
36 | // addedAny = true;
37 | // if (t == null)
38 | // builder.Append("null");
39 | // else if (t is IEnumerable)
40 | // builder.Append(((IEnumerable) t).PrettyPrint(printFunc, elementDivider, surroundWithBrackets));
41 | // else
42 | // {
43 | // if (printFunc == null)
44 | // builder.Append(t.ToString());
45 | // else
46 | // builder.Append(printFunc(t));
47 | // }
48 | //
49 | // builder.Append(elementDivider);
50 | // }
51 | //
52 | // if (addedAny) //removes the trailing ", "
53 | // builder.Remove(builder.Length - 2, 2);
54 | // if (surroundWithBrackets)
55 | // builder.Append("]");
56 | //
57 | // return builder.ToString();
58 | // }
59 | //
60 | // public static string PrettyPrint(this IEnumerable array, Func printFunc)
61 | // {
62 | // return PrettyPrint(array, false, printFunc);
63 | // }
64 | //
65 | // public static string PrettyPrint(this IEnumerable array, bool newLines = false,
66 | // Func printFunc = null, bool surroundWithBrackets = true)
67 | // {
68 | // var elementDivider = newLines ? "\n " : ", ";
69 | // return PrettyPrint(array, printFunc, elementDivider, false);
70 | // }
71 | //
72 | // public static void Swap(this IList list, int idx1, int idx2)
73 | // {
74 | // var temp = list[idx1];
75 | // list[idx1] = list[idx2];
76 | // list[idx2] = temp;
77 | // }
78 | //
79 | // public static int GetRandomIdx(this IList list)
80 | // {
81 | // if (list == null)
82 | // throw new ArgumentNullException(nameof(list), "Can't get random idx from null list!");
83 | // if(list.Count == 0)
84 | // throw new ArgumentException("Can't get random idx from empty list!", nameof(list));
85 | // return UnityEngine.Random.Range(0, list.Count);
86 | // }
87 | //
88 | // public static T GetRandom(this IList list)
89 | // {
90 | // if (list == null)
91 | // throw new ArgumentNullException(nameof(list), "Can't get random from null list!");
92 | // if(list.Count == 0)
93 | // throw new ArgumentException("Can't get random from empty list!", nameof(list));
94 | // return list[UnityEngine.Random.Range(0, list.Count)];
95 | // }
96 | //
97 | // public static void EnsureContains(this List list, T element)
98 | // {
99 | // if (!list.Contains(element))
100 | // list.Add(element);
101 | // }
102 | // }
103 | //}
--------------------------------------------------------------------------------
/Runtime/ArrayExtensions.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e6a0a72a5093ea74a8793d54f0c0ea25
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 |
3 | [assembly: InternalsVisibleTo("AnimationPlayer.Editor")]
--------------------------------------------------------------------------------
/Runtime/AssemblyInfo.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0d829629939406048a7571d459e93741
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BlendTree1D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEngine.Animations;
5 | using UnityEngine.Playables;
6 |
7 | namespace Animation_Player
8 | {
9 | [Serializable]
10 | public class BlendTree1D : AnimationPlayerState
11 | {
12 | public const string DefaultName = "New Blend Tree";
13 |
14 | public string blendVariable;
15 | public List blendTree;
16 | public bool compensateForDifferentDurations = true; // @TODO: this should be setable from the editor, no?
17 |
18 | private BlendTreeController1D controller;
19 |
20 | private BlendTree1D() { }
21 |
22 | public static BlendTree1D Create(string name)
23 | {
24 | var blendTree = new BlendTree1D();
25 | blendTree.Initialize(name, DefaultName);
26 | blendTree.blendVariable = "blend";
27 | blendTree.blendTree = new List();
28 |
29 | return blendTree;
30 | }
31 |
32 | public override Playable GeneratePlayable(PlayableGraph graph, Dictionary> varTo1DBlendControllers,
33 | Dictionary> varTo2DBlendControllers,
34 | List all2DControllers)
35 | {
36 | var treeMixer = AnimationMixerPlayable.Create(graph, blendTree.Count, true);
37 | treeMixer.SetSpeed(speed);
38 | treeMixer.SetPropagateSetTime(true);
39 |
40 | if (blendTree.Count == 0)
41 | return treeMixer;
42 |
43 |
44 | float[] thresholds = new float[blendTree.Count];
45 |
46 | var innerPlayables = new AnimationClipPlayable[blendTree.Count];
47 | for (int i = 0; i < blendTree.Count; i++)
48 | {
49 | var blendTreeEntry = blendTree[i];
50 | var clip = GetClipToUseFor(blendTreeEntry.clip);
51 | if (clip == null)
52 | clip = new AnimationClip();
53 | var clipPlayable = AnimationClipPlayable.Create(graph, clip);
54 | clipPlayable.SetApplyFootIK(true);
55 | // clipPlayable.SetSpeed(speed);
56 | graph.Connect(clipPlayable, 0, treeMixer, i);
57 | thresholds[i] = blendTreeEntry.threshold;
58 | innerPlayables[i] = clipPlayable;
59 |
60 | }
61 |
62 | controller = new BlendTreeController1D(treeMixer, innerPlayables, thresholds, compensateForDifferentDurations);
63 | varTo1DBlendControllers.GetOrAdd(blendVariable).Add(controller);
64 | controller.SetInitialValue(0);
65 |
66 | return treeMixer;
67 | }
68 |
69 | public override float Duration
70 | {
71 | get
72 | {
73 | var longest = 0f;
74 | foreach (var blendTreeEntry in blendTree)
75 | {
76 | var clip = GetClipToUseFor(blendTreeEntry.clip);
77 | var clipLength = clip == null ? 0f : clip.length;
78 | if (clipLength > longest)
79 | longest = clipLength;
80 | }
81 |
82 | return longest;
83 | }
84 | }
85 |
86 | public override bool Loops
87 | {
88 | get
89 | {
90 | foreach (var entry in blendTree) {
91 | var clip = GetClipToUseFor(entry.clip);
92 | if (clip != null && clip.isLooping)
93 | return true;
94 | }
95 | return false;
96 | }
97 | }
98 |
99 | public override void JumpToRelativeTime(ref Playable ownPlayable, float time)
100 | {
101 | float unNormalizedTime = time * Duration;
102 | ownPlayable.SetTime(unNormalizedTime);
103 | for (int i = 0; i < ownPlayable.GetInputCount(); i++)
104 | {
105 | ownPlayable.GetInput(i).SetTime(unNormalizedTime);
106 | }
107 | }
108 |
109 | public override void OnClipSwapsChanged(ref Playable ownPlayable)
110 | {
111 | var asMixer = (AnimationMixerPlayable) ownPlayable;
112 | var inputCount = asMixer.GetInputCount();
113 |
114 | for (int i = 0; i < inputCount; i++)
115 | {
116 | var clipPlayable = (AnimationClipPlayable) asMixer.GetInput(i);
117 | var shouldPlay = GetClipToUseFor(blendTree[i].clip);
118 | var isPlaying = clipPlayable.GetAnimationClip();
119 |
120 | if (isPlaying != shouldPlay) {
121 | PlayableUtilities.ReplaceClipInPlace(ref clipPlayable, shouldPlay);
122 | controller.PlayableChanged(i, clipPlayable);
123 | }
124 | }
125 | }
126 |
127 | public override void RegisterUsedBlendVarsIn(Dictionary blendVariableValues) {
128 | if (!blendVariableValues.ContainsKey(blendVariable))
129 | blendVariableValues[blendVariable] = 0;
130 | }
131 | }
132 | }
--------------------------------------------------------------------------------
/Runtime/BlendTree1D.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cbf2283aff4bd1e4287cc3190181ad22
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BlendTree2D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine.Animations;
4 | using UnityEngine.Playables;
5 |
6 | namespace Animation_Player
7 | {
8 | [Serializable]
9 | public class BlendTree2D : AnimationPlayerState
10 | {
11 | public const string DefaultName = "New 2D Blend Tree";
12 |
13 | public string blendVariable;
14 | public string blendVariable2;
15 | public List blendTree;
16 |
17 | private BlendTree2D() { }
18 |
19 | public static BlendTree2D Create(string name)
20 | {
21 | var blendTree = new BlendTree2D();
22 | blendTree.Initialize(name, DefaultName);
23 | blendTree.blendVariable = "blend1";
24 | blendTree.blendVariable2 = "blend2";
25 | blendTree.blendTree = new List();
26 | return blendTree;
27 | }
28 |
29 | public override Playable GeneratePlayable(PlayableGraph graph, Dictionary> varTo1DBlendControllers,
30 | Dictionary> varTo2DBlendControllers,
31 | List all2DControllers)
32 | {
33 | var treeMixer = AnimationMixerPlayable.Create(graph, blendTree.Count, true);
34 | treeMixer.SetPropagateSetTime(true);
35 |
36 | if (blendTree.Count == 0)
37 | return treeMixer;
38 |
39 | var controller = new BlendTreeController2D(blendVariable, blendVariable2, treeMixer, blendTree.Count);
40 | all2DControllers.Add(controller);
41 | varTo2DBlendControllers.GetOrAdd(blendVariable).Add(controller);
42 | varTo2DBlendControllers.GetOrAdd(blendVariable2).Add(controller);
43 |
44 | for (int j = 0; j < blendTree.Count; j++)
45 | {
46 | var blendTreeEntry = blendTree[j];
47 | var clipPlayable = AnimationClipPlayable.Create(graph, GetClipToUseFor(blendTreeEntry.clip));
48 | clipPlayable.SetApplyFootIK(true);
49 | clipPlayable.SetSpeed(speed);
50 | graph.Connect(clipPlayable, 0, treeMixer, j);
51 |
52 | controller.AddThresholdsForClip(j, blendTreeEntry.threshold1, blendTreeEntry.threshold2);
53 | }
54 |
55 | controller.OnAllThresholdsAdded();
56 |
57 | controller.SetInitialValues(0f, 0f);
58 | return treeMixer;
59 | }
60 |
61 | public override float Duration
62 | {
63 | get
64 | {
65 | var longest = 0f;
66 | foreach (var entry in blendTree)
67 | {
68 | var clip = GetClipToUseFor(entry.clip);
69 | var clipLength = clip == null ? 0f : clip.length;
70 | if (clipLength > longest)
71 | longest = clipLength;
72 | }
73 | return longest;
74 | }
75 | }
76 |
77 | public override bool Loops
78 | {
79 | get
80 | {
81 | foreach (var entry in blendTree)
82 | {
83 | var clip = GetClipToUseFor(entry.clip);
84 | if (clip != null && clip.isLooping)
85 | return true;
86 | }
87 | return false;
88 | }
89 | }
90 |
91 | public override void JumpToRelativeTime(ref Playable ownPlayable, float time)
92 | {
93 | var unNormalizedTime = time * Duration;
94 | ownPlayable.SetTime(unNormalizedTime);
95 | for (int i = 0; i < ownPlayable.GetInputCount(); i++)
96 | {
97 | ownPlayable.GetInput(i).SetTime(unNormalizedTime);
98 | }
99 | }
100 |
101 | public override void OnClipSwapsChanged(ref Playable ownPlayable)
102 | {
103 | var asMixer = (AnimationMixerPlayable) ownPlayable;
104 | var inputCount = asMixer.GetInputCount();
105 |
106 | for (int i = 0; i < inputCount; i++)
107 | {
108 | var clipPlayable = (AnimationClipPlayable) asMixer.GetInput(i);
109 | var shouldPlay = GetClipToUseFor(blendTree[i].clip);
110 | var isPlaying = clipPlayable.GetAnimationClip();
111 |
112 | if (isPlaying != shouldPlay)
113 | PlayableUtilities.ReplaceClipInPlace(ref clipPlayable, shouldPlay);
114 | }
115 | }
116 |
117 | public override void RegisterUsedBlendVarsIn(Dictionary blendVariableValues) {
118 | if (!blendVariableValues.ContainsKey(blendVariable))
119 | blendVariableValues[blendVariable] = 0;
120 | if (!blendVariableValues.ContainsKey(blendVariable2))
121 | blendVariableValues[blendVariable2] = 0;
122 | }
123 | }
124 | }
--------------------------------------------------------------------------------
/Runtime/BlendTree2D.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b5553a9866f81e54ba27aac9e70ffe9c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BlendTreeController1D.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 | using UnityEngine.Animations;
4 | using UnityEngine.Playables;
5 |
6 | namespace Animation_Player
7 | {
8 | public class BlendTreeController1D
9 | {
10 | private readonly AnimationMixerPlayable mixer;
11 | private readonly BlendTreeData[] runtimeData;
12 | private readonly bool compensateForDifferentDurations;
13 |
14 | private float lastValue;
15 |
16 | public BlendTreeController1D(AnimationMixerPlayable mixer, AnimationClipPlayable[] playables, float[] thresholds, bool compensateForDifferentDurations)
17 | {
18 | if(thresholds.Length != playables.Length)
19 | throw new Exception("Thresholds and playables doesn't match!");
20 | for (int i = 0; i < thresholds.Length - 2; i++)
21 | if (thresholds[i] >= thresholds[i + 1])
22 | throw new Exception($"The thresholds on the blend tree should be be strictly increasing!");
23 |
24 | this.compensateForDifferentDurations = compensateForDifferentDurations;
25 | this.mixer = mixer;
26 | runtimeData = new BlendTreeData[thresholds.Length];
27 | for (int i = 0; i < runtimeData.Length; i++)
28 | {
29 | runtimeData[i] = new BlendTreeData
30 | {
31 | threshold = thresholds[i],
32 | playable = playables[i],
33 | duration = playables[i].GetAnimationClip().length
34 | };
35 | }
36 |
37 | if (compensateForDifferentDurations)
38 | CompensateForDurations(0, 0);
39 | }
40 |
41 | public void SetInitialValue(float value) {
42 | lastValue = float.MaxValue;
43 | SetValue(value);
44 | }
45 |
46 | public void SetValue(float value)
47 | {
48 | if (value == lastValue)
49 | return;
50 | lastValue = value;
51 |
52 | int idxOfLastLowerThanVal = -1;
53 | for (int i = 0; i < runtimeData.Length; i++)
54 | {
55 | var threshold = runtimeData[i].threshold;
56 | if (threshold <= value)
57 | idxOfLastLowerThanVal = i;
58 | else
59 | break;
60 | }
61 |
62 | int idxBefore = Mathf.Max(idxOfLastLowerThanVal, 0);
63 | int idxAfter = Mathf.Min(idxOfLastLowerThanVal + 1, runtimeData.Length - 1);
64 |
65 | float fractionTowardsAfter;
66 | if (idxBefore == idxAfter) //first or last clip
67 | {
68 | fractionTowardsAfter = 0f;
69 | }
70 | else {
71 | var range = (runtimeData[idxAfter].threshold - runtimeData[idxBefore].threshold);
72 | var distFromStart = (value - runtimeData[idxBefore].threshold);
73 | fractionTowardsAfter = distFromStart / range;
74 | }
75 |
76 | for (int i = 0; i < runtimeData.Length; i++)
77 | {
78 | float inputWeight;
79 |
80 | if (i == idxBefore)
81 | inputWeight = 1f - fractionTowardsAfter;
82 | else if (i == idxAfter)
83 | inputWeight = fractionTowardsAfter;
84 | else
85 | inputWeight = 0f;
86 |
87 | mixer.SetInputWeight(i, inputWeight);
88 | }
89 |
90 | if (compensateForDifferentDurations)
91 | CompensateForDurations(idxBefore, idxAfter);
92 | }
93 |
94 | ///
95 | /// When blending between different clips that have different durations, it's often neccessary to speed the playables up or down so their durations
96 | /// match. Consider blending a walk and run animation with different lengths - unless the feet hit the ground at the same time every time the clips
97 | /// loop, the character's feet will be in a strange, in-between position.
98 | /// The way we handle this is to always have all of the clips - even ones with weight 0 - always playing at a speed such that their duration matches
99 | /// the currently played clip's duration.
100 | ///
101 | private void CompensateForDurations(int idxBefore, int idxAfter)
102 | {
103 | float durationBefore = runtimeData[idxBefore].duration;
104 | float durationAfter = runtimeData[idxAfter ].duration;
105 | float loopDuration = Mathf.Lerp(durationBefore, durationAfter, mixer.GetInputWeight(idxAfter));
106 |
107 | for (int i = 0; i < runtimeData.Length; i++)
108 | {
109 | var clipDuration = runtimeData[i].duration;
110 | var requiredSpeed = clipDuration / loopDuration;
111 | runtimeData[i].playable.SetSpeed(requiredSpeed);
112 | }
113 | }
114 |
115 | public float GetMinThreshold() => runtimeData[0].threshold;
116 | public float GetMaxThreshold() => runtimeData[runtimeData.Length - 1].threshold;
117 |
118 | private struct BlendTreeData
119 | {
120 | public AnimationClipPlayable playable;
121 | public float duration;
122 | public float threshold;
123 | // public float defaultSpeed;
124 | }
125 |
126 | public void PlayableChanged(int index, AnimationClipPlayable newPlayable) {
127 | runtimeData[index].playable = newPlayable;
128 | }
129 | }
130 | }
--------------------------------------------------------------------------------
/Runtime/BlendTreeController1D.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 318fe9674af5b544baa6e30df443545c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BlendTreeController2D.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5b7da058451e9ff44bb8e3dad135ffc4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BlendTreeEntry.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | namespace Animation_Player
5 | {
6 | public abstract class BlendTreeEntry
7 | {
8 | public AnimationClip clip;
9 | public float Duration => clip != null ? clip.length : 0f;
10 | }
11 |
12 | [Serializable]
13 | public class BlendTreeEntry1D : BlendTreeEntry
14 | {
15 | public float threshold;
16 | }
17 |
18 | [Serializable]
19 | public class BlendTreeEntry2D : BlendTreeEntry
20 | {
21 | public float threshold1;
22 | public float threshold2;
23 | }
24 | }
--------------------------------------------------------------------------------
/Runtime/BlendTreeEntry.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 39a09d65b062ffd4cbd26bbfbd08ad78
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/BlenderPlayableBehaviour.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine.Animations;
2 | using UnityEngine.Playables;
3 |
4 | // Comment from Baste: Okay, this is funky. This doesn't actually blend between the two other clips.
5 | // what's happening is that the graph is calling PrepareFrame, and this is setting the weighting between
6 | // the other clips.
7 | // so the 0 and 1 args to SetInputWeight are hard-coded references to two other clips
8 | public class BlenderPlayableBehaviour : PlayableBehaviour
9 | {
10 | public AnimationMixerPlayable mixerPlayable;
11 | public float blendVal;
12 |
13 | public override void PrepareFrame(Playable playable, FrameData info)
14 | {
15 | mixerPlayable.SetInputWeight(0, 1 - blendVal);
16 | mixerPlayable.SetInputWeight(1, blendVal);
17 |
18 | base.PrepareFrame(playable, info);
19 | }
20 | }
--------------------------------------------------------------------------------
/Runtime/BlenderPlayableBehaviour.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e0299172dd04a0543892b8c0f67f5d0d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/ClipSwapCollection.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | namespace Animation_Player
6 | {
7 | [Serializable]
8 | public class ClipSwapCollection
9 | {
10 | public string name;
11 | public List swaps = new List();
12 |
13 | [NonSerialized] internal bool active = false;
14 |
15 | public bool TryGetSwapFor(AnimationClip clip, out AnimationClip swappedClip)
16 | {
17 | if (active)
18 | {
19 | foreach (var swap in swaps)
20 | {
21 | if (swap.swapFrom == clip)
22 | {
23 | swappedClip = swap.swapTo;
24 | return true;
25 | }
26 | }
27 | }
28 |
29 | swappedClip = null;
30 | return false;
31 | }
32 | }
33 |
34 | [Serializable]
35 | public class ClipSwap
36 | {
37 | public AnimationClip swapFrom;
38 | public AnimationClip swapTo;
39 | }
40 | }
--------------------------------------------------------------------------------
/Runtime/ClipSwapCollection.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6ebedde79fa395442bfa3534f7751020
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/ExtensionMethods.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ace6c83890184173ad516d9d89f176f1
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/ExtensionMethods/AssemblyHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Linq;
4 | using System.Reflection;
5 | using UnityEngine;
6 |
7 | public static class AssemblyHelper {
8 |
9 | private static bool hasErroredThisReload;
10 | private static IReadOnlyList allTypesCache;
11 |
12 | public static IEnumerable GetAllTypes(bool allowCache = true) {
13 | if(!allowCache)
14 | return GetTypesFrom(AppDomain.CurrentDomain.GetAssemblies());
15 |
16 | if (allTypesCache == null || allTypesCache.Count == 0)
17 | allTypesCache = GetTypesFrom(AppDomain.CurrentDomain.GetAssemblies()).ToList();
18 |
19 | return allTypesCache;
20 | }
21 |
22 | public static IEnumerable GetTypesFrom(IEnumerable assemblies) {
23 | foreach (var assembly in assemblies) {
24 | Type[] types = null;
25 | try {
26 | types = assembly.GetTypes();
27 | }
28 | catch (ReflectionTypeLoadException rtle) {
29 | if (!hasErroredThisReload) {
30 | // If this errors, it might be that https://issuetracker.unity3d.com/issues/reflectiontypeloadexception-is-thrown-when-using-reflection-to-get-the-types-from-the-accessibility-assembly
31 | // has been reintroduced. It's supposed to be fixed in 2018.3.12.
32 | Debug.LogError($"Can't load types from assembly {assembly.GetName().Name}. Exceptions follow");
33 | Debug.LogException(rtle);
34 | foreach (var exception in rtle.LoaderExceptions) {
35 | Debug.LogException(exception);
36 | }
37 | hasErroredThisReload = true;
38 | }
39 |
40 | continue;
41 | }
42 |
43 | foreach (var type in types) {
44 | yield return type;
45 | }
46 | }
47 | }
48 | }
--------------------------------------------------------------------------------
/Runtime/ExtensionMethods/AssemblyHelper.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0b8970b6b13017a4caa52e6e0556d7d4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/ExtensionMethods/ExtensionMethods.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections;
3 | using System.Collections.Generic;
4 | using System.Text;
5 | using UnityEngine;
6 | using UnityEngine.Animations;
7 | using UnityEngine.Playables;
8 |
9 | namespace Animation_Player
10 | {
11 | internal static class ExtensionMethods
12 | {
13 | ///
14 | /// Returns a pretty string representation of an Array. Or anything else that's IEnumerable. Like a list or whatever.
15 | /// Does basic [element,element] formatting, and also does recursive calls to inner lists. You can also give it a functon to
16 | /// do even prettier printing, usefull to get IE. a GameObject's name instead of "name (UnityEngine.GameObject)". If the function
17 | /// isn't supplied, toString is used.
18 | /// Also turns null into "null" instead of ""
19 | /// Will cause a stack overflow if you put list A in list B and list B in list A, but you wouldn't do that, would you?
20 | ///
21 | /// Some array
22 | /// An optional function that you can use in place of ToString
23 | /// The thing that should be put between the array elements. Defaults to a comma.
24 | /// Should the array be surrounded with [] or not?
25 | /// The type of the array
26 | /// A string representation of the array that's easy to read
27 | public static string PrettyPrint(this IEnumerable array, Func printFunc, string elementDivider, bool surroundWithBrackets)
28 | {
29 | if (array == null)
30 | return "null";
31 |
32 | StringBuilder builder = new StringBuilder();
33 |
34 | if (surroundWithBrackets)
35 | builder.Append("[");
36 |
37 | bool addedAny = false;
38 | foreach (T t in array)
39 | {
40 | addedAny = true;
41 | if (t == null)
42 | builder.Append("null");
43 | else if (t is IEnumerable)
44 | builder.Append(((IEnumerable) t).PrettyPrint(printFunc, elementDivider, surroundWithBrackets));
45 | else
46 | {
47 | if (printFunc == null)
48 | builder.Append(t.ToString());
49 | else
50 | builder.Append(printFunc(t));
51 | }
52 |
53 | builder.Append(elementDivider);
54 | }
55 |
56 | if (addedAny) //removes the trailing ", "
57 | builder.Remove(builder.Length - 2, 2);
58 | if (surroundWithBrackets)
59 | builder.Append("]");
60 |
61 | return builder.ToString();
62 | }
63 |
64 | public static string PrettyPrint(this IEnumerable array, Func printFunc)
65 | {
66 | return PrettyPrint(array, false, printFunc);
67 | }
68 |
69 | public static string PrettyPrint(this IEnumerable array, bool newLines = false,
70 | Func printFunc = null, bool surroundWithBrackets = true)
71 | {
72 | var elementDivider = newLines ? "\n " : ", ";
73 | return PrettyPrint(array, printFunc, elementDivider, false);
74 | }
75 |
76 | public static void Swap(this IList list, int idx1, int idx2)
77 | {
78 | var temp = list[idx1];
79 | list[idx1] = list[idx2];
80 | list[idx2] = temp;
81 | }
82 |
83 | public static int GetRandomIdx(this IList list)
84 | {
85 | if (list == null)
86 | throw new ArgumentNullException(nameof(list), "Can't get random idx from null list!");
87 | if (list.Count == 0)
88 | throw new ArgumentException("Can't get random idx from empty list!", nameof(list));
89 | return UnityEngine.Random.Range(0, list.Count);
90 | }
91 |
92 | public static T GetRandom(this IList list)
93 | {
94 | if (list == null)
95 | throw new ArgumentNullException(nameof(list), "Can't get random from null list!");
96 | if (list.Count == 0)
97 | throw new ArgumentException("Can't get random from empty list!", nameof(list));
98 | return list[UnityEngine.Random.Range(0, list.Count)];
99 | }
100 |
101 | public static T EnsureComponent(this GameObject obj) where T : Component
102 | {
103 | var t = obj.GetComponent();
104 | if (t == null)
105 | t = obj.AddComponent();
106 | return t;
107 | }
108 |
109 | public static T GetIfInBounds(this IList arr, int index)
110 | {
111 | if (!arr.IsInBounds(index))
112 | return default;
113 | return arr[index];
114 | }
115 |
116 | public static bool IsInBounds(this IList arr, int index)
117 | {
118 | if (arr == null)
119 | return false;
120 | if (arr.Count == 0)
121 | return false;
122 | return index >= 0 && index < arr.Count;
123 | }
124 |
125 | public static V GetOrAdd(this Dictionary dict, K key) where V : new()
126 | {
127 | if (dict.TryGetValue(key, out var value))
128 | return value;
129 |
130 | return dict[key] = new V();
131 | }
132 |
133 | public static float Duration(this AnimationCurve curve)
134 | {
135 | if (curve == null)
136 | {
137 | throw new ArgumentNullException(nameof(curve));
138 | }
139 |
140 | if (curve.keys.Length == 0)
141 | {
142 | return 0;
143 | }
144 |
145 | return curve[curve.length - 1].time - curve[0].time;
146 | }
147 |
148 | public static void EnsureContains(this List list, T element)
149 | {
150 | if (!list.Contains(element))
151 | list.Add(element);
152 | }
153 | }
154 | }
--------------------------------------------------------------------------------
/Runtime/ExtensionMethods/ExtensionMethods.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 49193de2771d4ffc80a9a635f0d2f047
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/ExtensionMethods/PlayableUtilities.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityEngine.Animations;
3 | using UnityEngine.Playables;
4 |
5 | namespace Animation_Player
6 | {
7 | public static class PlayableUtilities
8 | {
9 | ///
10 | /// Use this to replace the clip played by an AnimationClipPlayable in a PlayableGraph.
11 | /// The method creates a clone of the playable, with the new clip, and then swaps that in all the
12 | /// places that took the old playable as an input.
13 | ///
14 | /// Playable to replace.
15 | /// Clip the new playable should play.
16 | public static void ReplaceClipInPlace(ref AnimationClipPlayable playable, AnimationClip clip)
17 | {
18 | var newPlayable = AnimationClipPlayable.Create(playable.GetGraph(), clip);
19 |
20 | newPlayable.SetApplyFootIK(playable.GetApplyFootIK());
21 | newPlayable.SetApplyPlayableIK(playable.GetApplyPlayableIK());
22 | newPlayable.SetSpeed(playable.GetSpeed());
23 |
24 | var outputCount = playable.GetOutputCount();
25 | for (int i = 0; i < outputCount; i++)
26 | {
27 | var outputTarget = playable.GetOutput(i);
28 |
29 | var inputIndex = -1;
30 | var inputCount = outputTarget.GetInputCount();
31 |
32 | for (int j = 0; j < inputCount; j++)
33 | {
34 | if (outputTarget.GetInput(j).Equals(playable))
35 | {
36 | inputIndex = j;
37 | break;
38 | }
39 | }
40 |
41 | var oldWeight = outputTarget.GetInputWeight(inputIndex);
42 | outputTarget.DisconnectInput(inputIndex);
43 | outputTarget.ConnectInput(inputIndex, newPlayable, i);
44 | outputTarget.SetInputWeight(inputIndex, oldWeight);
45 | }
46 |
47 | playable.Destroy();
48 | playable = newPlayable;
49 | }
50 | }
51 | }
--------------------------------------------------------------------------------
/Runtime/ExtensionMethods/PlayableUtilities.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 012f3f3f912ac1c47b4cd083a61d04cd
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/PlayRandomClip.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEngine.Animations;
5 | using UnityEngine.Playables;
6 |
7 | namespace Animation_Player
8 | {
9 | [Serializable]
10 | public class PlayRandomClip : AnimationPlayerState
11 | {
12 | public const string DefaultName = "New Random State";
13 | private int playedClip;
14 |
15 | public List clips = new List();
16 | private ClipSwapHandler _clipsToUse;
17 | private ClipSwapHandler ClipsToUse
18 | {
19 | get
20 | {
21 | if (_clipsToUse.clips != clips)
22 | _clipsToUse = new ClipSwapHandler(this, clips);
23 | return _clipsToUse;
24 | }
25 | }
26 |
27 | private PlayRandomClip() { }
28 |
29 | public static PlayRandomClip Create(string name)
30 | {
31 | var state = new PlayRandomClip();
32 | state.Initialize(name, DefaultName);
33 | return state;
34 | }
35 |
36 | public override float Duration
37 | {
38 | get
39 | {
40 | if (clips.Count == 0)
41 | return 0f;
42 | return ClipsToUse[playedClip].length;
43 | }
44 | }
45 |
46 | public override bool Loops
47 | {
48 | get
49 | {
50 | if (clips.Count == 0)
51 | return false;
52 | return ClipsToUse[playedClip].isLooping;
53 | }
54 | }
55 |
56 | public override Playable GeneratePlayable(PlayableGraph graph, Dictionary> varTo1DBlendControllers,
57 | Dictionary> varTo2DBlendControllers,
58 | List all2DControllers)
59 | {
60 | playedClip = clips.GetRandomIdx();
61 | return GeneratePlayableFor(graph, playedClip);
62 | }
63 |
64 |
65 | private Playable GeneratePlayableFor(PlayableGraph graph, int clipIdx)
66 | {
67 | playedClip = clipIdx;
68 | var clipPlayable = AnimationClipPlayable.Create(graph, ClipsToUse[playedClip]);
69 | clipPlayable.SetApplyFootIK(true);
70 | clipPlayable.SetSpeed(speed);
71 | return clipPlayable;
72 | }
73 |
74 | public override void OnWillStartPlaying(ref Playable ownPlayable)
75 | {
76 | //this happens if we're looping, and were already partially playing when the state were started. In that case, don't snap to a different random choice.
77 | if (ownPlayable.GetTime() > 0f)
78 | return;
79 |
80 | var wantedClip = clips.GetRandomIdx();
81 | if (wantedClip == playedClip)
82 | return;
83 |
84 | playedClip = wantedClip;
85 |
86 | var asClipPlayable = (AnimationClipPlayable) ownPlayable;
87 | PlayableUtilities.ReplaceClipInPlace(ref asClipPlayable, ClipsToUse[wantedClip]);
88 | ownPlayable = asClipPlayable;
89 | }
90 |
91 | public override void JumpToRelativeTime(ref Playable ownPlayable, float time)
92 | {
93 | ownPlayable.SetTime(time * Duration);
94 | }
95 |
96 | public override void OnClipSwapsChanged(ref Playable ownPlayable)
97 | {
98 | var asClipPlayable = (AnimationClipPlayable) ownPlayable;
99 |
100 | var shouldBePlaying = ClipsToUse[playedClip];
101 | var isPlaying = asClipPlayable.GetAnimationClip();
102 |
103 | if (shouldBePlaying != isPlaying)
104 | {
105 | PlayableUtilities.ReplaceClipInPlace(ref asClipPlayable, shouldBePlaying);
106 | ownPlayable = asClipPlayable;
107 | }
108 | }
109 |
110 | public override void RegisterUsedBlendVarsIn(Dictionary blendVariableValues) { }
111 | }
112 | }
--------------------------------------------------------------------------------
/Runtime/PlayRandomClip.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bf462fab7b42499409596c4186d48de2
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/Sequence.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e9ade7f35d115c145bba92683b54ebf4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/SerializedGUID.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEngine;
3 |
4 | namespace Animation_Player
5 | {
6 | ///
7 | /// This becomes redundant if this ever goes out of review:
8 | /// https://issuetracker.unity3d.com/issues/serialization-system-dot-guid-can-not-be-serialized
9 | ///
10 | [Serializable]
11 | public struct SerializedGUID : ISerializationCallbackReceiver, IFormattable, IComparable, IComparable, IEquatable
12 | {
13 | public static SerializedGUID Empty => new SerializedGUID {guid = Guid.Empty};
14 |
15 | public static SerializedGUID Create()
16 | {
17 | var newGuid = new SerializedGUID {guid = Guid.NewGuid()};
18 | newGuid.guidSerialized = newGuid.guid.ToString();
19 | return newGuid;
20 | }
21 |
22 | private Guid guid;
23 | public Guid GUID => guid;
24 |
25 | #pragma warning disable 0649
26 | [SerializeField]
27 | private string guidSerialized;
28 | #pragma warning restore 0649
29 |
30 | public void OnBeforeSerialize()
31 | {
32 | if (guid == Guid.Empty)
33 | guid = Guid.NewGuid();
34 |
35 | // Assumes that the guid never changes.
36 | if (string.IsNullOrEmpty(guidSerialized))
37 | guidSerialized = guid.ToString();
38 | }
39 |
40 | public void OnAfterDeserialize()
41 | {
42 | try
43 | {
44 | guid = Guid.ParseExact(guidSerialized, "D");
45 | }
46 | catch (FormatException)
47 | {
48 | if (string.IsNullOrEmpty(guidSerialized))
49 | {
50 | throw new UnityException("SerializedGUID has an empty string for the serialized guid when deserializing!");
51 | }
52 |
53 | Debug.LogError("Got a format exception on the guid: " + guidSerialized);
54 | throw;
55 | }
56 |
57 | if (guid == Guid.Empty)
58 | guid = Guid.NewGuid();
59 | }
60 |
61 | public string ToString(string format, IFormatProvider formatProvider)
62 | {
63 | return guid.ToString(format, formatProvider);
64 | }
65 |
66 | public int CompareTo(object obj)
67 | {
68 | return guid.CompareTo(obj);
69 | }
70 |
71 | public int CompareTo(SerializedGUID other)
72 | {
73 | return guid.CompareTo(other.guid);
74 | }
75 |
76 | public bool Equals(SerializedGUID other)
77 | {
78 | return guid.Equals(other.guid);
79 | }
80 |
81 | public static bool operator ==(SerializedGUID a, SerializedGUID b)
82 | {
83 | return a.Equals(b);
84 | }
85 |
86 | public static bool operator !=(SerializedGUID a, SerializedGUID b)
87 | {
88 | return !(a == b);
89 | }
90 |
91 | public override bool Equals(object obj)
92 | {
93 | if (ReferenceEquals(null, obj)) return false;
94 | return obj is SerializedGUID && Equals((SerializedGUID) obj);
95 | }
96 |
97 | public override int GetHashCode()
98 | {
99 | return guid.GetHashCode();
100 | }
101 | }
102 | }
--------------------------------------------------------------------------------
/Runtime/SerializedGUID.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 82035830bd78d654f91153bc5e093bb4
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/SingleClip.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 | using UnityEngine.Animations;
5 | using UnityEngine.Playables;
6 |
7 | namespace Animation_Player
8 | {
9 | [Serializable]
10 | public class SingleClip : AnimationPlayerState
11 | {
12 | public const string DefaultName = "New State";
13 | public AnimationClip clip;
14 |
15 | private SingleClip() { }
16 |
17 | public static SingleClip Create(string name, AnimationClip clip = null)
18 | {
19 | var state = new SingleClip();
20 | state.Initialize(name, DefaultName);
21 | state.clip = clip;
22 | return state;
23 | }
24 |
25 | public override Playable GeneratePlayable(PlayableGraph graph, Dictionary> varTo1DBlendControllers,
26 | Dictionary> varTo2DBlendControllers,
27 | List all2DControllers)
28 | {
29 | if (clip == null)
30 | clip = new AnimationClip();
31 | var clipPlayable = AnimationClipPlayable.Create(graph, GetClipToUseFor(clip));
32 | clipPlayable.SetApplyFootIK(true);
33 | clipPlayable.SetSpeed(speed);
34 | return clipPlayable;
35 | }
36 |
37 | public override float Duration
38 | {
39 | get
40 | {
41 | var clipToUse = GetClipToUseFor(clip);
42 | return clipToUse == null ? 0f : clipToUse.length;
43 | }
44 | }
45 |
46 | public override bool Loops
47 | {
48 | get
49 | {
50 | var clipToUse = GetClipToUseFor(clip);
51 | return clipToUse != null && clipToUse.isLooping;
52 | }
53 | }
54 |
55 | public override void JumpToRelativeTime(ref Playable ownPlayable, float time)
56 | {
57 | ownPlayable.SetTime(time * Duration);
58 | }
59 |
60 | public override void OnClipSwapsChanged(ref Playable ownPlayable)
61 | {
62 | var asClipPlayable = (AnimationClipPlayable) ownPlayable;
63 | var clipToUse = GetClipToUseFor(clip);
64 |
65 | if (asClipPlayable.GetAnimationClip() != clipToUse)
66 | {
67 | PlayableUtilities.ReplaceClipInPlace(ref asClipPlayable, clipToUse);
68 | ownPlayable = asClipPlayable;
69 | }
70 | }
71 |
72 | public override void RegisterUsedBlendVarsIn(Dictionary blendVariableValues) { }
73 |
74 | public void SwapClipTo(ref Playable ownPlayable, AnimationClip animationClip)
75 | {
76 | clip = animationClip;
77 | var asClipPlayable = (AnimationClipPlayable) ownPlayable;
78 | PlayableUtilities.ReplaceClipInPlace(ref asClipPlayable, GetClipToUseFor(animationClip));
79 | ownPlayable = asClipPlayable;
80 | }
81 | }
82 | }
--------------------------------------------------------------------------------
/Runtime/SingleClip.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a05c31dd7bd7844459b7c8d3c79d0690
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/SingleClipPlayer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading.Tasks;
3 | using UnityEngine;
4 | using UnityEngine.Animations;
5 | using UnityEngine.Playables;
6 |
7 | namespace Animation_Player {
8 | ///
9 | /// A very simplified animation player, which only plays a single clip.
10 | ///
11 | /// You'd want to use this over the animation player as it builds a simpler graph,
12 | /// and because it destroys it's graph and disables it's animator when done.
13 | ///
14 | public class SingleClipPlayer : MonoBehaviour, IAnimationClipSource {
15 |
16 | [SerializeField] private AnimationClip clip;
17 | [SerializeField] private bool playOnStart;
18 |
19 | private string graphName;
20 | private string outputName;
21 | private Animator animator;
22 | private PlayableGraph graph;
23 | private AnimationClipPlayable clipPlayable;
24 |
25 | public bool IsPlaying { get; private set; }
26 |
27 | private void Awake() {
28 | animator = gameObject.EnsureComponent();
29 | graphName = $"Playable Graph {name}";
30 | outputName = $"Playable Graph {name} output";
31 | }
32 |
33 | private void Start() {
34 | if (playOnStart)
35 | Play();
36 | }
37 |
38 | public void Play() {
39 | if (clipPlayable.IsValid() && clipPlayable.GetPlayState() == PlayState.Paused) {
40 | clipPlayable.Play();
41 | }
42 | else if (!IsPlaying) {
43 | IsPlaying = true;
44 | animator.enabled = true;
45 | graph = PlayableGraph.Create(graphName);
46 | var animOutput = AnimationPlayableOutput.Create(graph, outputName , animator);
47 | clipPlayable = AnimationClipPlayable.Create(graph, clip != null ? clip : new AnimationClip());
48 | clipPlayable.SetDuration(clip.length);
49 |
50 | animOutput.SetSourcePlayable(clipPlayable);
51 |
52 | graph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);
53 | graph.Play();
54 | }
55 | else {
56 | clipPlayable.SetTime(0);
57 | }
58 | }
59 |
60 | public async Task PlayAsync() {
61 | Play();
62 | while (IsPlaying)
63 | await Task.Yield();
64 | }
65 |
66 | private void Update() {
67 | if (!IsPlaying)
68 | return;
69 |
70 | if (clipPlayable.IsDone()) {
71 | Stop();
72 | }
73 | }
74 |
75 | public void Stop() {
76 | if (IsPlaying) {
77 | graph.Stop();
78 | graph.Destroy();
79 | animator.enabled = false;
80 | IsPlaying = false;
81 | }
82 | }
83 |
84 | public void Pause() {
85 | clipPlayable.Pause();
86 | }
87 |
88 | public void SetToNormalizedTime(float time) {
89 | if (IsPlaying) {
90 | var duration = clipPlayable.GetDuration();
91 | clipPlayable.SetTime(time * duration);
92 | }
93 | else {
94 | Debug.LogWarning("Calling SetToNormalizedTime on a SingleClipPlayer that's not playing. That's not neccessary, SingleClipPlayers " +
95 | "always start their clips at time 0");
96 | }
97 | }
98 |
99 | private void OnDestroy() {
100 | Stop();
101 | }
102 |
103 | public void GetAnimationClips(List results) {
104 | results.EnsureContains(clip);
105 | }
106 | }
107 | }
--------------------------------------------------------------------------------
/Runtime/SingleClipPlayer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 407147e1c1342e74fad6649f48c611bb
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/StateTransition.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using UnityEngine;
4 |
5 | namespace Animation_Player
6 | {
7 | ///
8 | /// Information about how to transition between two given states
9 | ///
10 | [Serializable]
11 | public class StateTransition
12 | {
13 | private const string DefaultName = "Transition";
14 |
15 | public bool isDefault;
16 | public string name = DefaultName;
17 |
18 | [SerializeField]
19 | private SerializedGUID fromStateGUID;
20 | [SerializeField]
21 | private SerializedGUID toStateGUID;
22 |
23 | public TransitionData transitionData;
24 |
25 | private AnimationPlayerState fromState, toState;
26 | public AnimationPlayerState FromState
27 | {
28 | get => fromState;
29 | set
30 | {
31 | fromState = value;
32 | fromStateGUID = fromState.GUID;
33 | }
34 | }
35 |
36 | public AnimationPlayerState ToState
37 | {
38 | get => toState;
39 | set
40 | {
41 | toState = value;
42 | toStateGUID = toState?.GUID ?? SerializedGUID.Empty;
43 | }
44 | }
45 |
46 | public void FetchStates(List allStates)
47 | {
48 | fromState = allStates.Find(state => state.GUID == fromStateGUID);
49 | toState = allStates.Find(state => state.GUID == toStateGUID);
50 | }
51 | }
52 |
53 | ///
54 | /// Type of the transition
55 | ///
56 | public enum TransitionType
57 | {
58 | // UserDefined = 0 was a bad idea.
59 |
60 | ///
61 | /// Use a linear transition with a certain duration
62 | ///
63 | Linear = 1,
64 | ///
65 | /// Use an AnimationCurve for the transition.
66 | ///
67 | Curve = 2,
68 | ///
69 | /// Use an Animation clip to blend between the states.
70 | ///
71 | Clip = 3,
72 | }
73 |
74 | ///
75 | /// Information about how the AnimationPlayer should transition from one state to another
76 | ///
77 | [Serializable]
78 | public struct TransitionData
79 | {
80 | public TransitionType type;
81 | public float duration;
82 | public AnimationCurve curve;
83 | public AnimationClip clip;
84 |
85 | public static TransitionData Linear(float duration)
86 | {
87 | return new TransitionData
88 | {
89 | duration = Mathf.Max(0f, duration),
90 | type = TransitionType.Linear,
91 | curve = new AnimationCurve(),
92 | clip = null
93 | };
94 | }
95 |
96 | public static TransitionData FromCurve(AnimationCurve curve)
97 | {
98 | return new TransitionData
99 | {
100 | duration = curve.Duration(),
101 | type = TransitionType.Curve,
102 | curve = curve,
103 | clip = null
104 | };
105 | }
106 |
107 | public static TransitionData Instant()
108 | {
109 | return new TransitionData
110 | {
111 | duration = 0f,
112 | type = TransitionType.Linear,
113 | curve = new AnimationCurve(),
114 | clip = null
115 | };
116 | }
117 |
118 | public static TransitionData Clip(AnimationClip clip)
119 | {
120 | return new TransitionData
121 | {
122 | duration = 0f,
123 | type = TransitionType.Clip,
124 | curve = new AnimationCurve(),
125 | clip = clip
126 | };
127 | }
128 |
129 | public static bool operator ==(TransitionData a, TransitionData b)
130 | {
131 | if (a.type != b.type)
132 | return false;
133 | if (a.duration != b.duration)
134 | return false;
135 | if (a.type == TransitionType.Linear)
136 | return a.duration == b.duration;
137 |
138 | if (a.curve == null)
139 | return b.curve == null;
140 | if (b.curve == null)
141 | return false;
142 |
143 | return a.curve.Equals(b.curve);
144 | }
145 |
146 | public static bool operator !=(TransitionData a, TransitionData b)
147 | {
148 | return !(a == b);
149 | }
150 |
151 | public bool Equals(TransitionData other)
152 | {
153 | return this == other;
154 | }
155 |
156 | public override bool Equals(object obj)
157 | {
158 | if (ReferenceEquals(null, obj)) return false;
159 | return obj is TransitionData td && Equals(td);
160 | }
161 |
162 | public override int GetHashCode()
163 | {
164 | unchecked
165 | {
166 | var hashCode = duration.GetHashCode();
167 | hashCode = (hashCode * 397) ^ (int) type;
168 | hashCode = (hashCode * 397) ^ (curve != null ? curve.GetHashCode() : 0);
169 | return hashCode;
170 | }
171 | }
172 | }
173 | }
--------------------------------------------------------------------------------
/Runtime/StateTransition.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ceec54d100725ce45a25e7c4ce2f69d3
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Runtime/csc.rsp:
--------------------------------------------------------------------------------
1 | -nowarn:0649
--------------------------------------------------------------------------------
/Runtime/csc.rsp.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f77df168bf94b9d44b1dc72d650db91c
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e182c882f829e5d4189cd94ab4cc8b8f
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/CubeController.controller.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c59ca27bfdcdba649b76b42b74af8889
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 9100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/CubeMask.mask:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!319 &31900000
4 | AvatarMask:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_Name: CubeMask
10 | m_Mask: 01000000010000000100000001000000010000000100000001000000010000000100000001000000010000000100000001000000
11 | m_Elements:
12 | - m_Path:
13 | m_Weight: 1
14 | - m_Path: Left_Cube
15 | m_Weight: 0
16 | - m_Path: Right_Cube
17 | m_Weight: 1
18 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/CubeMask.mask.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b2ddc94bb6859d948b41ded85a31758e
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 31900000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/EmptyWithIK.controller:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!91 &9100000
4 | AnimatorController:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_Name: EmptyWithIK
10 | serializedVersion: 5
11 | m_AnimatorParameters: []
12 | m_AnimatorLayers:
13 | - serializedVersion: 5
14 | m_Name: Base Layer
15 | m_StateMachine: {fileID: 1107357199177077750}
16 | m_Mask: {fileID: 0}
17 | m_Motions: []
18 | m_Behaviours: []
19 | m_BlendingMode: 0
20 | m_SyncedLayerIndex: -1
21 | m_DefaultWeight: 0
22 | m_IKPass: 1
23 | m_SyncedLayerAffectsTiming: 0
24 | m_Controller: {fileID: 9100000}
25 | --- !u!1107 &1107357199177077750
26 | AnimatorStateMachine:
27 | serializedVersion: 5
28 | m_ObjectHideFlags: 1
29 | m_CorrespondingSourceObject: {fileID: 0}
30 | m_PrefabInstance: {fileID: 0}
31 | m_PrefabAsset: {fileID: 0}
32 | m_Name: Base Layer
33 | m_ChildStates: []
34 | m_ChildStateMachines: []
35 | m_AnyStateTransitions: []
36 | m_EntryTransitions: []
37 | m_StateMachineTransitions: {}
38 | m_StateMachineBehaviours: []
39 | m_AnyStatePosition: {x: 50, y: 20, z: 0}
40 | m_EntryPosition: {x: 50, y: 120, z: 0}
41 | m_ExitPosition: {x: 800, y: 120, z: 0}
42 | m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
43 | m_DefaultState: {fileID: 0}
44 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/EmptyWithIK.controller.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 579400034a55bd649ad890c780412884
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 9100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eb0e763ded53048dd80e7b78c35ded56
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidCrouch.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidCrouch.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidIdle.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidIdle.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidIdleJumpUp.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidIdleJumpUp.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidJumpAndFall.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidJumpAndFall.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidMidAir.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidMidAir.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidRun.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidRun.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidRunTurn.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidRunTurn.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidRunTurnSharp.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidRunTurnSharp.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidStandTurn.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidStandTurn.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidWalk.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidWalk.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidWalkTurn.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidWalkTurn.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidWalkTurnSharp.fbx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/FromStandardAssets/HumanoidWalkTurnSharp.fbx
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/High.anim.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2ca257280f8273448bedb60eb9f7d5eb
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 7400000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Idle_lookAround_teri.anim.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2015776c52ce4cf40adfe1eb99607dcb
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 7400000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Low.anim.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 60fcf93512bebac4f890c3ebe54ac175
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 7400000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8228b86565e5ce64ebcffbd3d3370938
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/CoatFlap.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: CoatFlap
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/CoatFlap.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 939b24f4e1d81ae4aa49b2b07756951f
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Material.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: Material
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Material.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 336c19e77c6f0b14bb480f3b0c94f1ad
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Material_001.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: Material_001
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Material_001.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b4380438457abd04aaf93e21c9580c23
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Material_003.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: Material_003
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Material_003.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e9d7c0d2393f379489ce6b4ab418108b
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Material_004.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: Material_004
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Material_004.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2a0db1493a8676145bd0c715caf7437d
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Material_005.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: Material_005
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Material_005.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 11a1551bc1d85be41aef78e0ed8fc084
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Metal.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: Metal
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Metal.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3b983c56b12278a4a9659864566a7def
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Pants.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: Pants
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Pants.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: deeeaa7065dd93843b92c194c5e9a879
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/RG_PBR2_Material.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: RG_PBR2_Material
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.5841, g: 0.0864, b: 0.081, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/RG_PBR2_Material.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 115e2193f9d428049a6416028e767466
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/RG_PBR2_Material_001.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: RG_PBR2_Material_001
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.5841, g: 0.0864, b: 0.081, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/RG_PBR2_Material_001.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3d395ca435454384a94f77ec5addac38
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Shirt.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: Shirt
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 0, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 0}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 0, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 1
64 | - _Glossiness: 0.5
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.8, g: 0.8, b: 0.8, a: 1}
77 | - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Shirt.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6b0862e1a8d6ef245b93338174ab5bc4
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Teri_RGB.mat:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!21 &2100000
4 | Material:
5 | serializedVersion: 6
6 | m_ObjectHideFlags: 0
7 | m_CorrespondingSourceObject: {fileID: 0}
8 | m_PrefabInstance: {fileID: 0}
9 | m_PrefabAsset: {fileID: 0}
10 | m_Name: Teri_RGB
11 | m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
12 | m_ShaderKeywords:
13 | m_LightmapFlags: 4
14 | m_EnableInstancingVariants: 0
15 | m_DoubleSidedGI: 0
16 | m_CustomRenderQueue: -1
17 | stringTagMap: {}
18 | disabledShaderPasses: []
19 | m_SavedProperties:
20 | serializedVersion: 3
21 | m_TexEnvs:
22 | - _BumpMap:
23 | m_Texture: {fileID: 0}
24 | m_Scale: {x: 1, y: 1}
25 | m_Offset: {x: 0, y: 0}
26 | - _DetailAlbedoMap:
27 | m_Texture: {fileID: 0}
28 | m_Scale: {x: 1, y: 1}
29 | m_Offset: {x: 0, y: 0}
30 | - _DetailMask:
31 | m_Texture: {fileID: 0}
32 | m_Scale: {x: 1, y: 1}
33 | m_Offset: {x: 0, y: 0}
34 | - _DetailNormalMap:
35 | m_Texture: {fileID: 0}
36 | m_Scale: {x: 1, y: 1}
37 | m_Offset: {x: 0, y: 0}
38 | - _EmissionMap:
39 | m_Texture: {fileID: 0}
40 | m_Scale: {x: 1, y: 1}
41 | m_Offset: {x: 1, y: 0}
42 | - _MainTex:
43 | m_Texture: {fileID: 2800000, guid: fd9495847a7d5d747a46d82ade540569, type: 3}
44 | m_Scale: {x: 1, y: 1}
45 | m_Offset: {x: 1, y: 0}
46 | - _MetallicGlossMap:
47 | m_Texture: {fileID: 0}
48 | m_Scale: {x: 1, y: 1}
49 | m_Offset: {x: 0, y: 0}
50 | - _OcclusionMap:
51 | m_Texture: {fileID: 0}
52 | m_Scale: {x: 1, y: 1}
53 | m_Offset: {x: 0, y: 0}
54 | - _ParallaxMap:
55 | m_Texture: {fileID: 0}
56 | m_Scale: {x: 1, y: 1}
57 | m_Offset: {x: 0, y: 0}
58 | m_Floats:
59 | - _BumpScale: 1
60 | - _Cutoff: 0.5
61 | - _DetailNormalMapScale: 1
62 | - _DstBlend: 0
63 | - _GlossMapScale: 0.321
64 | - _Glossiness: 0
65 | - _GlossyReflections: 1
66 | - _Metallic: 0
67 | - _Mode: 0
68 | - _OcclusionStrength: 1
69 | - _Parallax: 0.02
70 | - _SmoothnessTextureChannel: 0
71 | - _SpecularHighlights: 1
72 | - _SrcBlend: 1
73 | - _UVSec: 0
74 | - _ZWrite: 1
75 | m_Colors:
76 | - _Color: {r: 0.85294116, g: 0.85294116, b: 0.85294116, a: 1}
77 | - _EmissionColor: {r: 0.3602941, g: 0.15365483, b: 0.15365483, a: 1}
78 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Materials/Teri_RGB.mat.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2e7134057edc8d14dabe346d2c5ae71d
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 2100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Mid.anim.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f2816587fa48a7f48a030f97ff7b205c
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 7400000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/RunJog.controller:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!91 &9100000
4 | AnimatorController:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_Name: RunJog
10 | serializedVersion: 5
11 | m_AnimatorParameters:
12 | - m_Name: Speed
13 | m_Type: 1
14 | m_DefaultFloat: 0
15 | m_DefaultInt: 0
16 | m_DefaultBool: 0
17 | m_Controller: {fileID: 9100000}
18 | m_AnimatorLayers:
19 | - serializedVersion: 5
20 | m_Name: Base Layer
21 | m_StateMachine: {fileID: 1107180278296427480}
22 | m_Mask: {fileID: 0}
23 | m_Motions: []
24 | m_Behaviours: []
25 | m_BlendingMode: 0
26 | m_SyncedLayerIndex: -1
27 | m_DefaultWeight: 0
28 | m_IKPass: 0
29 | m_SyncedLayerAffectsTiming: 0
30 | m_Controller: {fileID: 9100000}
31 | --- !u!206 &206223667455584716
32 | BlendTree:
33 | m_ObjectHideFlags: 1
34 | m_CorrespondingSourceObject: {fileID: 0}
35 | m_PrefabInstance: {fileID: 0}
36 | m_PrefabAsset: {fileID: 0}
37 | m_Name: Blend Tree
38 | m_Childs:
39 | - serializedVersion: 2
40 | m_Motion: {fileID: 7400088, guid: 889da77ec19d7ba4099e3746e3338109, type: 3}
41 | m_Threshold: 0
42 | m_Position: {x: 0, y: 0}
43 | m_TimeScale: 1
44 | m_CycleOffset: 0
45 | m_DirectBlendParameter: Blend
46 | m_Mirror: 0
47 | - serializedVersion: 2
48 | m_Motion: {fileID: 7400034, guid: 889da77ec19d7ba4099e3746e3338109, type: 3}
49 | m_Threshold: 0.5
50 | m_Position: {x: 0, y: 0}
51 | m_TimeScale: 1
52 | m_CycleOffset: 0
53 | m_DirectBlendParameter: Blend
54 | m_Mirror: 0
55 | - serializedVersion: 2
56 | m_Motion: {fileID: 7400066, guid: 889da77ec19d7ba4099e3746e3338109, type: 3}
57 | m_Threshold: 1
58 | m_Position: {x: 0, y: 0}
59 | m_TimeScale: 1
60 | m_CycleOffset: 0
61 | m_DirectBlendParameter: Blend
62 | m_Mirror: 0
63 | m_BlendParameter: Speed
64 | m_BlendParameterY: Blend
65 | m_MinThreshold: 0
66 | m_MaxThreshold: 1
67 | m_UseAutomaticThresholds: 0
68 | m_NormalizedBlendValues: 0
69 | m_BlendType: 0
70 | --- !u!1102 &1102717072914834014
71 | AnimatorState:
72 | serializedVersion: 5
73 | m_ObjectHideFlags: 1
74 | m_CorrespondingSourceObject: {fileID: 0}
75 | m_PrefabInstance: {fileID: 0}
76 | m_PrefabAsset: {fileID: 0}
77 | m_Name: Blend Tree
78 | m_Speed: 1
79 | m_CycleOffset: 0
80 | m_Transitions: []
81 | m_StateMachineBehaviours: []
82 | m_Position: {x: 50, y: 50, z: 0}
83 | m_IKOnFeet: 0
84 | m_WriteDefaultValues: 1
85 | m_Mirror: 0
86 | m_SpeedParameterActive: 0
87 | m_MirrorParameterActive: 0
88 | m_CycleOffsetParameterActive: 0
89 | m_TimeParameterActive: 0
90 | m_Motion: {fileID: 206223667455584716}
91 | m_Tag:
92 | m_SpeedParameter:
93 | m_MirrorParameter:
94 | m_CycleOffsetParameter:
95 | m_TimeParameter:
96 | --- !u!1107 &1107180278296427480
97 | AnimatorStateMachine:
98 | serializedVersion: 5
99 | m_ObjectHideFlags: 1
100 | m_CorrespondingSourceObject: {fileID: 0}
101 | m_PrefabInstance: {fileID: 0}
102 | m_PrefabAsset: {fileID: 0}
103 | m_Name: Base Layer
104 | m_ChildStates:
105 | - serializedVersion: 1
106 | m_State: {fileID: 1102717072914834014}
107 | m_Position: {x: 360, y: 120, z: 0}
108 | m_ChildStateMachines: []
109 | m_AnyStateTransitions: []
110 | m_EntryTransitions: []
111 | m_StateMachineTransitions: {}
112 | m_StateMachineBehaviours: []
113 | m_AnyStatePosition: {x: 50, y: 20, z: 0}
114 | m_EntryPosition: {x: 50, y: 120, z: 0}
115 | m_ExitPosition: {x: 800, y: 120, z: 0}
116 | m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
117 | m_DefaultState: {fileID: 1102717072914834014}
118 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/RunJog.controller.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 57877a2bb526f2349a728cbf268e42f2
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 9100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TeriMask.mask.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 74a541df42edcc34688336a4b60b1f0f
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 31900000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Teri_63_Allanimations.blend:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/Teri_63_Allanimations.blend
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Teri_RGB.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/Teri_RGB.png
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Teri_RGB.png.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fd9495847a7d5d747a46d82ade540569
3 | TextureImporter:
4 | fileIDToRecycleName: {}
5 | externalObjects: {}
6 | serializedVersion: 9
7 | mipmaps:
8 | mipMapMode: 0
9 | enableMipMap: 1
10 | sRGBTexture: 1
11 | linearTexture: 0
12 | fadeOut: 0
13 | borderMipMap: 0
14 | mipMapsPreserveCoverage: 0
15 | alphaTestReferenceValue: 0.5
16 | mipMapFadeDistanceStart: 1
17 | mipMapFadeDistanceEnd: 3
18 | bumpmap:
19 | convertToNormalMap: 0
20 | externalNormalMap: 0
21 | heightScale: 0.25
22 | normalMapFilter: 0
23 | isReadable: 0
24 | streamingMipmaps: 0
25 | streamingMipmapsPriority: 0
26 | grayScaleToAlpha: 0
27 | generateCubemap: 6
28 | cubemapConvolution: 0
29 | seamlessCubemap: 0
30 | textureFormat: 1
31 | maxTextureSize: 2048
32 | textureSettings:
33 | serializedVersion: 2
34 | filterMode: -1
35 | aniso: -1
36 | mipBias: -100
37 | wrapU: -1
38 | wrapV: -1
39 | wrapW: -1
40 | nPOTScale: 1
41 | lightmap: 0
42 | compressionQuality: 50
43 | spriteMode: 0
44 | spriteExtrude: 1
45 | spriteMeshType: 1
46 | alignment: 0
47 | spritePivot: {x: 0.5, y: 0.5}
48 | spritePixelsToUnits: 100
49 | spriteBorder: {x: 0, y: 0, z: 0, w: 0}
50 | spriteGenerateFallbackPhysicsShape: 1
51 | alphaUsage: 1
52 | alphaIsTransparency: 0
53 | spriteTessellationDetail: -1
54 | textureType: 0
55 | textureShape: 1
56 | singleChannelComponent: 0
57 | maxTextureSizeSet: 0
58 | compressionQualitySet: 0
59 | textureFormatSet: 0
60 | platformSettings:
61 | - serializedVersion: 2
62 | buildTarget: DefaultTexturePlatform
63 | maxTextureSize: 2048
64 | resizeAlgorithm: 0
65 | textureFormat: -1
66 | textureCompression: 1
67 | compressionQuality: 50
68 | crunchedCompression: 0
69 | allowsAlphaSplitting: 0
70 | overridden: 0
71 | androidETC2FallbackOverride: 0
72 | spriteSheet:
73 | serializedVersion: 2
74 | sprites: []
75 | outline: []
76 | physicsShape: []
77 | bones: []
78 | spriteID:
79 | vertices: []
80 | indices:
81 | edges: []
82 | weights: []
83 | spritePackingTag:
84 | pSDRemoveMatte: 0
85 | pSDShowRemoveMatteOption: 0
86 | userData:
87 | assetBundleName:
88 | assetBundleVariant:
89 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Teri_TestPlayer.prefab.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8c6e40d2ad94ce840adc4c3f05edbf33
3 | PrefabImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/Test2DBlend.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4fa2eafafb1bf6240b10e92cba495345
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestCharacter_SimpleHumanoidRig.blend:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/Baste-RainGames/AnimationPlayer/9e3612274c37a8d6f9087eb9c28e4770e66d7453/Samples~/DevelopmentSamples/TestAssets/TestCharacter_SimpleHumanoidRig.blend
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestController.controller:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!91 &9100000
4 | AnimatorController:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_Name: TestController
10 | serializedVersion: 5
11 | m_AnimatorParameters:
12 | - m_Name: run
13 | m_Type: 4
14 | m_DefaultFloat: 0
15 | m_DefaultInt: 0
16 | m_DefaultBool: 0
17 | m_Controller: {fileID: 9100000}
18 | m_AnimatorLayers:
19 | - serializedVersion: 5
20 | m_Name: Base Layer
21 | m_StateMachine: {fileID: 1107804017918585920}
22 | m_Mask: {fileID: 0}
23 | m_Motions: []
24 | m_Behaviours: []
25 | m_BlendingMode: 0
26 | m_SyncedLayerIndex: -1
27 | m_DefaultWeight: 0
28 | m_IKPass: 0
29 | m_SyncedLayerAffectsTiming: 0
30 | m_Controller: {fileID: 9100000}
31 | --- !u!1101 &1101140220152078566
32 | AnimatorStateTransition:
33 | m_ObjectHideFlags: 1
34 | m_CorrespondingSourceObject: {fileID: 0}
35 | m_PrefabInstance: {fileID: 0}
36 | m_PrefabAsset: {fileID: 0}
37 | m_Name:
38 | m_Conditions:
39 | - m_ConditionMode: 1
40 | m_ConditionEvent: run
41 | m_EventTreshold: 0
42 | m_DstStateMachine: {fileID: 0}
43 | m_DstState: {fileID: 1102848720158070796}
44 | m_Solo: 0
45 | m_Mute: 0
46 | m_IsExit: 0
47 | serializedVersion: 3
48 | m_TransitionDuration: 0.25
49 | m_TransitionOffset: 0
50 | m_ExitTime: 0.8958334
51 | m_HasExitTime: 1
52 | m_HasFixedDuration: 1
53 | m_InterruptionSource: 0
54 | m_OrderedInterruption: 1
55 | m_CanTransitionToSelf: 1
56 | --- !u!1101 &1101925145146602374
57 | AnimatorStateTransition:
58 | m_ObjectHideFlags: 1
59 | m_CorrespondingSourceObject: {fileID: 0}
60 | m_PrefabInstance: {fileID: 0}
61 | m_PrefabAsset: {fileID: 0}
62 | m_Name:
63 | m_Conditions:
64 | - m_ConditionMode: 2
65 | m_ConditionEvent: run
66 | m_EventTreshold: 0
67 | m_DstStateMachine: {fileID: 0}
68 | m_DstState: {fileID: 1102486499855251422}
69 | m_Solo: 0
70 | m_Mute: 0
71 | m_IsExit: 0
72 | serializedVersion: 3
73 | m_TransitionDuration: 0.25
74 | m_TransitionOffset: 0
75 | m_ExitTime: 0.57865167
76 | m_HasExitTime: 1
77 | m_HasFixedDuration: 1
78 | m_InterruptionSource: 0
79 | m_OrderedInterruption: 1
80 | m_CanTransitionToSelf: 1
81 | --- !u!1102 &1102486499855251422
82 | AnimatorState:
83 | serializedVersion: 5
84 | m_ObjectHideFlags: 1
85 | m_CorrespondingSourceObject: {fileID: 0}
86 | m_PrefabInstance: {fileID: 0}
87 | m_PrefabAsset: {fileID: 0}
88 | m_Name: HumanoidIdle
89 | m_Speed: 1
90 | m_CycleOffset: 0
91 | m_Transitions:
92 | - {fileID: 1101140220152078566}
93 | m_StateMachineBehaviours: []
94 | m_Position: {x: 50, y: 50, z: 0}
95 | m_IKOnFeet: 0
96 | m_WriteDefaultValues: 1
97 | m_Mirror: 0
98 | m_SpeedParameterActive: 0
99 | m_MirrorParameterActive: 0
100 | m_CycleOffsetParameterActive: 0
101 | m_TimeParameterActive: 0
102 | m_Motion: {fileID: 7400000, guid: dffa50cfe77e0434bbfa71245b3dd529, type: 3}
103 | m_Tag:
104 | m_SpeedParameter:
105 | m_MirrorParameter:
106 | m_CycleOffsetParameter:
107 | m_TimeParameter:
108 | --- !u!1102 &1102848720158070796
109 | AnimatorState:
110 | serializedVersion: 5
111 | m_ObjectHideFlags: 1
112 | m_CorrespondingSourceObject: {fileID: 0}
113 | m_PrefabInstance: {fileID: 0}
114 | m_PrefabAsset: {fileID: 0}
115 | m_Name: HumanoidRun
116 | m_Speed: 1
117 | m_CycleOffset: 0
118 | m_Transitions:
119 | - {fileID: 1101925145146602374}
120 | m_StateMachineBehaviours: []
121 | m_Position: {x: 50, y: 50, z: 0}
122 | m_IKOnFeet: 0
123 | m_WriteDefaultValues: 1
124 | m_Mirror: 0
125 | m_SpeedParameterActive: 0
126 | m_MirrorParameterActive: 0
127 | m_CycleOffsetParameterActive: 0
128 | m_TimeParameterActive: 0
129 | m_Motion: {fileID: 7400000, guid: 1cb8ed3cbba15f0479fbae54e0a963df, type: 3}
130 | m_Tag:
131 | m_SpeedParameter:
132 | m_MirrorParameter:
133 | m_CycleOffsetParameter:
134 | m_TimeParameter:
135 | --- !u!1107 &1107804017918585920
136 | AnimatorStateMachine:
137 | serializedVersion: 5
138 | m_ObjectHideFlags: 1
139 | m_CorrespondingSourceObject: {fileID: 0}
140 | m_PrefabInstance: {fileID: 0}
141 | m_PrefabAsset: {fileID: 0}
142 | m_Name: Base Layer
143 | m_ChildStates:
144 | - serializedVersion: 1
145 | m_State: {fileID: 1102486499855251422}
146 | m_Position: {x: 336, y: 120, z: 0}
147 | - serializedVersion: 1
148 | m_State: {fileID: 1102848720158070796}
149 | m_Position: {x: 336, y: 252, z: 0}
150 | m_ChildStateMachines: []
151 | m_AnyStateTransitions: []
152 | m_EntryTransitions: []
153 | m_StateMachineTransitions: {}
154 | m_StateMachineBehaviours: []
155 | m_AnyStatePosition: {x: 50, y: 20, z: 0}
156 | m_EntryPosition: {x: 50, y: 120, z: 0}
157 | m_ExitPosition: {x: 800, y: 120, z: 0}
158 | m_ParentStateMachinePosition: {x: 800, y: 20, z: 0}
159 | m_DefaultState: {fileID: 1102486499855251422}
160 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestController.controller.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d5f0fb5fdf4d2b447a032c9137761f98
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 9100000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestScene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: bd45808be09a56847ab0024713fd98f6
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestScene2.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eeafafd6021fa8d40992d49a8660a22b
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestScripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9fc8f4ac32b07e142b97dfdf0c314526
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestScripts/BlendTest.cs:
--------------------------------------------------------------------------------
1 | using Animation_Player;
2 | using UnityEngine;
3 |
4 | public class BlendTest : MonoBehaviour
5 | {
6 | public AnimationPlayer animationPlayer;
7 | public Animator animator;
8 |
9 | void Update()
10 | {
11 | for (KeyCode k = KeyCode.Alpha0; k <= KeyCode.Alpha9; k++)
12 | {
13 | if (Input.GetKeyDown(k))
14 | {
15 | float keyVal = (int) k - (int) KeyCode.Alpha0;
16 | float val = Mathf.InverseLerp(0f, 9f, keyVal);
17 |
18 | animationPlayer.SetBlendVar("Speed", val);
19 | animator.SetFloat("Speed", val);
20 | }
21 | }
22 | }
23 |
24 | //
25 | // public Animator thatAnimator;
26 | //
27 | // public AnimationClip walk;
28 | // public AnimationClip jog;
29 | // public AnimationClip run;
30 | //
31 | // private PlayableGraph graph;
32 | // private AnimationMixerPlayable mixer;
33 | // private AnimationClipPlayable walkPlayable;
34 | // private AnimationClipPlayable jogPlayable;
35 | // private AnimationClipPlayable runPlayable;
36 | //
37 | // void Start()
38 | // {
39 | // var animator = gameObject.AddComponent();
40 | //
41 | // graph = PlayableGraph.Create();
42 | // graph.SetTimeUpdateMode(DirectorUpdateMode.GameTime);
43 | // var animOutput = AnimationPlayableOutput.Create(graph, $"test the thing", animator);
44 | //
45 | // var avgLength = (jog.length + run.length) / 2f;
46 | //
47 | // walkPlayable = AnimationClipPlayable.Create(graph, walk);
48 | // jogPlayable = AnimationClipPlayable.Create(graph, jog);
49 | // runPlayable = AnimationClipPlayable.Create(graph, run);
50 | //
51 | // runPlayable.SetSpeed(run.length / avgLength);
52 | // jogPlayable.SetSpeed(jog.length / avgLength);
53 | //
54 | // mixer = AnimationMixerPlayable.Create(graph, 3, true);
55 | //
56 | // graph.Connect(walkPlayable, 0, mixer, 1);
57 | // graph.Connect(jogPlayable, 0, mixer, 1);
58 | // graph.Connect(runPlayable, 0, mixer, 2);
59 | //
60 | // mixer.SetInputWeight(0, 1f);
61 | // mixer.SetInputWeight(1, 0f);
62 | // mixer.SetInputWeight(2, 0f);
63 | //
64 | // animOutput.SetSourcePlayable(mixer);
65 | // graph.Play();
66 | //
67 | // var visualizerClientName = name + " AnimationPlayer";
68 | // GraphVisualizerClient.Show(graph, visualizerClientName);
69 | // }
70 | //
71 | // private void OnDestroy()
72 | // {
73 | // graph.Destroy();
74 | // }
75 | //
76 | // void Update()
77 | // {
78 | // for (KeyCode k = KeyCode.Alpha0; k <= KeyCode.Alpha9; k++)
79 | // {
80 | // if (Input.GetKeyDown(k))
81 | // {
82 | // float keyVal = (int) k - (int) KeyCode.Alpha0;
83 | // float val = Mathf.InverseLerp(0f, 9f, keyVal);
84 | //
85 | // thatAnimator.SetFloat("Blend", val);
86 | //
87 | // mixer.SetInputWeight(0, 1 - val);
88 | // mixer.SetInputWeight(1, val);
89 | //
90 | // var jogSpeedWhenPlayingJog = 1f;
91 | // var jogSpeedWhenPlayingRun = jog.length / run.length;
92 | //
93 | // var runSpeedWhenPlayingRun = 1f;
94 | // var runSpeedWhenPlayingJog = run.length / jog.length;
95 | //
96 | // jogPlayable.SetSpeed(Mathf.Lerp(jogSpeedWhenPlayingJog, jogSpeedWhenPlayingRun, val));
97 | // runPlayable.SetSpeed(Mathf.Lerp(runSpeedWhenPlayingJog, runSpeedWhenPlayingRun, val));
98 | //
99 | // Debug.Log(mixer.GetInputWeight(0) + "/" + mixer.GetInputWeight(1));
100 | // }
101 | // }
102 | // }
103 | }
104 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestScripts/BlendTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 53b08d239074dda4e8a350b7cb2d525c
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestScripts/CompareAnimatorAnimationPlayer.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace Animation_Player
4 | {
5 | public class CompareAnimatorAnimationPlayer : MonoBehaviour
6 | {
7 |
8 | public Animator animator;
9 | public AnimationPlayer animationPlayer;
10 |
11 | [Range(0f, 1f)]
12 | public float forward;
13 | [Range(-1f, 1f)]
14 | public float turn;
15 |
16 | void Update()
17 | {
18 | animator.SetFloat("Forward", forward);
19 | animator.SetFloat("Turn", turn);
20 |
21 | animationPlayer.SetBlendVar("Forward", forward);
22 | animationPlayer.SetBlendVar("Turn", turn);
23 | }
24 | }
25 | }
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestScripts/CompareAnimatorAnimationPlayer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 908cfaf2572501c48b4cd0abce700e4d
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestScripts/TestScript.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Animation_Player;
3 | using UnityEngine;
4 |
5 | public class TestScript : MonoBehaviour
6 | {/*
7 | private AnimationPlayer animationPlayer;
8 | private int testIndex;
9 | public AnimationClip clip;
10 |
11 | void Start()
12 | {
13 | animationPlayer = GetComponent();
14 | animationPlayer.RegisterAnimationEventListener("TestEvent1", TestEvent1);
15 | // animationPlayer.RegisterAnimationEventListener("TestEvent2", TestEvent2);
16 | }
17 |
18 | private void TestEvent2() {
19 | print("Test Event 2!");
20 | }
21 |
22 | private void TestEvent1() {
23 | print("Test Event 1!");
24 | }
25 |
26 | void Update()
27 | {
28 | if (Input.GetKeyDown(KeyCode.Q))
29 | {
30 | animationPlayer.Play("Attack 1");
31 | animationPlayer.PlayAfterSeconds(animationPlayer.GetPlayingState().Duration * .8f, "Movement");
32 | }
33 |
34 | if (Input.GetKeyDown(KeyCode.W))
35 | {
36 | animationPlayer.Play("Attack 2");
37 | animationPlayer.PlayAfterSeconds(animationPlayer.GetPlayingState().Duration * .8f, "Movement");
38 | }
39 |
40 | if (Input.GetKeyDown(KeyCode.E))
41 | {
42 | animationPlayer.Play("Attack 3");
43 | animationPlayer.PlayAfterSeconds(animationPlayer.GetPlayingState().Duration * .8f, "Movement");
44 | }
45 |
46 | if (Input.GetKeyDown(KeyCode.R))
47 | {
48 | animationPlayer.Play("Empty");
49 | animationPlayer.PlayAfterSeconds(animationPlayer.GetPlayingState().Duration * .8f, "Movement");
50 | }
51 |
52 | if (Input.GetKeyDown(KeyCode.Space))
53 | {
54 | if (!animationPlayer.HasState("Test", 0))
55 | {
56 | var newState = SingleClip.Create("Test", clip);
57 | testIndex = animationPlayer.AddState(newState);
58 | }
59 |
60 | animationPlayer.Play(testIndex);
61 | animationPlayer.PlayAfterSeconds(animationPlayer.GetPlayingState().Duration * .8f, "Movement");
62 | }
63 |
64 | if (Input.GetKeyDown(KeyCode.Alpha1))
65 | {
66 | Debug.Log("0");
67 | animationPlayer.SetBlendVar("Speed", 0);
68 | }
69 |
70 | if (Input.GetKeyDown(KeyCode.Alpha2))
71 | {
72 | Debug.Log("1");
73 | animationPlayer.SetBlendVar("Speed", 1);
74 | }
75 |
76 | if (Input.GetKeyDown(KeyCode.Alpha3))
77 | {
78 | Debug.Log("2");
79 | animationPlayer.SetBlendVar("Speed", 2);
80 | }
81 |
82 | if (Input.GetKeyDown(KeyCode.Alpha4))
83 | {
84 | Debug.Log("2");
85 | animationPlayer.SetBlendVar("Speed", 1.5f);
86 | }
87 | }
88 | */
89 | }
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/TestScripts/TestScript.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cb08d7692a2b0c2429d7e682cceb3611
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/Samples~/DevelopmentSamples/TestAssets/idle_RFoot_teri.anim.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 943a08f8d8f97414198eb9521dd2492c
3 | NativeFormatImporter:
4 | externalObjects: {}
5 | mainObjectFileID: 7400000
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Tests.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 064a3076c000b9d4ca14926dda70bcf8
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Tests/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ef4dc5e2b021c894aaed308a64523f23
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Tests/Editor/AnimationPlayer.Editor.Tests.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "AnimationPlayer.Editor.Tests",
3 | "references": [
4 | "AnimationPlayer.Editor"
5 | ],
6 | "optionalUnityReferences": [
7 | "TestAssemblies"
8 | ],
9 | "includePlatforms": [],
10 | "excludePlatforms": [],
11 | "allowUnsafeCode": false,
12 | "overrideReferences": false,
13 | "precompiledReferences": [],
14 | "autoReferenced": true,
15 | "defineConstraints": []
16 | }
--------------------------------------------------------------------------------
/Tests/Editor/AnimationPlayer.Editor.Tests.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d72ad5dea6671144a810127d4ba25a07
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Tests/Editor/TestSetValue.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using NUnit.Framework;
3 | using UnityEditor;
4 | using UnityEngine;
5 |
6 | namespace AnimationPlayer.Internal
7 | {
8 | public class TestSetValue
9 | {
10 | private DataContainer container;
11 | private SerializedObject containerSO;
12 |
13 | private class Data1Container : ValueContainer { }
14 | private class Data2Container : ValueContainer { }
15 | private class Data3Container : ValueContainer { }
16 |
17 | [Serializable]
18 | public class Data1
19 | {
20 | public int i;
21 | }
22 |
23 | [Serializable]
24 | public class Data2
25 | {
26 | public int i;
27 | public string s;
28 | public float f;
29 | }
30 |
31 | [Serializable]
32 | public class Data3
33 | {
34 | public Data1 data1;
35 | public float f;
36 | public Data2 data2;
37 | }
38 |
39 | public class DataContainer : ScriptableObject
40 | {
41 | public int justAnInt;
42 | public Data1 data1;public Data2 data2;
43 | public Data3 data3;
44 | }
45 |
46 | [SetUp]
47 | public void SetUp() {
48 | container = ScriptableObject.CreateInstance();
49 | containerSO = new SerializedObject(container);
50 |
51 | }
52 |
53 | [Test]
54 | public void SmokeTest() {
55 | container.justAnInt = 123;
56 | containerSO.FindProperty(nameof(DataContainer.justAnInt)).intValue = 3051;
57 | Assert.AreEqual(123, container.justAnInt);
58 | containerSO.ApplyModifiedProperties();
59 | Assert.AreEqual(3051, container.justAnInt);
60 | }
61 |
62 | [Test]
63 | public void TestValueContainer() {
64 | var valueContainer = ScriptableObject.CreateInstance();
65 | Assert.NotNull(valueContainer);
66 | valueContainer.t = 5029;
67 | var value = new SerializedObject(valueContainer);
68 | Assert.AreEqual(5029, value.FindProperty(nameof(IntContainer.t)).intValue);
69 | }
70 |
71 | [Test]
72 | public void TestJustAnInt()
73 | {
74 | var justAnIntProp = containerSO.FindProperty(nameof(DataContainer.justAnInt));
75 | SerializedPropertyHelper.SetValue(justAnIntProp, 13);
76 |
77 | Assert.AreEqual(13, container.justAnInt);
78 | }
79 |
80 | [Test]
81 | public void TestSetData1Value() {
82 | var data = new Data1 { i = 15 };
83 | var dataProp = containerSO.FindProperty(nameof(DataContainer.data1));
84 |
85 | SerializedPropertyHelper.SetValue(dataProp, data);
86 |
87 | Assert.AreEqual(15, container.data1.i);
88 | }
89 |
90 | [Test]
91 | public void TestSetData2Value()
92 | {
93 | var data2 = new Data2
94 | {
95 | i = 2345,
96 | s = "1dkløasgjp+",
97 | f = 58582f
98 | };
99 | var dataProp = containerSO.FindProperty(nameof(DataContainer.data2));
100 | SerializedPropertyHelper.SetValue(dataProp, data2);
101 |
102 | Assert.AreEqual(data2.i, container.data2.i);
103 | Assert.AreEqual(data2.s, container.data2.s);
104 | Assert.AreEqual(data2.f, container.data2.f);
105 | }
106 |
107 | [Test]
108 | public void TestCompound()
109 | {
110 | var data3 = new Data3
111 | {
112 | data1 = new Data1 { i = 890 },
113 | f = -2689789f,
114 | data2 = new Data2
115 | {
116 | f = 7892f,
117 | i = -25742,
118 | s = "øøøøøøøøøøøø"
119 | }
120 | };
121 | var dataProp = containerSO.FindProperty(nameof(DataContainer.data3));
122 | SerializedPropertyHelper.SetValue(dataProp, data3);
123 |
124 | Assert.AreEqual(data3.data1.i, container.data3.data1.i);
125 | Assert.AreEqual(data3.f, container.data3.f);
126 | Assert.AreEqual(data3.data2.f, container.data3.data2.f);
127 | Assert.AreEqual(data3.data2.i, container.data3.data2.i);
128 | Assert.AreEqual(data3.data2.s, container.data3.data2.s);
129 | }
130 | }
131 | }
--------------------------------------------------------------------------------
/Tests/Editor/TestSetValue.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c07e046b99a14b469517bc712f7390bb
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.baste.animationplayer",
3 | "version": "0.2.0",
4 | "displayName": "AnimationPlayer",
5 | "description": "Tool for playing animations in Unity",
6 | "unity" : "2018.4",
7 | "author": {
8 | "name": "Baste Nesse Buanes",
9 | "email": "baste@rain-games.com",
10 | "url": "https://github.com/Baste-RainGames/AnimationPlayer"
11 | },
12 | "dependencies" : {
13 | "com.baste.playerloopinterface": "1.0.0"
14 | },
15 | "samples": [
16 | {
17 |
18 | "displayName": "Development Samples",
19 |
20 | "description": "Code used for testing during development. Not really a 'sample', but this was the cleanest way I figured out to put them in the git repo without dumping the code into all user repos that grab the project.",
21 |
22 | "path": "Samples~/DevelopmentSamples"
23 |
24 | }
25 | ]
26 |
27 | }
--------------------------------------------------------------------------------
/package.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 43e25dbc30bc4274a96ac9c6b3561f08
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------