diff --git a/Package/Editor/EasingFunctions.curves b/Package/Editor/EasingFunctions.curves new file mode 100644 index 0000000..364ad40 --- /dev/null +++ b/Package/Editor/EasingFunctions.curves @@ -0,0 +1,1200 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &1 +MonoBehaviour: + m_ObjectHideFlags: 52 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 12322, guid: 0000000000000000e000000000000000, type: 0} + m_Name: EasingFunctions + m_EditorClassIdentifier: + m_Presets: + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333333 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 2.0000029 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333302 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 2.000003 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333333 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333302 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333334 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.9999939 + outSlope: 1.9999943 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333403 + outWeight: 0.33333397 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333397 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333333 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 3.0000029 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333302 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 3.000003 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333333 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333302 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333334 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 2.9999938 + outSlope: 2.9999943 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333403 + outWeight: 0.33333397 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333397 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.013942395 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.434789 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 3.9858193 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.269099 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 3.9858234 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.269099 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.013942328 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.434789 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.013942428 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.434788 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 3.9858418 + outSlope: 3.985834 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.26909798 + outWeight: 0.26909804 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.013942499 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.434788 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.024118112 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.519568 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 4.951815 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.225963 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 4.9532886 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.225963 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.024149083 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.518901 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.024120038 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.519568 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 4.951789 + outSlope: 4.9532685 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.22596401 + outWeight: 0.22596395 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.02415099 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.51890194 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012084927 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1.5725082 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1.5735515 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.330931 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009282457 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358689 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.031243885 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.636963 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 6.815432 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.155667 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 6.8154325 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.155667 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.031243537 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.636963 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.031245094 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.636964 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 6.815477 + outSlope: 6.8154764 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.155666 + outWeight: 0.155666 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.031243771 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.63696396 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.0021623378 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.55403 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 459.26703 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.0011979938 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 461.7679 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.001198 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.00216235 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.554024 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.0021623534 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.554026 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 461.77032 + outSlope: 461.74738 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.0011979938 + outWeight: 0.0011980534 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.0021624498 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.554026 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 1 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 3.5822635 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.23852958 + - serializedVersion: 3 + time: 0.336583 + value: 0.828268 + inSlope: 1.7675189 + outSlope: 1.7674915 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.43742254 + outWeight: 0.22151233 + - serializedVersion: 3 + time: 0.550666 + value: 1.079651 + inSlope: 0.30952567 + outSlope: 0.30952752 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.4695607 + outWeight: 0.41548836 + - serializedVersion: 3 + time: 0.779498 + value: 0.974607 + inSlope: -0.23213644 + outSlope: -0.23214284 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.35856426 + outWeight: 0.36235142 + - serializedVersion: 3 + time: 0.897999 + value: 1.003668 + inSlope: 0.27978534 + outSlope: 0.27974313 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33310264 + outWeight: 0.33069265 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.20239142 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.3296829 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.6874897 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.33336633 + - serializedVersion: 3 + time: 0.0909 + value: 0 + inSlope: -0.687694 + outSlope: 1.3747915 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.3332673 + outWeight: 0.3334159 + - serializedVersion: 3 + time: 0.2727 + value: 0 + inSlope: -1.3756083 + outSlope: 2.749388 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.3332179 + outWeight: 0.33334887 + - serializedVersion: 3 + time: 0.6364 + value: 0 + inSlope: -2.7491832 + outSlope: 5.5016418 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.3333737 + outWeight: 0.33326733 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33336633 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.33336633 + - serializedVersion: 3 + time: 0.3636 + value: 1 + inSlope: 5.5016427 + outSlope: -2.7491834 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.3332673 + outWeight: 0.33337367 + - serializedVersion: 3 + time: 0.7273 + value: 1 + inSlope: 2.749366 + outSlope: -1.3756089 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33335155 + outWeight: 0.33321783 + - serializedVersion: 3 + time: 0.9091 + value: 1 + inSlope: 1.3747919 + outSlope: -0.68770427 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33341584 + outWeight: 0.33326733 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.6875 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33336633 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.68750006 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333011 + - serializedVersion: 3 + time: 0.0455 + value: 0 + inSlope: -0.68546426 + outSlope: 1.3770571 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.334 + outWeight: 0.33287132 + - serializedVersion: 3 + time: 0.1364 + value: 0 + inSlope: -1.3733807 + outSlope: 2.7516427 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33376238 + outWeight: 0.33316833 + - serializedVersion: 3 + time: 0.3182 + value: 0 + inSlope: -2.7491915 + outSlope: 5.5016336 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33346537 + outWeight: 0.33326733 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33336633 + outWeight: 0.33336633 + - serializedVersion: 3 + time: 0.6818 + value: 1 + inSlope: 5.501634 + outSlope: -2.7491913 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33326733 + outWeight: 0.33346534 + - serializedVersion: 3 + time: 0.8636 + value: 1 + inSlope: 2.7516425 + outSlope: -1.3733802 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.3331683 + outWeight: 0.3319367 + - serializedVersion: 3 + time: 0.955 + value: 1 + inSlope: 1.354673 + outSlope: -0.7087823 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33652052 + outWeight: 0.32660022 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.6875 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33671048 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333333 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 4.7015834 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333302 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 4.701584 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333333 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333302 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333334 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 5.594898 + outSlope: 5.594899 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333403 + outWeight: 0.33333397 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333397 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.014328401 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 1 + - serializedVersion: 3 + time: 0.175 + value: 0 + inSlope: 0 + outSlope: -0.06879552 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.0083314525 + outWeight: 0.89166665 + - serializedVersion: 3 + time: 0.475 + value: 0 + inSlope: -0.40816325 + outSlope: -0.5503653 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.40833333 + outWeight: 0.8666668 + - serializedVersion: 3 + time: 0.775 + value: 0 + inSlope: -3.26241 + outSlope: -4.402922 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.3916665 + outWeight: 0.59166664 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 12.519564 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.59166664 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 12.519564 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.5916667 + - serializedVersion: 3 + time: 0.225 + value: 1 + inSlope: -4.402922 + outSlope: -3.2624085 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.59166664 + outWeight: 0.3916667 + - serializedVersion: 3 + time: 0.525 + value: 1 + inSlope: -0.55036545 + outSlope: -0.40816337 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.8666667 + outWeight: 0.40833333 + - serializedVersion: 3 + time: 0.825 + value: 1 + inSlope: -0.06879558 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.8916666 + outWeight: 0.008331367 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.014328615 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 1 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.014331429 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 1 + - serializedVersion: 3 + time: 0.0875 + value: 0 + inSlope: 0 + outSlope: -0.06879253 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.0083314525 + outWeight: 0.89166665 + - serializedVersion: 3 + time: 0.2375 + value: 0 + inSlope: -0.40816325 + outSlope: -0.5503692 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.40833333 + outWeight: 0.8666668 + - serializedVersion: 3 + time: 0.3875 + value: 0 + inSlope: -3.2624185 + outSlope: -4.4028955 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.3916665 + outWeight: 0.59167117 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 12.519666 + outSlope: 12.519576 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.5916621 + outWeight: 0.5916664 + - serializedVersion: 3 + time: 0.6125 + value: 1 + inSlope: -4.402927 + outSlope: -3.2624016 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.5916669 + outWeight: 0.39166656 + - serializedVersion: 3 + time: 0.7625 + value: 1 + inSlope: -0.55036914 + outSlope: -0.40816268 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.8666668 + outWeight: 0.40833345 + - serializedVersion: 3 + time: 0.9125 + value: 1 + inSlope: -0.06879289 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.8916666 + outWeight: 0.008331029 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.0143282795 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 1 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + - m_Name: + m_Curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.5 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 0.5 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 diff --git a/Package/Editor/EasingFunctions.curves.meta b/Package/Editor/EasingFunctions.curves.meta new file mode 100644 index 0000000..a39b5aa --- /dev/null +++ b/Package/Editor/EasingFunctions.curves.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 1edf81d8f20c2ac41907add14f7c5ae4 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/FancyAnimationCurveDrawer.cs b/Package/Editor/FancyAnimationCurveDrawer.cs new file mode 100644 index 0000000..335e703 --- /dev/null +++ b/Package/Editor/FancyAnimationCurveDrawer.cs @@ -0,0 +1,56 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; +using AnimationUtility = TMPEffects.TMPAnimations.AnimationUtility; + +[CustomPropertyDrawer(typeof(AnimationUtility.FancyAnimationCurve))] +public class FancyAnimationCurveDrawer : PropertyDrawer +{ + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(position, label, property); + + var rect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); + + var width = EditorStyles.label.CalcSize(label); + var ctrlRect = EditorGUI.PrefixLabel(rect, GUIUtility.GetControlID(FocusType.Passive, rect), label); + var foldoutRect = new Rect(rect.x + width.x + 15, rect.y, 20, EditorGUIUtility.singleLineHeight); + + var curveProp = property.FindPropertyRelative("curve"); + + curveProp.isExpanded = EditorGUI.Foldout(foldoutRect, curveProp.isExpanded, new GUIContent("")); + + // TODO Strange ass workaround for offset created by EditorGUI.PrefixLabel + EditorGUI.indentLevel--; + EditorGUI.indentLevel--; + EditorGUI.PropertyField(ctrlRect, curveProp, new GUIContent("")); + EditorGUI.indentLevel++; + EditorGUI.indentLevel++; + + if (curveProp.isExpanded) + { + EditorGUI.indentLevel++; + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, property.FindPropertyRelative("offsetType")); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, property.FindPropertyRelative("wrapMode")); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, property.FindPropertyRelative("uniformity")); + EditorGUI.indentLevel--; + } + + EditorGUI.EndProperty(); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + var curveProp = property.FindPropertyRelative("curve"); + if (curveProp.isExpanded) + { + return EditorGUIUtility.singleLineHeight * 4; + } + + return EditorGUIUtility.singleLineHeight; + } +} \ No newline at end of file diff --git a/Package/Editor/FancyAnimationCurveDrawer.cs.meta b/Package/Editor/FancyAnimationCurveDrawer.cs.meta new file mode 100644 index 0000000..9a0de89 --- /dev/null +++ b/Package/Editor/FancyAnimationCurveDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1a28f8b74c2742643921dbf0b8b055e0 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/GenericAnimation.meta b/Package/Editor/GenericAnimation.meta new file mode 100644 index 0000000..387b607 --- /dev/null +++ b/Package/Editor/GenericAnimation.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bf6002ba682760544813e694b9519d43 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/GenericAnimation/AnimationStepDrawer.cs b/Package/Editor/GenericAnimation/AnimationStepDrawer.cs new file mode 100644 index 0000000..ed09857 --- /dev/null +++ b/Package/Editor/GenericAnimation/AnimationStepDrawer.cs @@ -0,0 +1,301 @@ +using TMPEffects.TMPAnimations; +using UnityEditor; +using UnityEngine; +using UnityEngine.Playables; + +[CustomPropertyDrawer(typeof(AnimationStep), false)] +public class AnimationStepDrawer : PropertyDrawer +{ + private bool entry = false; + + private SerializedProperty entryCurve; + private SerializedProperty exitCurve; + private SerializedProperty entryDuration; + private SerializedProperty exitDuration; + + private SerializedProperty loops; + private SerializedProperty repetitions; + private SerializedProperty startTime; + private SerializedProperty duration; + private SerializedProperty modifiers; + private SerializedProperty initModifiers; + private SerializedProperty useInitModifiers; + private SerializedProperty wave; + private SerializedProperty waveOffsetType; + private SerializedProperty useWave; + + private SerializedProperty preExtrapolation; + private SerializedProperty postExtrapolation; + + + private Color backgroundColor; + + protected void Init(SerializedProperty property) + { + entryCurve = property.FindPropertyRelative("entryCurve"); + exitCurve = property.FindPropertyRelative("exitCurve"); + entryDuration = property.FindPropertyRelative("entryDuration"); + exitDuration = property.FindPropertyRelative("exitDuration"); + loops = property.FindPropertyRelative("loops"); + repetitions = property.FindPropertyRelative("repetitions"); + startTime = property.FindPropertyRelative("startTime"); + duration = property.FindPropertyRelative("duration"); + modifiers = property.FindPropertyRelative("modifiers"); + initModifiers = property.FindPropertyRelative("initModifiers"); + useInitModifiers = property.FindPropertyRelative("useInitialModifiers"); + useWave = property.FindPropertyRelative("useWave"); + waveOffsetType = property.FindPropertyRelative("waveOffsetType"); + wave = property.FindPropertyRelative("wave"); + preExtrapolation = property.FindPropertyRelative("preExtrapolation"); + postExtrapolation = property.FindPropertyRelative("postExtrapolation"); + + backgroundColor = EditorGUIUtility.isProSkin + ? new Color32(56, 56, 56, 255) + : new Color32(194, 194, 194, 255); + } + + protected float GetCommonHeight(SerializedProperty property) + { + float height = EditorGUIUtility.singleLineHeight * 3; // Blending + in out headers + + if (entryCurve.isExpanded) + { + height += EditorGUIUtility.singleLineHeight + EditorGUI.GetPropertyHeight(entryCurve); + } + + if (exitCurve.isExpanded) + { + height += EditorGUIUtility.singleLineHeight + EditorGUI.GetPropertyHeight(exitCurve); + } + + height += EditorGUIUtility.singleLineHeight * 3; // Space + waves + + if (useWave.boolValue) height += EditorGUI.GetPropertyHeight(wave, true) + EditorGUIUtility.singleLineHeight; + + height += EditorGUIUtility.singleLineHeight * 2; // Space + initial + + if (useInitModifiers.boolValue) height += EditorGUI.GetPropertyHeight(initModifiers, true); + + height += EditorGUIUtility.singleLineHeight * 2; // Space + modifiers + + height += EditorGUI.GetPropertyHeight(modifiers, true); + + return height; + } + + protected void DrawCommon(Rect rect, SerializedProperty property, GUIContent label) + { + EditorGUI.LabelField(rect, "Blending", EditorStyles.boldLabel); + rect.y += EditorGUIUtility.singleLineHeight; + + entryCurve.isExpanded = EditorGUI.Foldout(rect, entryCurve.isExpanded, "Entry"); + rect.y += EditorGUIUtility.singleLineHeight; + + if (entryCurve.isExpanded) + { + EditorGUI.indentLevel++; + var bgRect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight +EditorGUI.GetPropertyHeight(entryCurve)); + EditorGUI.DrawRect(bgRect, backgroundColor); + + EditorGUI.BeginChangeCheck(); + EditorGUI.PropertyField(rect, entryDuration); + if (EditorGUI.EndChangeCheck()) + { + if (property.FindPropertyRelative("lastMovedEntry") != null) + property.FindPropertyRelative("lastMovedEntry").intValue = 0; + } + + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, entryCurve); + rect.y += EditorGUI.GetPropertyHeight(entryCurve); + EditorGUI.indentLevel--; + } + + exitCurve.isExpanded = EditorGUI.Foldout(rect, exitCurve.isExpanded, "Exit"); + rect.y += EditorGUIUtility.singleLineHeight; + + if (exitCurve.isExpanded) + { + EditorGUI.indentLevel++; + var bgRect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight + EditorGUI.GetPropertyHeight(exitCurve)); + EditorGUI.DrawRect(bgRect, backgroundColor); + + EditorGUI.BeginChangeCheck(); + EditorGUI.PropertyField(rect, exitDuration); + if (EditorGUI.EndChangeCheck()) + { + if (property.FindPropertyRelative("lastMovedEntry") != null) + property.FindPropertyRelative("lastMovedEntry").intValue = 1; + } + + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, exitCurve); + rect.y += EditorGUI.GetPropertyHeight(exitCurve); + EditorGUI.indentLevel--; + } + + rect.y += EditorGUIUtility.singleLineHeight; + + GUIContent content = new GUIContent(); + content.text = "Wave"; + content.tooltip = + "Whether to use a wave."; + + Vector2 labelSize = EditorStyles.boldLabel.CalcSize(content); + EditorGUI.BeginDisabledGroup(!useWave.boolValue); + EditorGUI.LabelField(rect, content, EditorStyles.boldLabel); + EditorGUI.EndDisabledGroup(); + var toggleRect = new Rect(rect.x + labelSize.x + 10, rect.y, rect.width - labelSize.x - 10, rect.height); + useWave.boolValue = EditorGUI.Toggle(toggleRect, useWave.boolValue); + rect.y += EditorGUIUtility.singleLineHeight; + + if (useWave.boolValue) + { + EditorGUI.PropertyField(rect, waveOffsetType); + rect.y += EditorGUIUtility.singleLineHeight; + + if (wave.isExpanded) + { + var bgRect = new Rect(rect.x, rect.y + EditorGUIUtility.singleLineHeight, rect.width, + EditorGUI.GetPropertyHeight(wave, true) - EditorGUIUtility.singleLineHeight); + EditorGUI.DrawRect(bgRect, backgroundColor); + } + + // EditorGUI.indentLevel++; + EditorGUI.PropertyField(rect, wave, true); + rect.y += EditorGUI.GetPropertyHeight(wave, true); + // EditorGUI.indentLevel--; + } + + rect.y += EditorGUIUtility.singleLineHeight; + + + content = new GUIContent(); + content.text = "Initial Modifiers"; + content.tooltip = + "Whether to use initial modifiers. If so, the lerp will be between InitialModifiers and Modifiers. Otherwise, the lerp will be between the CharData and Modifiers."; + + labelSize = EditorStyles.boldLabel.CalcSize(content); + EditorGUI.BeginDisabledGroup(!useInitModifiers.boolValue); + EditorGUI.LabelField(rect, content, EditorStyles.boldLabel); + EditorGUI.EndDisabledGroup(); + toggleRect = new Rect(rect.x + labelSize.x + 10, rect.y, rect.width - labelSize.x - 10, rect.height); + useInitModifiers.boolValue = EditorGUI.Toggle(toggleRect, useInitModifiers.boolValue); + + rect.y += EditorGUIUtility.singleLineHeight; + if (useInitModifiers.boolValue) + { + EditorGUI.PropertyField(rect, initModifiers, true); + rect.y += EditorGUI.GetPropertyHeight(initModifiers, true); + } + + rect.y += EditorGUIUtility.singleLineHeight; + + EditorGUI.LabelField(rect, "Modifier", EditorStyles.boldLabel); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, modifiers, true); + rect.y += EditorGUI.GetPropertyHeight(modifiers, true); + } + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + if (property.managedReferenceValue == null) + { + Debug.LogWarning("Had to init"); + property.managedReferenceValue = new AnimationStep(); + } + + Init(property); + EditorGUI.BeginProperty(position, label, property); + EditorGUI.indentLevel++; + + var rect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); + property.isExpanded = EditorGUI.Foldout(rect, property.isExpanded, label); + rect.y += EditorGUIUtility.singleLineHeight; + if (!property.isExpanded) + { + EditorGUI.EndProperty(); + EditorGUI.indentLevel--; + return; + } + + EditorGUI.PropertyField(rect, property.FindPropertyRelative("name")); + rect.y += EditorGUIUtility.singleLineHeight * 2f; + + EditorGUI.PropertyField(rect, loops); + rect.y += EditorGUIUtility.singleLineHeight; + + if (loops.boolValue) + { + EditorGUI.PropertyField(rect, repetitions, new GUIContent("Repetitions (0 = forever)")); + rect.y += EditorGUIUtility.singleLineHeight; + } + + EditorGUI.PropertyField(rect, preExtrapolation); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, postExtrapolation); + rect.y += EditorGUIUtility.singleLineHeight * 2; + + DrawCommon(rect, property, label); + + EditorGUI.indentLevel--; + EditorGUI.EndProperty(); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + if (property.managedReferenceValue == null) + { + Debug.LogWarning("Had to init"); + property.managedReferenceValue = new AnimationStep(); + } + + Init(property); + + if (property.isExpanded) + return GetCommonHeight(property) + EditorGUIUtility.singleLineHeight * 6; + + return EditorGUIUtility.singleLineHeight; + + float totalHeight = EditorGUIUtility.singleLineHeight; // foldout + if (!property.isExpanded) return totalHeight; + + totalHeight += EditorGUIUtility.singleLineHeight * 2f; // For the "name" property + + if (property.serializedObject.targetObject is not PlayableAsset) + { + totalHeight += EditorGUIUtility.singleLineHeight * 2f; // startTime, duration + } + + totalHeight += EditorGUIUtility.singleLineHeight; // entry foldout + if (entryCurve.isExpanded) + { + totalHeight += EditorGUIUtility.singleLineHeight * 2f; // entryDuration and entryCurve + } + + totalHeight += EditorGUIUtility.singleLineHeight; // exit foldout + if (exitCurve.isExpanded) + { + totalHeight += EditorGUIUtility.singleLineHeight * 2f; // exitDuration and exitCurve + } + + totalHeight += EditorGUIUtility.singleLineHeight * 2; // loops and useWave + + if (loops.boolValue) + { + totalHeight += EditorGUIUtility.singleLineHeight; // repetitions + } + + if (useWave.boolValue) + { + totalHeight += EditorGUIUtility.singleLineHeight; + totalHeight += EditorGUI.GetPropertyHeight(wave, true); + } + + // totalHeight += EditorGUI.GetPropertyHeight(modifiers, true); + + totalHeight += EditorGUI.GetPropertyHeight(modifiers, true); + + return totalHeight; + } +} \ No newline at end of file diff --git a/Package/Editor/GenericAnimation/AnimationStepDrawer.cs.meta b/Package/Editor/GenericAnimation/AnimationStepDrawer.cs.meta new file mode 100644 index 0000000..1efbfc1 --- /dev/null +++ b/Package/Editor/GenericAnimation/AnimationStepDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 360e593aabdf867408e496d7397fae11 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/GenericAnimation/CharDataModifierDrawer.cs b/Package/Editor/GenericAnimation/CharDataModifierDrawer.cs new file mode 100644 index 0000000..6e62051 --- /dev/null +++ b/Package/Editor/GenericAnimation/CharDataModifierDrawer.cs @@ -0,0 +1,447 @@ +using System.Collections; +using System.Collections.Generic; +using System.Numerics; +using TMPEffects.CharacterData; +using UnityEditor; +using UnityEngine; +using UnityEngine.TextCore.Text; +using Matrix4x4 = UnityEngine.Matrix4x4; +using Quaternion = UnityEngine.Quaternion; +using Vector3 = UnityEngine.Vector3; +using Vector4 = UnityEngine.Vector4; + +[CustomPropertyDrawer(typeof(CharDataModifiers))] +public class CharDataModifierDrawer : PropertyDrawer +{ + private Color32 backgroundColor; + + private SerializedProperty positionDeltaProp; + private SerializedProperty scaleDeltaProp; + private SerializedProperty rotationsProp; + private SerializedProperty meshModifierProp; + private SerializedProperty characterModifierProp; + private SerializedProperty blDeltaProp, tlDeltaProp, trDeltaProp, brDeltaProp; + private SerializedProperty blColorProp, tlColorProp, trColorProp, brColorProp; + private SerializedProperty blUV0Prop, tlUV0Prop, trUV0Prop, brUV0Prop; + private SerializedProperty meshModifierDirtyProp; + private SerializedProperty characterMeshModifierDirtyProp; + + private const float TypedVectorFoldoutWidth = 20f; + + private void Init(SerializedProperty property) + { + characterModifierProp = property.FindPropertyRelative("characterModifiers"); + + positionDeltaProp = characterModifierProp.FindPropertyRelative("positionDelta"); + scaleDeltaProp = characterModifierProp.FindPropertyRelative("scaleDelta"); + rotationsProp = characterModifierProp.FindPropertyRelative("rotations"); + characterMeshModifierDirtyProp = characterModifierProp.FindPropertyRelative("modifier"); + + meshModifierProp = property.FindPropertyRelative("meshModifiers"); + + blDeltaProp = meshModifierProp.FindPropertyRelative("bl_Delta"); + tlDeltaProp = meshModifierProp.FindPropertyRelative("tl_Delta"); + trDeltaProp = meshModifierProp.FindPropertyRelative("tr_Delta"); + brDeltaProp = meshModifierProp.FindPropertyRelative("br_Delta"); + + blColorProp = meshModifierProp.FindPropertyRelative("bl_Color"); + tlColorProp = meshModifierProp.FindPropertyRelative("tl_Color"); + trColorProp = meshModifierProp.FindPropertyRelative("tr_Color"); + brColorProp = meshModifierProp.FindPropertyRelative("br_Color"); + + blUV0Prop = meshModifierProp.FindPropertyRelative("bl_UV0"); + tlUV0Prop = meshModifierProp.FindPropertyRelative("tl_UV0"); + trUV0Prop = meshModifierProp.FindPropertyRelative("tr_UV0"); + brUV0Prop = meshModifierProp.FindPropertyRelative("br_UV0"); + + meshModifierDirtyProp = meshModifierProp.FindPropertyRelative("modifier"); + + backgroundColor = EditorGUIUtility.isProSkin + ? new Color32(56, 56, 56, 255) + : new Color32(194, 194, 194, 255); + } + + private void DrawRawToggle(float y, SerializedProperty rawProp, Rect toggleRect, Rect labelRect) + { + toggleRect.y = y; + labelRect.y = y; + EditorGUI.LabelField(labelRect, "Scaled"); + rawProp.boolValue = + EditorGUI.Toggle(toggleRect, rawProp.boolValue); + } + + private Matrix4x4 GetMatrix() + { + Matrix4x4 matrix = new Matrix4x4(); + matrix.m00 = scaleDeltaProp.FindPropertyRelative("e00").floatValue; + matrix.m01 = scaleDeltaProp.FindPropertyRelative("e01").floatValue; + matrix.m02 = scaleDeltaProp.FindPropertyRelative("e02").floatValue; + matrix.m03 = scaleDeltaProp.FindPropertyRelative("e03").floatValue; + matrix.m10 = scaleDeltaProp.FindPropertyRelative("e10").floatValue; + matrix.m11 = scaleDeltaProp.FindPropertyRelative("e11").floatValue; + matrix.m12 = scaleDeltaProp.FindPropertyRelative("e12").floatValue; + matrix.m13 = scaleDeltaProp.FindPropertyRelative("e13").floatValue; + matrix.m20 = scaleDeltaProp.FindPropertyRelative("e20").floatValue; + matrix.m21 = scaleDeltaProp.FindPropertyRelative("e21").floatValue; + matrix.m22 = scaleDeltaProp.FindPropertyRelative("e22").floatValue; + matrix.m23 = scaleDeltaProp.FindPropertyRelative("e23").floatValue; + matrix.m30 = scaleDeltaProp.FindPropertyRelative("e30").floatValue; + matrix.m31 = scaleDeltaProp.FindPropertyRelative("e31").floatValue; + matrix.m32 = scaleDeltaProp.FindPropertyRelative("e32").floatValue; + matrix.m33 = scaleDeltaProp.FindPropertyRelative("e33").floatValue; + return matrix; + } + + public static Vector3 ExtractScale(Matrix4x4 matrix) + { + Vector3 scale; + scale.x = new Vector4(matrix.m00, matrix.m10, matrix.m20, matrix.m30).magnitude; + scale.y = new Vector4(matrix.m01, matrix.m11, matrix.m21, matrix.m31).magnitude; + scale.z = new Vector4(matrix.m02, matrix.m12, matrix.m22, matrix.m32).magnitude; + return scale; + } + + private void ApplyBackToMatrix(Vector3 scale) + { + Debug.Log("Scale " + scale); + // matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, scale); + var matrix = Matrix4x4.Scale(scale); + Debug.Log("mat scale " + matrix.lossyScale); + scaleDeltaProp.FindPropertyRelative("e00").floatValue = matrix.m00; + // scaleDeltaProp.FindPropertyRelative("e01").floatValue = matrix.m01; + // scaleDeltaProp.FindPropertyRelative("e02").floatValue = matrix.m02; + // scaleDeltaProp.FindPropertyRelative("e03").floatValue = matrix.m03; + // scaleDeltaProp.FindPropertyRelative("e10").floatValue = matrix.m10; + scaleDeltaProp.FindPropertyRelative("e11").floatValue = matrix.m11; + // scaleDeltaProp.FindPropertyRelative("e12").floatValue = matrix.m12; + // scaleDeltaProp.FindPropertyRelative("e13").floatValue = matrix.m13; + // scaleDeltaProp.FindPropertyRelative("e20").floatValue = matrix.m20; + // scaleDeltaProp.FindPropertyRelative("e21").floatValue = matrix.m21; + scaleDeltaProp.FindPropertyRelative("e22").floatValue = matrix.m22; + // scaleDeltaProp.FindPropertyRelative("e23").floatValue = matrix.m23; + // scaleDeltaProp.FindPropertyRelative("e30").floatValue = matrix.m30; + // scaleDeltaProp.FindPropertyRelative("e31").floatValue = matrix.m31; + // scaleDeltaProp.FindPropertyRelative("e32").floatValue = matrix.m32; + // scaleDeltaProp.FindPropertyRelative("e33").floatValue = matrix.m33; + + for (int i = 0; i < 16; i++) + if (matrix[i] < 0) + Debug.LogWarning(i + " negative!! " + matrix[i]); + + var newmat = GetMatrix(); + Debug.Log("3rd mat scale " + newmat.lossyScale); + } + + private Rect DrawCharacterModifier(Rect rect) + { + var bgRect = new Rect(rect.x, rect.y, rect.width, + EditorGUIUtility.singleLineHeight * 2 + EditorGUI.GetPropertyHeight(rotationsProp, true)); + EditorGUI.DrawRect(bgRect, backgroundColor); + + EditorGUI.BeginChangeCheck(); + EditorGUI.PropertyField(rect, positionDeltaProp); + rect.y += EditorGUIUtility.singleLineHeight; + if (EditorGUI.EndChangeCheck()) + { + // If is 0 (= default), but bit is set as dirty, fix + if (positionDeltaProp.vector3Value == Vector3.zero) + { + if ((characterMeshModifierDirtyProp.enumValueFlag & + (int)TMPCharacterModifiers.ModifierFlags.PositionDelta) != 0) + { + characterMeshModifierDirtyProp.enumValueFlag &= + ~(int)TMPCharacterModifiers.ModifierFlags.PositionDelta; + } + } + // If is not 0 (!= default), but bit is not set as dirty, fix + else + { + if ((characterMeshModifierDirtyProp.enumValueFlag & + (int)TMPCharacterModifiers.ModifierFlags.PositionDelta) == 0) + { + characterMeshModifierDirtyProp.enumValueFlag |= + (int)TMPCharacterModifiers.ModifierFlags.PositionDelta; + } + } + } + + EditorGUI.BeginChangeCheck(); + rect.height = EditorGUI.GetPropertyHeight(rotationsProp, true); + EditorGUI.PropertyField(rect, rotationsProp, true); + rect.y += rect.height; + rect.height = EditorGUIUtility.singleLineHeight; + if (EditorGUI.EndChangeCheck()) + { + // If is 0 (= default), but bit is set as dirty, fix + if (rotationsProp.arraySize == 0) + { + if ((characterMeshModifierDirtyProp.enumValueFlag & + (int)TMPCharacterModifiers.ModifierFlags.Rotations) != 0) + { + characterMeshModifierDirtyProp.enumValueFlag &= + ~(int)TMPCharacterModifiers.ModifierFlags.Rotations; + } + } + // If is not 0 (!= default), but bit is not set as dirty, fix + else + { + if ((characterMeshModifierDirtyProp.enumValueFlag & + (int)TMPCharacterModifiers.ModifierFlags.Rotations) == 0) + { + characterMeshModifierDirtyProp.enumValueFlag |= + (int)TMPCharacterModifiers.ModifierFlags.Rotations; + } + } + } + + EditorGUI.BeginChangeCheck(); + Matrix4x4 mat = GetMatrix(); + for (int i = 0; i < 16; i++) + if (mat[i] < 0) + Debug.LogWarning(i + " MATT!!! negative!! " + mat[i]); + var lossyScale = ExtractScale(mat); + + var newScale = EditorGUI.Vector3Field(rect, "Scale", lossyScale); + if (newScale != lossyScale) + { + ApplyBackToMatrix(newScale); + } + + if (EditorGUI.EndChangeCheck()) + { + // If is V3.one (= default), but bit is set as dirty, fix + if (newScale == Vector3.one) + { + if ((characterMeshModifierDirtyProp.enumValueFlag & + (int)TMPCharacterModifiers.ModifierFlags.Scale) != 0) + { + characterMeshModifierDirtyProp.enumValueFlag &= + ~(int)TMPCharacterModifiers.ModifierFlags.Scale; + } + } + // If is not V3.one (!= default), but bit is not set as dirty, fix + else + { + if ((characterMeshModifierDirtyProp.enumValueFlag & + (int)TMPCharacterModifiers.ModifierFlags.Scale) == 0) + { + characterMeshModifierDirtyProp.enumValueFlag |= + (int)TMPCharacterModifiers.ModifierFlags.Scale; + } + } + } + + rect.y += EditorGUIUtility.singleLineHeight; + return rect; + } + + private Rect DrawMeshDeltaModifier(Rect rect) + { + var bgRect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight * 4); + EditorGUI.DrawRect(bgRect, backgroundColor); + + EditorGUI.BeginChangeCheck(); + EditorGUI.PropertyField(rect, blDeltaProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, tlDeltaProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, trDeltaProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, brDeltaProp); + rect.y += EditorGUIUtility.singleLineHeight; + if (EditorGUI.EndChangeCheck()) + { + // If is not 0 (!= default), but bit is not set as dirty, fix + if (blDeltaProp.vector3Value != Vector3.zero || tlDeltaProp.vector3Value != Vector3.zero || + trDeltaProp.vector3Value != Vector3.zero || brDeltaProp.vector3Value != Vector3.zero) + { + if ((meshModifierDirtyProp.enumValueFlag & + (int)TMPMeshModifiers.ModifierFlags.Deltas) == 0) + { + meshModifierDirtyProp.enumValueFlag |= + (int)TMPMeshModifiers.ModifierFlags.Deltas; + } + } + // If is 0 (= default), but bit is set as dirty, fix + else + { + if ((meshModifierDirtyProp.enumValueFlag & + (int)TMPMeshModifiers.ModifierFlags.Deltas) != 0) + { + meshModifierDirtyProp.enumValueFlag &= + ~(int)TMPMeshModifiers.ModifierFlags.Deltas; + } + } + } + + return rect; + } + + private Rect DrawMeshColorModifier(Rect rect) + { + var bgRect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight * 4); + EditorGUI.DrawRect(bgRect, backgroundColor); + + EditorGUI.BeginChangeCheck(); + EditorGUI.PropertyField(rect, blColorProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, tlColorProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, trColorProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, brColorProp); + rect.y += EditorGUIUtility.singleLineHeight; + + if (EditorGUI.EndChangeCheck()) + { + // If is not 0 (!= default), but bit is not set as dirty, fix + if (blColorProp.FindPropertyRelative("Override").enumValueFlag != 0 || + tlColorProp.FindPropertyRelative("Override").enumValueFlag != 0 || + trColorProp.FindPropertyRelative("Override").enumValueFlag != 0 || + brColorProp.FindPropertyRelative("Override").enumValueFlag != 0) + { + if ((meshModifierDirtyProp.enumValueFlag & + (int)TMPMeshModifiers.ModifierFlags.Colors) == 0) + { + meshModifierDirtyProp.enumValueFlag |= + (int)TMPMeshModifiers.ModifierFlags.Colors; + } + } + // If is 0 (= default), but bit is set as dirty, fix + else + { + if ((meshModifierDirtyProp.enumValueFlag & + (int)TMPMeshModifiers.ModifierFlags.Colors) != 0) + { + meshModifierDirtyProp.enumValueFlag &= + ~(int)TMPMeshModifiers.ModifierFlags.Colors; + } + } + } + + return rect; + } + + private Rect DrawMeshUVModifier(Rect rect) + { + var bgRect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight * 4); + EditorGUI.DrawRect(bgRect, backgroundColor); + + EditorGUI.PropertyField(rect, blUV0Prop); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, tlUV0Prop); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, trUV0Prop); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, brUV0Prop); + rect.y += EditorGUIUtility.singleLineHeight; + + if (EditorGUI.EndChangeCheck()) + { + // If is not 0 (!= default), but bit is not set as dirty, fix + if (blUV0Prop.FindPropertyRelative("_override").enumValueFlag != 0 || + tlUV0Prop.FindPropertyRelative("_override").enumValueFlag != 0 || + trUV0Prop.FindPropertyRelative("_override").enumValueFlag != 0 || + brUV0Prop.FindPropertyRelative("_override").enumValueFlag != 0) + { + if ((meshModifierDirtyProp.enumValueFlag & + (int)TMPMeshModifiers.ModifierFlags.UVs) == 0) + { + meshModifierDirtyProp.enumValueFlag |= + (int)TMPMeshModifiers.ModifierFlags.UVs; + } + } + // If is 0 (= default), but bit is set as dirty, fix + else + { + if ((meshModifierDirtyProp.enumValueFlag & + (int)TMPMeshModifiers.ModifierFlags.UVs) != 0) + { + meshModifierDirtyProp.enumValueFlag &= + ~(int)TMPMeshModifiers.ModifierFlags.UVs; + } + } + } + + return rect; + } + + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + Init(property); + + var rect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); + + property.isExpanded = EditorGUI.Foldout(rect, property.isExpanded, property.displayName); + EditorGUI.indentLevel++; + + if (!property.isExpanded) return; + + rect.y += EditorGUIUtility.singleLineHeight; + positionDeltaProp.isExpanded = + EditorGUI.Foldout(rect, positionDeltaProp.isExpanded, "Character Deltas"); + rect.y += EditorGUIUtility.singleLineHeight; + + var ctrlRect = EditorGUILayout.GetControlRect(false, EditorGUIUtility.singleLineHeight); + var togglerect = new Rect(ctrlRect.x + EditorGUIUtility.labelWidth - 20, rect.y, ctrlRect.width, + EditorGUIUtility.singleLineHeight); + var labelRect = new Rect(togglerect.x - 45, togglerect.y, togglerect.width, EditorGUIUtility.singleLineHeight); + + if (positionDeltaProp.isExpanded) + rect = DrawCharacterModifier(rect); + + blDeltaProp.isExpanded = + EditorGUI.Foldout(rect, blDeltaProp.isExpanded, "Vertex Deltas"); + rect.y += EditorGUIUtility.singleLineHeight; + + if (blDeltaProp.isExpanded) + rect = DrawMeshDeltaModifier(rect); + + blColorProp.isExpanded = + EditorGUI.Foldout(rect, blColorProp.isExpanded, "Vertex Colors"); + rect.y += EditorGUIUtility.singleLineHeight; + + if (blColorProp.isExpanded) + rect = DrawMeshColorModifier(rect); + + blUV0Prop.isExpanded = + EditorGUI.Foldout(rect, blUV0Prop.isExpanded, "Vertex UVs"); + rect.y += EditorGUIUtility.singleLineHeight; + + if (blUV0Prop.isExpanded) + rect = DrawMeshUVModifier(rect); + + EditorGUI.indentLevel--; + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + Init(property); + float height = EditorGUIUtility.singleLineHeight; + + if (!property.isExpanded) return height; + + height += EditorGUIUtility.singleLineHeight; + + if (positionDeltaProp.isExpanded) + height += EditorGUIUtility.singleLineHeight * 2 + EditorGUI.GetPropertyHeight(rotationsProp, true); + + height += EditorGUIUtility.singleLineHeight; + + if (blDeltaProp.isExpanded) + height += EditorGUIUtility.singleLineHeight * 4; + + height += EditorGUIUtility.singleLineHeight; + + if (blColorProp.isExpanded) + height += EditorGUIUtility.singleLineHeight * 4; + + height += EditorGUIUtility.singleLineHeight; + + if (blUV0Prop.isExpanded) + height += EditorGUIUtility.singleLineHeight * 4; + + return height; + } +} \ No newline at end of file diff --git a/Package/Editor/GenericAnimation/CharDataModifierDrawer.cs.meta b/Package/Editor/GenericAnimation/CharDataModifierDrawer.cs.meta new file mode 100644 index 0000000..44af401 --- /dev/null +++ b/Package/Editor/GenericAnimation/CharDataModifierDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b6fd2d0da26adb1479c60b3bab0e960b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/GenericAnimation/ClipListDrawer.cs b/Package/Editor/GenericAnimation/ClipListDrawer.cs new file mode 100644 index 0000000..52f9685 --- /dev/null +++ b/Package/Editor/GenericAnimation/ClipListDrawer.cs @@ -0,0 +1,188 @@ +// using System.Collections; +// using System.Collections.Generic; +// using System.Linq; +// using TMPEffects.TMPAnimations; +// using UnityEditor; +// using UnityEditorInternal; +// using UnityEngine; +// +// [CustomPropertyDrawer(typeof(GenericAnimation.TrackList))] +// public class TrackListDrawer : PropertyDrawer +// { +// private ReorderableList reList; +// +// private void EnsureList(SerializedProperty property) +// { +// var list = new ReorderableList(property.serializedObject, property.FindPropertyRelative("Clips"), true, false, true, true); +// list.onAddCallback = (rList) => +// AddCallback(property, rList); +// +// reList = list; +// } +// +// public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) +// { +// EnsureList(property); +// reList.DoList(position); +// } +// +// private void AddCallback(SerializedProperty property, ReorderableList rList) +// { +// Debug.LogWarning("ADD"); +// var tracksProp = property.FindPropertyRelative("Tracks"); +// tracksProp.arraySize++; +// tracksProp.GetArrayElementAtIndex(tracksProp.arraySize - 1).FindPropertyRelative("Clips").ClearArray(); +// } +// +// public override float GetPropertyHeight(SerializedProperty property, GUIContent label) +// { +// EnsureList(property); +// return reList.GetHeight(); +// } +// } +// +// +// [CustomPropertyDrawer(typeof(GenericAnimation.Track))] +// public class TrackDrawer : PropertyDrawer +// { +// private ReorderableList reList; +// +// private void EnsureList(SerializedProperty property) +// { +// var list = ReorderableList.GetReorderableListFromSerializedProperty(property.FindPropertyRelative("Clips")); +// // var list = new ReorderableList(property.serializedObject, property.FindPropertyRelative("Clips"), true, false, true, true); +// list.drawElementCallback = (rect, index, isActive, isFocused) => +// DrawElementCallback(property, rect, index, isActive, isFocused); +// list.onAddCallback = (rList) => +// AddCallback(property, rList); +// list.elementHeightCallback = (index) => +// ElementHeightCallback(property, index); +// +// reList = list; +// } +// +// private float ElementHeightCallback(SerializedProperty prop, int index) +// { +// return EditorGUI.GetPropertyHeight(prop.FindPropertyRelative("Clips").GetArrayElementAtIndex(index)); +// } +// +// public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) +// { +// EditorGUI.PropertyField(position, property.FindPropertyRelative("Clips")); +// EnsureList(property); +// } +// +// private void DrawElementCallback(SerializedProperty prop, Rect rect, int index, bool isactive, bool isfocused) +// { +// var itemProp = prop.FindPropertyRelative("Clips").GetArrayElementAtIndex(index); +// var nameProp = itemProp.FindPropertyRelative("name"); +// var animateProp = itemProp.FindPropertyRelative("animate"); +// +// var toggleRect = new Rect(rect.x + 20, rect.y, 15f, EditorGUIUtility.singleLineHeight); +// animateProp.boolValue = EditorGUI.ToggleLeft(toggleRect, GUIContent.none, animateProp.boolValue); +// toggleRect.x += 17.5f; +// toggleRect.width = rect.width - 17.5f; +// EditorGUI.LabelField(toggleRect, +// string.IsNullOrWhiteSpace(nameProp.stringValue) ? "Element " + index : nameProp.stringValue); +// +// float fromWidth = 75; +// float gap = 10; +// var fromRect = new Rect(rect.x + rect.width - fromWidth * 2 - gap * 1.5f, rect.y, fromWidth, +// EditorGUIUtility.singleLineHeight); +// var toRect = new Rect(rect.x + rect.width - fromWidth - gap, rect.y, fromWidth, +// EditorGUIUtility.singleLineHeight); +// +// var startTimeProp = itemProp.FindPropertyRelative("startTime"); +// var durationProp = itemProp.FindPropertyRelative("duration"); +// +// EditorGUIUtility.labelWidth = 30; +// float newTime = Mathf.Max(0, EditorGUI.FloatField(fromRect, new GUIContent("from:"), startTimeProp.floatValue)); +// EditorGUIUtility.labelWidth = 15; +// float newEndTime = Mathf.Max(newTime, EditorGUI.FloatField(toRect, new GUIContent("to:"), +// startTimeProp.floatValue + durationProp.floatValue)); +// +// if (newEndTime < newTime) newEndTime = newTime; +// +// if (newTime != startTimeProp.floatValue) +// { +// startTimeProp.floatValue = newTime; +// OnChangedStartOrDuration(prop, index); +// } +// else if (newEndTime != startTimeProp.floatValue + durationProp.floatValue) +// { +// durationProp.floatValue = newEndTime - startTimeProp.floatValue; +// OnChangedStartOrDuration(prop, index); +// } +// +// EditorGUIUtility.labelWidth = 0; +// EditorGUI.PropertyField(rect, itemProp, GUIContent.none); +// } +// +// private void AddCallback(SerializedProperty prop, ReorderableList list) +// { +// var animStepsProp = prop.FindPropertyRelative("Clips"); +// animStepsProp.arraySize++; +// var newElement = animStepsProp.GetArrayElementAtIndex(animStepsProp.arraySize - 1); +// newElement.managedReferenceValue = new AnimationStep(); +// } +// +// public override float GetPropertyHeight(SerializedProperty property, GUIContent label) +// { +// return EditorGUI.GetPropertyHeight(property.FindPropertyRelative("Clips")); +// // EnsureList(property); +// // return reList.GetHeight(); +// } +// +// // Update all other durations when one was changed in the inspector +// // ChangedIndex: the index that was changed, +// // ignoreIndex: further indices that should remain unchanged +// private void OnChangedStartOrDuration(SerializedProperty prop, int changedIndex, params int[] ignoreIndex) +// { +// var steps = prop.FindPropertyRelative("Clips"); +// var changedProp = steps.GetArrayElementAtIndex(changedIndex); +// float changedStartTime = changedProp.FindPropertyRelative("startTime").floatValue; +// float changedDuration = changedProp.FindPropertyRelative("duration").floatValue; +// float changedEndTime = changedStartTime + changedDuration; +// +// // Update all start times and durations to accomodate for changed time +// for (int i = 0; i < steps.arraySize; i++) +// { +// if (i == changedIndex || ignoreIndex.Contains(i)) continue; +// +// var step = steps.GetArrayElementAtIndex(i); +// +// float startTime = step.FindPropertyRelative("startTime").floatValue; +// if (startTime > changedEndTime) continue; // If starts after changed ends, cont +// +// float duration = step.FindPropertyRelative("duration").floatValue; +// float endTime = startTime + duration; +// if (endTime < changedStartTime) continue; // If ends before changed starts, cont +// // else, effected +// +// // if starts while changed already running +// if (startTime >= changedStartTime) +// { +// // if ends after changed, clamp starttime +// if (endTime >= changedEndTime) +// { +// step.FindPropertyRelative("startTime").floatValue = changedEndTime; +// OnChangedStartOrDuration(prop, i, ignoreIndex.Concat(new int[] { changedIndex }).ToArray()); +// } +// // else meaning fully within the changed step +// else +// { +// step.FindPropertyRelative("startTime").floatValue = changedStartTime; +// step.FindPropertyRelative("duration").floatValue = 0f; +// OnChangedStartOrDuration(prop, i, ignoreIndex.Concat(new int[] { changedIndex }).ToArray()); +// } +// } +// +// // if changed starts while this is already running, clamp the duration +// else if (changedStartTime >= startTime) +// { +// step.FindPropertyRelative("duration").floatValue = changedStartTime - startTime; +// OnChangedStartOrDuration(prop, i, ignoreIndex.Concat(new int[] { changedIndex }).ToArray()); +// } +// } +// } +// } \ No newline at end of file diff --git a/Package/Editor/GenericAnimation/ClipListDrawer.cs.meta b/Package/Editor/GenericAnimation/ClipListDrawer.cs.meta new file mode 100644 index 0000000..8af7e8a --- /dev/null +++ b/Package/Editor/GenericAnimation/ClipListDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5c9e6c53f3b9dd34ca82cd811ba03637 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/GenericAnimation/ColorOverrideDrawer.cs b/Package/Editor/GenericAnimation/ColorOverrideDrawer.cs new file mode 100644 index 0000000..1101ad1 --- /dev/null +++ b/Package/Editor/GenericAnimation/ColorOverrideDrawer.cs @@ -0,0 +1,91 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using UnityEditor; +using UnityEngine; + +[CustomPropertyDrawer(typeof(ColorOverride))] +public class ColorOverrideDrawer : PropertyDrawer +{ + private SerializedProperty flagProp; + private SerializedProperty colorProp; + + private void Init(SerializedProperty property) + { + flagProp = property.FindPropertyRelative("Override"); + colorProp = property.FindPropertyRelative("Color"); + } + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + Init(property); + + position = EditorGUI.PrefixLabel(position, label); + + var flags = (ColorOverride.OverrideMode)flagProp.enumValueFlag; + if (flags.HasFlag(ColorOverride.OverrideMode.Color)) + { + colorProp.colorValue = + EditorGUI.ColorField(position, GUIContent.none, colorProp.colorValue, true, + flags.HasFlag(ColorOverride.OverrideMode.Alpha), false); + } + else if (flags.HasFlag(ColorOverride.OverrideMode.Alpha)) + { + float alpha = EditorGUI.Slider(position, colorProp.colorValue.a, 0f, 1f); + + if (colorProp.colorValue.a != alpha) + { + colorProp.colorValue = new Color32((byte)colorProp.colorValue.r, (byte)colorProp.colorValue.g, (byte)colorProp.colorValue.b, (byte) + (alpha * 255)); + } + } + + position.x -= 100; + position.width = 100; + + flagProp.enumValueFlag = (int)(ColorOverride.OverrideMode) + EditorGUI.EnumFlagsField(position, GUIContent.none,(ColorOverride.OverrideMode)flagProp.enumValueFlag); + } + + // public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + // { + // EditorGUI.BeginProperty(position, label, property); + // Init(property); + // + // + // position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); + // var rect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); + // + // var flagsRect = new Rect(rect.x - 75, rect.y, 100, rect.height); + // var flags = (ColorOverride.OverrideMode)EditorGUI.EnumFlagsField(flagsRect, + // (ColorOverride.OverrideMode)flagProp.enumValueFlag); + // flagProp.enumValueFlag = (int)flags; + // + // + // var colorRect = new Rect(rect.x, rect.y, rect.width, rect.height); + // + // if (flags.HasFlag(ColorOverride.OverrideMode.Color)) + // { + // colorProp.colorValue = + // EditorGUI.ColorField(colorRect, GUIContent.none, colorProp.colorValue, true, + // flags.HasFlag(ColorOverride.OverrideMode.Alpha), false); + // } + // else if (flags.HasFlag(ColorOverride.OverrideMode.Alpha)) + // { + // float alpha = EditorGUI.Slider(colorRect, colorProp.colorValue.a, 0f, 1f); + // + // if (colorProp.colorValue.a != alpha) + // { + // colorProp.colorValue = new Color32((byte)colorProp.colorValue.r, (byte)colorProp.colorValue.g, (byte)colorProp.colorValue.b, (byte) + // (alpha * 255)); + // } + // } + // + // EditorGUI.EndProperty(); + // } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + return EditorGUIUtility.singleLineHeight; + } +} \ No newline at end of file diff --git a/Package/Editor/GenericAnimation/ColorOverrideDrawer.cs.meta b/Package/Editor/GenericAnimation/ColorOverrideDrawer.cs.meta new file mode 100644 index 0000000..57a2170 --- /dev/null +++ b/Package/Editor/GenericAnimation/ColorOverrideDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f9d42e8d19116ff42b6ddce6abf02b66 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/GenericAnimation/EditorFriendlyCharDataModifiersDrawer.cs b/Package/Editor/GenericAnimation/EditorFriendlyCharDataModifiersDrawer.cs new file mode 100644 index 0000000..246b02a --- /dev/null +++ b/Package/Editor/GenericAnimation/EditorFriendlyCharDataModifiersDrawer.cs @@ -0,0 +1,176 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.TMPAnimations; +using UnityEditor; +using UnityEngine; +using UnityEngine.Playables; + +[CustomPropertyDrawer(typeof(EditorFriendlyCharDataModifiers))] +public class EditorFriendlyCharDataModifiersDrawer : PropertyDrawer +{ + private SerializedProperty positionProp; + private SerializedProperty scaleProp; + private SerializedProperty rotationsProp; + private SerializedProperty blPositionProp, tlPositionProp, trPositionProp, brPositionProp; + private SerializedProperty blColorProp, tlColorProp, trColorProp, brColorProp; + private SerializedProperty blUV0Prop, tlUV0Prop, trUV0Prop, brUV0Prop; + + private Color32 backgroundColor; + + private const float TypedVectorFoldoutWidth = 20f; + + private void Init(SerializedProperty property) + { + positionProp = property.FindPropertyRelative("Position"); + scaleProp = property.FindPropertyRelative("Scale"); + rotationsProp = property.FindPropertyRelative("Rotations"); + + blPositionProp = property.FindPropertyRelative("BL_Position"); + tlPositionProp = property.FindPropertyRelative("TL_Position"); + trPositionProp = property.FindPropertyRelative("TR_Position"); + brPositionProp = property.FindPropertyRelative("BR_Position"); + + blColorProp = property.FindPropertyRelative("BL_Color"); + tlColorProp = property.FindPropertyRelative("TL_Color"); + trColorProp = property.FindPropertyRelative("TR_Color"); + brColorProp = property.FindPropertyRelative("BR_Color"); + + blPositionProp = property.FindPropertyRelative("BL_Position"); + tlPositionProp = property.FindPropertyRelative("TL_Position"); + trPositionProp = property.FindPropertyRelative("TR_Position"); + brPositionProp = property.FindPropertyRelative("BR_Position"); + + blUV0Prop = property.FindPropertyRelative("BL_UV0"); + tlUV0Prop = property.FindPropertyRelative("TL_UV0"); + trUV0Prop = property.FindPropertyRelative("TR_UV0"); + brUV0Prop = property.FindPropertyRelative("BR_UV0"); + + backgroundColor = EditorGUIUtility.isProSkin + ? new Color32(56, 56, 56, 255) + : new Color32(194, 194, 194, 255); + } + + private Rect DrawCharacterModifier(Rect rect) + { + var bgRect = new Rect(rect.x, rect.y, rect.width, + EditorGUIUtility.singleLineHeight * 2 + EditorGUI.GetPropertyHeight(rotationsProp, true)); + EditorGUI.DrawRect(bgRect, backgroundColor); + + EditorGUI.PropertyField(rect, positionProp); + rect.y += EditorGUIUtility.singleLineHeight; + + rect.height = EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, scaleProp, true); + rect.y += EditorGUIUtility.singleLineHeight; + + rect.height = EditorGUI.GetPropertyHeight(rotationsProp, true); + EditorGUI.PropertyField(rect, rotationsProp, true); + rect.y += rect.height; + + rect.height = EditorGUIUtility.singleLineHeight; + rect.y += EditorGUIUtility.singleLineHeight; + return rect; + } + + private Rect DrawVertexPositionModifiers(Rect rect) + { + var bgRect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight * 4); + EditorGUI.DrawRect(bgRect, backgroundColor); + + EditorGUI.PropertyField(rect, blPositionProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, tlPositionProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, trPositionProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, brPositionProp); + rect.y += EditorGUIUtility.singleLineHeight; + + rect.y += EditorGUIUtility.singleLineHeight; + return rect; + } + + private Rect DrawVertexColorModifiers(Rect rect) + { + var bgRect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight * 4); + EditorGUI.DrawRect(bgRect, backgroundColor); + + EditorGUI.PropertyField(rect, blColorProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, tlColorProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, trColorProp); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, brColorProp); + rect.y += EditorGUIUtility.singleLineHeight; + + rect.y += EditorGUIUtility.singleLineHeight; + return rect; + } + + // private Rect DrawVertexUVModifiers(Rect rect) + // { + // var bgRect = new Rect(rect.x, rect.y, rect.width, EditorGUIUtility.singleLineHeight * 4); + // EditorGUI.DrawRect(bgRect, backgroundColor); + // + // EditorGUI.PropertyField(rect, blColorProp); + // rect.y += EditorGUIUtility.singleLineHeight; + // EditorGUI.PropertyField(rect, tlColorProp); + // rect.y += EditorGUIUtility.singleLineHeight; + // EditorGUI.PropertyField(rect, trColorProp); + // rect.y += EditorGUIUtility.singleLineHeight; + // EditorGUI.PropertyField(rect, brColorProp); + // rect.y += EditorGUIUtility.singleLineHeight; + // + // return rect; + // } + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + Init(property); + + var rect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); + + scaleProp.isExpanded = + EditorGUI.Foldout(rect, scaleProp.isExpanded, new GUIContent("Character Modifiers"), true); + rect.y += EditorGUIUtility.singleLineHeight; + + if (scaleProp.isExpanded) + rect = DrawCharacterModifier(rect); + + blPositionProp.isExpanded = + EditorGUI.Foldout(rect, blPositionProp.isExpanded, new GUIContent("Vertex Position Modifiers"), true); + rect.y += EditorGUIUtility.singleLineHeight; + + if (blPositionProp.isExpanded) + rect = DrawVertexPositionModifiers(rect); + + blColorProp.isExpanded = + EditorGUI.Foldout(rect, blColorProp.isExpanded, new GUIContent("Vertex Color Modifiers"), true); + rect.y += EditorGUIUtility.singleLineHeight; + + if (blColorProp.isExpanded) + rect = DrawVertexColorModifiers(rect); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + Init(property); + float height = 0f; + + height += EditorGUIUtility.singleLineHeight; + if (scaleProp.isExpanded) + { + height += EditorGUIUtility.singleLineHeight * 3; + height += EditorGUI.GetPropertyHeight(rotationsProp, true); + } + + height += EditorGUIUtility.singleLineHeight; + if (blPositionProp.isExpanded) height += EditorGUIUtility.singleLineHeight * 5; + + height += EditorGUIUtility.singleLineHeight; + if (blColorProp.isExpanded) height += EditorGUIUtility.singleLineHeight * 5; + + return height; + } +} \ No newline at end of file diff --git a/Package/Editor/GenericAnimation/EditorFriendlyCharDataModifiersDrawer.cs.meta b/Package/Editor/GenericAnimation/EditorFriendlyCharDataModifiersDrawer.cs.meta new file mode 100644 index 0000000..5dd6f7e --- /dev/null +++ b/Package/Editor/GenericAnimation/EditorFriendlyCharDataModifiersDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bb87fe73afdc6ad409c8524e11a6ed1a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/GenericAnimation/GenericAnimationEditor.cs b/Package/Editor/GenericAnimation/GenericAnimationEditor.cs new file mode 100644 index 0000000..a9b9063 --- /dev/null +++ b/Package/Editor/GenericAnimation/GenericAnimationEditor.cs @@ -0,0 +1,999 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Globalization; +using System.IO; +using System.Linq; +using System.Text.RegularExpressions; +using NUnit.Framework; +using TMPEffects.CharacterData; +using TMPEffects.Editor; +using TMPEffects.Extensions; +using TMPEffects.Parameters; +using TMPEffects.TMPAnimations; +using UnityEditor; +using UnityEditorInternal; +using UnityEngine; +using AnimationUtility = TMPEffects.TMPAnimations.AnimationUtility; + +[CustomEditor(typeof(GenericAnimation))] +public class GenericAnimationEditor : TMPAnimationEditorBase +{ + private const string ExportPathKey = "TMPEffects.EditorPrefKeys.GenericAnimationExportPath"; + private static string exportPath = "Assets/Exported TMPEffects Animations"; + private static string exportName = ""; + + private GUIStyle fileBrowserButtonStyle; + + + protected override void OnEnable() + { + base.OnEnable(); + exportPath = EditorPrefs.GetString(ExportPathKey, exportPath); + + _ = new ReorderableList(serializedObject, + serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks"), true, false, true, true); + UpdateLists(); + + var trackProp = serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks"); + for (int i = 0; i < trackProp.arraySize; i++) + { + var clips = trackProp.GetArrayElementAtIndex(i).FindPropertyRelative("clips"); + QuickSort(clips, 0, clips.arraySize - 1, new SortClipComparer()); + } + } + + protected override void OnDisable() + { + var trackProp = serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks"); + for (int i = 0; i < trackProp.arraySize; i++) + { + var clips = trackProp.GetArrayElementAtIndex(i).FindPropertyRelative("clips"); + QuickSort(clips, 0, clips.arraySize - 1, new SortClipComparer()); + } + } + + // Alternatively: + // Clamp value to not interfere with any other values + // TODO Didnt work at all; might still want that + private void OnChangedStartOrDurationAlt(int listIndex, int changedIndex, params int[] ignoreIndex) + { + var clips = serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks") + .GetArrayElementAtIndex(listIndex).FindPropertyRelative("clips"); + var changedProp = clips.GetArrayElementAtIndex(changedIndex); + + float changedStartTime = changedProp.FindPropertyRelative("startTime").floatValue; + float changedDuration = changedProp.FindPropertyRelative("duration").floatValue; + float changedEndTime = changedStartTime + changedDuration; + + // Update all start times and durations to accomodate for changed time + for (int i = 0; i < clips.arraySize; i++) + { + if (i == changedIndex || ignoreIndex.Contains(i)) continue; + + var step = clips.GetArrayElementAtIndex(i); + + // Cases + + float startTime = step.FindPropertyRelative("startTime").floatValue; + float duration = step.FindPropertyRelative("duration").floatValue; + float endTime = startTime + duration; + + // if changed starts after clip + if (changedStartTime > startTime) + { + // if changed start contained in clip + if (changedStartTime < endTime) + { + float prev = changedStartTime; + changedStartTime = endTime; + changedDuration = Mathf.Max(0f, duration - (changedStartTime - prev)); + changedEndTime = changedStartTime + changedDuration; + } + + continue; + } + + // if changed ends in clip + if (changedEndTime > startTime) + { + if (changedEndTime < endTime) + { + changedDuration = changedStartTime + (endTime - changedEndTime); + changedEndTime = changedStartTime + changedDuration; + } + } + } + + changedProp.FindPropertyRelative("startTime").floatValue = changedStartTime; + changedProp.FindPropertyRelative("duration").floatValue = changedDuration; + } + + // Update all other durations when one was changed in the inspector + // ChangedIndex: the index that was changed, + // ignoreIndex: further indices that should remain unchanged + private void OnChangedStartOrDuration(int listIndex, int changedIndex, params int[] ignoreIndex) + { + var clips = serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks") + .GetArrayElementAtIndex(listIndex).FindPropertyRelative("clips"); + var changedProp = clips.GetArrayElementAtIndex(changedIndex); + + float changedStartTime = changedProp.FindPropertyRelative("startTime").floatValue; + float changedDuration = changedProp.FindPropertyRelative("duration").floatValue; + float changedEndTime = changedStartTime + changedDuration; + + // Update all start times and durations to accomodate for changed time + for (int i = 0; i < clips.arraySize; i++) + { + if (i == changedIndex || ignoreIndex.Contains(i)) continue; + + var step = clips.GetArrayElementAtIndex(i); + + float startTime = step.FindPropertyRelative("startTime").floatValue; + if (startTime > changedEndTime) continue; // If starts after changed ends, cont + + float duration = step.FindPropertyRelative("duration").floatValue; + float endTime = startTime + duration; + if (endTime < changedStartTime) continue; // If ends before changed starts, cont + // else, effected + + // if starts while changed already running + if (startTime >= changedStartTime) + { + // if ends after changed, clamp starttime + if (endTime >= changedEndTime) + { + step.FindPropertyRelative("startTime").floatValue = changedEndTime; + OnChangedStartOrDuration(listIndex, i, ignoreIndex.Concat(new int[] { changedIndex }).ToArray()); + } + // else meaning fully within the changed step + else + { + step.FindPropertyRelative("startTime").floatValue = changedStartTime; + step.FindPropertyRelative("duration").floatValue = 0f; + OnChangedStartOrDuration(listIndex, i, ignoreIndex.Concat(new int[] { changedIndex }).ToArray()); + } + } + + // if changed starts while this is already running, clamp the duration + else if (changedStartTime >= startTime) + { + step.FindPropertyRelative("duration").floatValue = changedStartTime - startTime; + OnChangedStartOrDuration(listIndex, i, ignoreIndex.Concat(new int[] { changedIndex }).ToArray()); + } + } + } + + private void DrawElementCallback(int listindex, Rect rect, int index, bool isactive, bool isfocused) + { + var itemProp = serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks") + .GetArrayElementAtIndex(listindex).FindPropertyRelative("clips").GetArrayElementAtIndex(index); + + var nameProp = itemProp.FindPropertyRelative("name"); + var animateProp = itemProp.FindPropertyRelative("animate"); + + var toggleRect = new Rect(rect.x + 20, rect.y, 15f, EditorGUIUtility.singleLineHeight); + animateProp.boolValue = EditorGUI.ToggleLeft(toggleRect, GUIContent.none, animateProp.boolValue); + toggleRect.x += 17.5f; + toggleRect.width = rect.width - 17.5f; + EditorGUI.LabelField(toggleRect, + string.IsNullOrWhiteSpace(nameProp.stringValue) ? "Element " + index : nameProp.stringValue); + + float fromWidth = 75; + float gap = 10; + var fromRect = new Rect(rect.x + rect.width - fromWidth * 2 - gap * 1.5f, rect.y, fromWidth, + EditorGUIUtility.singleLineHeight); + var toRect = new Rect(rect.x + rect.width - fromWidth - gap, rect.y, fromWidth, + EditorGUIUtility.singleLineHeight); + + var startTimeProp = itemProp.FindPropertyRelative("startTime"); + var durationProp = itemProp.FindPropertyRelative("duration"); + + EditorGUIUtility.labelWidth = 30; + float newTime = Mathf.Max(0, EditorGUI.FloatField(fromRect, new GUIContent("from:"), startTimeProp.floatValue)); + EditorGUIUtility.labelWidth = 15; + float newEndTime = Mathf.Max(newTime, EditorGUI.FloatField(toRect, new GUIContent("to:"), + startTimeProp.floatValue + durationProp.floatValue)); + + if (newEndTime < newTime) newEndTime = newTime; + + if (newTime != startTimeProp.floatValue) + { + startTimeProp.floatValue = newTime; + OnChangedStartOrDuration(listindex, index); + } + else if (newEndTime != startTimeProp.floatValue + durationProp.floatValue) + { + durationProp.floatValue = newEndTime - startTimeProp.floatValue; + OnChangedStartOrDuration(listindex, index); + } + + EditorGUIUtility.labelWidth = 0; + EditorGUI.PropertyField(rect, itemProp, GUIContent.none); + } + + private float MainElementHeightCallback(int index) + { + var tracksprop = serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks"); + var clips = tracksprop.GetArrayElementAtIndex(index).FindPropertyRelative("clips"); + return EditorGUI.GetPropertyHeight(clips); + } + + private void MainAddCallback(ReorderableList list) + { + Debug.LogWarning("ADD"); + var trackprop = serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks"); + trackprop.arraySize++; + trackprop.GetArrayElementAtIndex(trackprop.arraySize - 1).FindPropertyRelative("clips").ClearArray(); + } + + private void MainDrawElementCallback(Rect rect, int index, bool isactive, bool isfocused) + { + EditorGUI.indentLevel++; + var tracksprop = serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks"); + var clips = tracksprop.GetArrayElementAtIndex(index).FindPropertyRelative("clips"); + EditorGUI.PropertyField(rect, clips); + EditorGUI.indentLevel--; + } + + private void AddCallback(ReorderableList list) + { + var animStepsProp = serializedObject.FindProperty("animationSteps"); + animStepsProp.arraySize++; + var newElement = animStepsProp.GetArrayElementAtIndex(animStepsProp.arraySize - 1); + newElement.managedReferenceValue = new AnimationStep(); + } + + private struct SortClipComparer : IComparer + { + public int Compare(SerializedProperty x, SerializedProperty y) + { + float + xStart = x.FindPropertyRelative("startTime").floatValue, + yStart = y.FindPropertyRelative("startTime").floatValue; + + if (xStart < yStart) return -1; + if (yStart < xStart) return 1; + + float + xDuration = x.FindPropertyRelative("duration").floatValue, + yDuration = y.FindPropertyRelative("duration").floatValue; + + if (xDuration < yDuration) return -1; + if (yDuration < xDuration) return 1; + return 0; + } + } + + public static void QuickSort(SerializedProperty prop, int left, int right, IComparer comparer) + { + int i = left, j = right; + var pivot = prop.GetArrayElementAtIndex(left); + + while (i <= j) + { + while (comparer.Compare(prop.GetArrayElementAtIndex(i), pivot) == -1) + i++; + + while (comparer.Compare(prop.GetArrayElementAtIndex(j), pivot) == 1) + j--; + + // while (array[i] < pivot) + // i++; + // while (array[j] > pivot) + // j--; + + if (i <= j) + { + // Swap + var tmp = prop.GetArrayElementAtIndex(i).managedReferenceValue; + prop.GetArrayElementAtIndex(i).managedReferenceValue = + prop.GetArrayElementAtIndex(j).managedReferenceValue; + prop.GetArrayElementAtIndex(j).managedReferenceValue = tmp; + + i++; + j--; + } + } + + // Recursive calls + if (left < j) + QuickSort(prop, left, j, comparer); + if (i < right) + QuickSort(prop, i, right, comparer); + } + + private ReorderableList trackList; + + private void UpdateLists() + { + try + { + var trackprop = serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks"); + // EditorGUILayout.PropertyField(trackprop); + trackList = ReorderableList.GetReorderableListFromSerializedProperty(trackprop); + trackList.onAddCallback = MainAddCallback; + trackList.drawElementCallback = MainDrawElementCallback; + trackList.elementHeightCallback = MainElementHeightCallback; + for (int i = 0; i < trackprop.arraySize; i++) + { + var list = + ReorderableList.GetReorderableListFromSerializedProperty(trackprop.GetArrayElementAtIndex(i) + .FindPropertyRelative("clips")); + + if (list == null) + { + continue; + } + + + int listindex = i; + list.drawElementCallback = (a, b, c, d) => DrawElementCallback(listindex, a, b, c, d); + } + } + catch (Exception e) + { + Debug.LogWarning(e.Message); + } + } + + public override void OnInspectorGUI() + { + serializedObject.Update(); + + EditorGUILayout.LabelField("Animation settings", EditorStyles.boldLabel); + EditorGUI.indentLevel++; + EditorGUILayout.PropertyField(serializedObject.FindProperty("repeat")); + EditorGUILayout.PropertyField(serializedObject.FindProperty("duration")); + EditorGUI.indentLevel--; + + EditorGUILayout.Space(); + + if (GUILayout.Button("Sort Steps")) + { + var trackProp = serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks"); + for (int i = 0; i < trackProp.arraySize; i++) + { + var clips = trackProp.GetArrayElementAtIndex(i).FindPropertyRelative("clips"); + QuickSort(clips, 0, clips.arraySize - 1, new SortClipComparer()); + } + } + + UpdateLists(); + EditorGUILayout.LabelField("Animation Steps", EditorStyles.boldLabel); + trackList.DoLayoutList(); + + + EditorGUILayout.Space(); + + fileBrowserButtonStyle = new GUIStyle(GUI.skin.button); + fileBrowserButtonStyle.normal.background = EditorGUIUtility.IconContent("d_Folder Icon").image as Texture2D; + fileBrowserButtonStyle.fixedHeight = 30; + fileBrowserButtonStyle.fixedWidth = 35; + + EditorGUILayout.LabelField("Export", EditorStyles.boldLabel); + EditorGUI.indentLevel++; + + var textrect = GUILayoutUtility.GetLastRect(); + textrect.y += textrect.height; + textrect.height = EditorGUIUtility.singleLineHeight; + GUILayoutUtility.GetRect(EditorGUIUtility.currentViewWidth, EditorGUIUtility.currentViewWidth, + EditorGUIUtility.singleLineHeight, EditorGUIUtility.singleLineHeight, fileBrowserButtonStyle); + + + var newExportPath = EditorGUI.TextField(textrect, "Export path", exportPath); + if (newExportPath != exportPath) + { + Debug.Log("Setting!"); + EditorPrefs.SetString(ExportPathKey, newExportPath); + exportPath = newExportPath; + } + + textrect.x += EditorGUIUtility.labelWidth - 35; + textrect.width = EditorGUIUtility.singleLineHeight * 1.5f; + textrect.height = EditorGUIUtility.singleLineHeight * 1.5f; + textrect.y -= 10; + if (GUI.Button(textrect, "", fileBrowserButtonStyle)) + { + string path = EditorUtility.OpenFolderPanel("Select folder to export to", "Assets", ""); + if (!string.IsNullOrWhiteSpace(path)) + { + EditorPrefs.SetString(ExportPathKey, path); + exportPath = path; + } + } + + exportName = EditorGUILayout.TextField("Export name", exportName); + EditorGUI.indentLevel--; + + if (GUILayout.Button("Export")) + { + if (string.IsNullOrWhiteSpace(exportName)) + { + EditorUtility.DisplayDialog("Empty export name", "You must specify a name for the exported file", + "Okay"); + } + else + { + string exportNameUnderscored = Regex.Replace(exportName, @"\s+", "_"); + bool okay = EditorUtility.DisplayDialog("Exporting Generic Animation", + "This will export this GenericAnimation animation as a .cs file, allowing you to make further edits.\nThe file will be saved as: \n" + + exportPath + "/" + exportNameUnderscored + ".cs", "Okay", "Cancel"); + + if (okay) GenericAnimationExporter.Export(serializedObject, exportPath, exportNameUnderscored); + } + } + + + serializedObject.ApplyModifiedProperties(); + } + + private int sliderControlID; + private bool? wasPlaying = null; + + public override void OnPreviewSettings() + { + // Draw the slider / playbar + // TODO its finicky; jumps around if your mouse isnt almost perfectly on it + var duration = serializedObject.FindProperty("duration"); + float useValue = animator.AnimatorContext.PassedTime % + duration.floatValue; + // EditorGUILayout.LabelField("" + animator.AnimatorContext.PassedTime.ToString("F2"), GUILayout.Width(40)); + + EditorGUILayout.LabelField(animator.AnimatorContext.PassedTime.ToString("F2"), GUILayout.MinWidth(0f), + GUILayout.MaxWidth(40)); + sliderControlID = GUIUtility.GetControlID(FocusType.Passive); + useValue = EditorGUILayout.Slider(useValue, 0f, duration.floatValue, GUILayout.MinWidth(200)); + + + if (GUIUtility.hotControl == sliderControlID + 2) + { + if (!wasPlaying.HasValue) wasPlaying = animate; + animate = false; + float fullPlays = (int)(animator.AnimatorContext.PassedTime / duration.floatValue); + animator.ResetTime(fullPlays + useValue); + animator.UpdateAnimations(0f); + } + else if (wasPlaying.HasValue) + { + animate = wasPlaying.Value; + wasPlaying = null; + } + + // Copied from TMPAnimationEditorBase w minor changes + GUIStyle animationButtonStyle = new GUIStyle(GUI.skin.button); + animationButtonStyle.richText = true; + char animationC = animate ? '\u2713' : '\u2717'; + GUIContent animationButtonContent = new GUIContent("Play " + (animate ? "" : "") + + animationC.ToString() + ""); + + if (GUILayout.Button(animationButtonContent, animationButtonStyle)) + { + animate = !animate; + // if (!animate) animator.ResetAnimations(); + } + + if (GUILayout.Button("Restart")) + { + animator.ResetTime(); + OnChange(anim); + } + } +} + +public static class GenericAnimationExporter +{ + public static void Export(SerializedObject serializedObject, string exportPath, string name) + { + var anim = serializedObject.targetObject as GenericAnimation; + if (anim == null) + throw new System.InvalidOperationException( + "The passed in serializedObject's target object is not a GenericAnimation"); + + var tracks = GetTracks(serializedObject.FindProperty("Tracks").FindPropertyRelative("Tracks")); + var repeats = serializedObject.FindProperty("repeat").boolValue; + var duration = serializedObject.FindProperty("duration").floatValue; + GenerateScriptFromModifier(name, exportPath, repeats, duration, tracks); + } + + public static void Export(GenericAnimation anim, string filePath) + { + // var steps = anim.AnimationSteps; + // var repeats = anim.Repeat; + // var duration = anim.Duration; + // GenerateScriptFromModifier(filePath, repeats, duration, steps); + } + + static List> GetTracks(SerializedProperty property) + { + List> tracks = new List>(); + for (int i = 0; i < property.arraySize; i++) + { + var trackProp = property.GetArrayElementAtIndex(i).FindPropertyRelative("clips"); + var clips = GetAnimationSteps(trackProp); + tracks.Add(clips); + } + + return tracks; + } + + static List GetAnimationSteps(SerializedProperty animationStepsProp) + { + List steps = new List(); + for (int i = 0; i < animationStepsProp.arraySize; i++) + { + var stepProp = animationStepsProp.GetArrayElementAtIndex(i); + steps.Add(GetAnimationStep(stepProp)); + } + + return steps; + } + + static AnimationStep GetAnimationStep(SerializedProperty prop) + { + var animationStep = prop.managedReferenceValue as AnimationStep; + if (animationStep == null) throw new System.InvalidOperationException("Couldnt cast animationsteps"); + return animationStep; + } + + private class OrderedHashSet : KeyedCollection + { + protected override T GetKeyForItem(T item) + { + return item; + } + } + + static Dictionary> GetAnimationStepNames(List> tracks) + { + Dictionary> names = new Dictionary>(); + + int trackCounter = 0; + int stepCounter = 0; + foreach (var track in tracks) + { + List currnames = new List(); + names[trackCounter] = currnames; + + foreach (var step in track) + { + string nameToAdd = step.name; + + // replace invlid characters + nameToAdd = Regex.Replace(nameToAdd, @"[^a-zA-Z0-9_]", ""); + + if (string.IsNullOrWhiteSpace(nameToAdd)) + { + nameToAdd = "Track_" + trackCounter + "_" + stepCounter; + } + else nameToAdd = "Track_" + trackCounter + "_" + nameToAdd; + + nameToAdd = ReplaceWhitespaceWithUnderscore(nameToAdd); + + if (currnames.Contains(nameToAdd)) + { + nameToAdd += "_"; + + int counter = 0; + while (currnames.Contains(nameToAdd + counter.ToString())) + { + counter++; + } + + nameToAdd += counter.ToString(); + } + + currnames.Add(nameToAdd); + stepCounter++; + } + + trackCounter++; + } + + return names; + } + + static string ReplaceWhitespaceWithUnderscore(string s) + { + return Regex.Replace(s, @"\s+", "_"); + } + + static bool GenerateScriptFromModifier(string filePath, bool repeats, float duration, + List> steps) + { + var name = Path.GetFileNameWithoutExtension(filePath); + var path = Path.GetDirectoryName(filePath); + return GenerateScriptFromModifier(name, path, repeats, duration, steps); + } + + static bool GenerateScriptFromModifier(string className, string fileNamePath, bool repeats, float duration, + List> steps) + { + var names = GetAnimationStepNames(steps); + className = ReplaceWhitespaceWithUnderscore(className); + + string code = string.Format(@"using System.Collections.Generic; +using TMPEffects.AutoParameters.Attributes; +using TMPEffects.CharacterData; +using TMPEffects.TMPAnimations; +using static TMPEffects.Parameters.ParameterUtility; +using static TMPEffects.Parameters.ParameterParsing; +using static TMPEffects.Parameters.ParameterTypes; +using static TMPEffects.TMPAnimations.AnimationUtility; +using UnityEngine; + +namespace TMPEffects.TMPAnimations.GenericExports +{{ + // This class was generated off of a . + [AutoParameters] + [CreateAssetMenu(fileName=""new " + className + @""", menuName=""TMPEffects/Animations/Exported/" + className + + @""")] + public partial class " + className + @" : TMPAnimation + {{ + [AutoParameter(""repeat"", ""rp""), SerializeField] + private bool repeat = " + repeats.ToString().ToLower() + @"; + + [AutoParameter(""duration"", ""dur""), SerializeField] + private float duration = " + GetFloatString(duration) + @"; + + #region Generated Animation Step Fields +{0} + #endregion + + private partial void Animate(CharData cData, AutoParametersData data, IAnimationContext context) + {{ +{1} + }} + + private CharDataModifiers storage, storage2; + private CharDataModifiers current, accumulated; + + // Apply an AnimationStep, storing into the ""current"" CharDataModifier. + private bool ApplyAnimationStep(AnimationStep step, float timeValue, CharData cData, IAnimationContext context) + {{ + // Check if should apply + if (step == null) return false; + if (!step.animate) return false; + if (step.startTime > timeValue) return false; + if (step.EndTime < timeValue) return false; + + // Calculate weight, based on the currently relevant blend curve + float weight = 1; + float entry = timeValue - step.startTime; + if (step.entryDuration > 0 && entry <= step.entryDuration) + {{ + weight = step.entryCurve.Evaluate(entry / step.entryDuration); + }} + + float exit = step.EndTime - timeValue; + if (step.exitDuration > 0 && exit <= step.exitDuration) + {{ + weight *= step.exitCurve.Evaluate(exit / step.exitDuration); + }} + + // Apply the wave to the weight + if (step.useWave) + {{ + var offset = AnimationUtility.GetWaveOffset(cData, context, step.waveOffsetType); + weight *= step.wave.Evaluate(timeValue, offset).Value; + }} + + // Reset the current, since it'll be used to store the result + current.Reset(); + + // If you should use initial modifiers + if (step.useInitialModifiers) + {{ + // Reset storage + storage.Reset(); + storage2.Reset(); + + // Set modifiers + step.initModifiers.ToCharDataModifiers(cData, context, storage); + step.modifiers.ToCharDataModifiers(cData, context, storage2); + + // Lerp modifiers and store into current + CharDataModifiers.LerpUnclamped(cData, storage, storage2, weight, current); + }} + // If you should lerp from the CharData itself + else + {{ + // Reset storage + storage.Reset(); + + // Set modifier + step.modifiers.ToCharDataModifiers(cData, context, storage); + + // Lerp modifier and store into current + CharDataModifiers.LerpUnclamped(cData, storage, weight, current); + }} + + // Return true to indicate that ""current"" should be applied + return true; + }} + }} +}}", GenerateStepParameters(steps, names), GenerateAnimateCode(steps, names) /*, GenerateStepMethods(steps, names)*/); + return GenerateScriptFromContext(fileNamePath + "/" + className + ".cs", code); + } + + private static string GenerateStepParameters(List> tracks, + Dictionary> names) + { + string code = ""; + int trackIndex = -1; + foreach (var steps in tracks) + { + trackIndex++; + + for (int i = 0; i < steps.Count; i++) + { + var step = steps[i]; + var name = names[trackIndex][i]; + + code += + $@" + [SerializeField] private AnimationStep Step_{name} = new AnimationStep() + {{ + name = ""{step.name}"", + entryDuration = {GetFloatString(step.entryDuration)}, + entryCurve = {GetFancyAnimCurveString(step.entryCurve)}, + exitDuration = {GetFloatString(step.exitDuration)}, + exitCurve = {GetFancyAnimCurveString(step.exitCurve)}, + loops = {step.loops.ToString().ToLower()}, + startTime = {GetFloatString(step.startTime)}, + duration = {GetFloatString(step.duration)}, + useWave = {step.useWave.ToString().ToLower()}, + wave = new AnimationUtility.Wave( + {GetAnimCurveString(step.wave.UpwardCurve)}, + {GetAnimCurveString(step.wave.DownwardCurve)}, + {GetFloatString(step.wave.UpPeriod)}, {GetFloatString(step.wave.DownPeriod)}, {GetFloatString(step.wave.Amplitude)}, + {GetFloatString(step.wave.CrestWait)}, {GetFloatString(step.wave.TroughWait)}, {GetFloatString(step.wave.Uniformity)}), + modifiers = new EditorFriendlyCharDataModifiers() + {{ + {(!step.modifiers.Position.Equals(new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero)) ? $"Position = {GetTypedVector3String(step.modifiers.Position)}," : "")} + {(!step.modifiers.Scale.Equals(Vector3.one) ? $"Scale = {GetVector3String(step.modifiers.Scale)}," : "")} + {(step.modifiers.Rotations.Count != 0 ? @$"Rotations = new List() + {{{GetRotationsString(step.modifiers.Rotations)} + }}," : "")} + {(!step.modifiers.BL_Position.Equals(new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero)) ? $"BL_Position = {GetTypedVector3String(step.modifiers.BL_Position)}," : "")} + {(!step.modifiers.TL_Position.Equals(new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero)) ? $"TL_Position = {GetTypedVector3String(step.modifiers.TL_Position)}," : "")} + {(!step.modifiers.TR_Position.Equals(new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero)) ? $"TR_Position = {GetTypedVector3String(step.modifiers.TR_Position)}," : "")} + {(!step.modifiers.BR_Position.Equals(new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero)) ? $"BR_Position = {GetTypedVector3String(step.modifiers.BR_Position)}," : "")} + {(step.modifiers.BL_Color.Override != 0 ? $"BL_Color = {GetColorOverrideString(step.modifiers.BL_Color)}," : "")} + {(step.modifiers.TL_Color.Override != 0 ? $"TL_Color = {GetColorOverrideString(step.modifiers.TL_Color)}," : "")} + {(step.modifiers.TR_Color.Override != 0 ? $"TR_Color = {GetColorOverrideString(step.modifiers.TR_Color)}," : "")} + {(step.modifiers.BR_Color.Override != 0 ? $"BR_Color = {GetColorOverrideString(step.modifiers.BR_Color)}," : "")} + }}, + {(step.useInitialModifiers ? @$"initModifiers = new EditorFriendlyCharDataModifiers() + {{ + {(!step.initModifiers.Position.Equals(new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero)) ? $"Position = {GetTypedVector3String(step.initModifiers.Position)}," : "")} + {(!step.initModifiers.Scale.Equals(Vector3.one) ? $"Scale = {GetVector3String(step.initModifiers.Scale)}," : "")} + {(step.initModifiers.Rotations.Count != 0 ? @$"Rotations = new List() + {{{GetRotationsString(step.initModifiers.Rotations)} + }}," : "")} + {(!step.initModifiers.BL_Position.Equals(new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero)) ? $"BL_Position = {GetTypedVector3String(step.initModifiers.BL_Position)}," : "")} + {(!step.initModifiers.TL_Position.Equals(new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero)) ? $"TL_Position = {GetTypedVector3String(step.initModifiers.TL_Position)}," : "")} + {(!step.initModifiers.TR_Position.Equals(new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero)) ? $"TR_Position = {GetTypedVector3String(step.initModifiers.TR_Position)}," : "")} + {(!step.initModifiers.BR_Position.Equals(new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero)) ? $"BR_Position = {GetTypedVector3String(step.initModifiers.BR_Position)}," : "")} + {(step.initModifiers.BL_Color.Override != 0 ? $"BL_Color = {GetColorOverrideString(step.initModifiers.BL_Color)}," : "")} + {(step.initModifiers.TL_Color.Override != 0 ? $"TL_Color = {GetColorOverrideString(step.initModifiers.TL_Color)}," : "")} + {(step.initModifiers.TR_Color.Override != 0 ? $"TR_Color = {GetColorOverrideString(step.initModifiers.TR_Color)}," : "")} + {(step.initModifiers.BR_Color.Override != 0 ? $"BR_Color = {GetColorOverrideString(step.initModifiers.BR_Color)}," : "")} + }}" : "")} + }};"; + + code = string.Join(Environment.NewLine, code + .Split(new[] { Environment.NewLine }, StringSplitOptions.None) + .Where(line => !string.IsNullOrWhiteSpace(line))); + + code += "\n"; + } + } + + return code; + } + + private static string GetColorOverrideString(ColorOverride modifiersBLColor) + { + return + $"new ColorOverride({GetColorString(modifiersBLColor.Color)}, {GetColorOverrideModeString(modifiersBLColor.Override)})"; + } + + private static string GetColorOverrideModeString(ColorOverride.OverrideMode overr) + { + if (overr.HasFlag(ColorOverride.OverrideMode.Color) && overr.HasFlag(ColorOverride.OverrideMode.Alpha)) + { + return "ColorOverride.OverrideMode.Alpha | ColorOverride.OverrideMode.Color"; + } + + if (overr == 0) return "0"; + + return "ColorOverride.OverrideMode." + overr; + } + + private static string GetRotationsString(List modifiersRotations) + { + string str = " "; + foreach (var rot in modifiersRotations) + { + str += + $"\nnew EditorFriendlyRotation({GetVector3String(rot.eulerAngles)}, {GetTypedVector3String(rot.pivot)}),"; + } + + return str.Substring(0, str.Length - 1); + } + + private static string GetFancyAnimCurveString(AnimationUtility.FancyAnimationCurve curve) + { + // TODO TMPWrapMode and WaveOffsetType (for that second one wait to see if i do poweroffsettype) + var str = $@"new FancyAnimationCurve() +{{ + Curve = {GetAnimCurveString(curve.Curve)}, + Uniformity = {GetFloatString(curve.Uniformity)}, +}} +"; + return str; + } + + private static string GetAnimCurveString(AnimationCurve curve) + { + var str = "new AnimationCurve("; + for (int i = 0; i < curve.keys.Length; i++) + { + var keyframe = curve.keys[i]; + str += + $" new Keyframe({GetFloatString(keyframe.time)}, {GetFloatString(keyframe.value)}, {GetFloatString(keyframe.inTangent)}, {GetFloatString(keyframe.outTangent)})"; + if (i == curve.keys.Length - 1) break; + str += ","; + } + + str += ")"; + return str; + } + + private static string GetFloatString(float vcalue) + { + return vcalue.ToString("0.######", CultureInfo.InvariantCulture) + "f"; + } + + private static string GetTypedVector3String(ParameterTypes.TypedVector3 vector) + { + return $"new TypedVector3({GetVectorTypeString(vector.type)}, {GetVector3String(vector.vector)})"; + } + + private static string GetVectorTypeString(ParameterTypes.VectorType type) + { + return "VectorType." + type; + } + + private static string GetVector3String(Vector3 vector) + { + return + $"new Vector3({GetFloatString(vector.x)}, {GetFloatString(vector.y)}, {GetFloatString(vector.z)})"; + } + + private static string GetQuaternionString(Quaternion quat) + { + return + $"new Quaternion({GetFloatString(quat.x)}, {GetFloatString(quat.y)}, {GetFloatString(quat.z)}, {GetFloatString(quat.w)})"; + } + + private static string GetColorString(Color32 color) + { + return + $"new Color32({color.r}, {color.g}, {color.b}, {color.a})"; + } + + static string GenerateAnimateCode(List> tracks, Dictionary> names) + { + string code = @" accumulated.Reset(); + float timeValue = data.repeat ? context.AnimatorContext.PassedTime % data.duration : context.AnimatorContext.PassedTime; +"; + + int trackIndex = -1; + foreach (var steps in tracks) + { + trackIndex++; + + for (int i = 0; i < steps.Count; i++) + { + var name = names[trackIndex][i]; + code += $@" + if (ApplyAnimationStep(Step_{name}, timeValue, cData, context)) + accumulated.Combine(current); +"; + } + } + + code += $@" + cData.CharacterModifierss.Combine(accumulated.CharacterModifiers); + cData.MeshModifiers.Combine(accumulated.MeshModifiers);"; + + return code; + } + + static string GenerateStepMethods(List steps, OrderedHashSet names) + { + string code = ""; + + for (int i = 0; i < steps.Count; i++) + { + var name = names[i]; + code += @$" + private CharDataModifiers Animate_{name}(float timeValue, AnimationStep step, CharData cData, AutoParametersData data, IAnimationContext context) + {{ + if (step.startTime > timeValue) return null; + if (step.EndTime < timeValue) return null; + + float weight = 1; + float entry = timeValue - step.startTime; + if (entry <= step.entryDuration) + {{ + weight = step.entryCurve.Evaluate(entry / step.entryDuration); + }} + + float exit = step.EndTime - timeValue; + if (exit <= step.exitDuration) + {{ + weight *= step.exitCurve.Evaluate(exit / step.exitDuration); + }} + + CharDataModifiers result; + CharDataModifiers modifiers = step.modifiers.ToCharDataModifiers(cData, context); + if (step.useWave) + {{ + var offset = GetWaveOffset(cData, context, step.waveOffsetType); + result = + CharDataModifiers.LerpUnclamped(cData, modifiers, + step.wave.Evaluate(timeValue, offset).Value * weight); + }} + else + {{ + result = CharDataModifiers.LerpUnclamped(cData, modifiers, weight); + }} + + return result; + }} +"; + } + + return code; + } + + static bool GenerateScriptFromContext(string fileNamePath, string code) + { + var hierarchy = fileNamePath.Split('/'); + string filename = hierarchy[hierarchy.Length - 1]; + string dirPath = hierarchy[0]; + + Debug.Log("Creating w " + fileNamePath); + for (int i = 1; i < hierarchy.Length; i++) + { + Debug.Log("dirpatrh now " + dirPath); + if (!Directory.Exists(dirPath)) + { + Directory.CreateDirectory(dirPath); + } + + dirPath += "/" + hierarchy[i]; + } + + if (File.Exists(dirPath)) + { + var text = File.ReadAllText(dirPath); + if (text == code) + { + // fileNames.Add(code.fileName); + return false; + } + } + + Debug.Log("writing to " + dirPath); + File.WriteAllText(dirPath, code); + AssetDatabase.Refresh(); + AssetDatabase.SaveAssets(); + + return true; + } +} \ No newline at end of file diff --git a/Package/Editor/GenericAnimation/GenericAnimationEditor.cs.meta b/Package/Editor/GenericAnimation/GenericAnimationEditor.cs.meta new file mode 100644 index 0000000..368d54e --- /dev/null +++ b/Package/Editor/GenericAnimation/GenericAnimationEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f8e10bdbc9a943247b7d2e839c93af3c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/GenericAnimation/RotationDrawer.cs b/Package/Editor/GenericAnimation/RotationDrawer.cs new file mode 100644 index 0000000..bb2b1da --- /dev/null +++ b/Package/Editor/GenericAnimation/RotationDrawer.cs @@ -0,0 +1,31 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +[CustomPropertyDrawer(typeof(Rotation))] +public class RotationDrawer : PropertyDrawer +{ + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + var rect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); + + property.isExpanded = EditorGUI.Foldout(rect, property.isExpanded, label); + rect.y += EditorGUIUtility.singleLineHeight; + + if (!property.isExpanded) return; + + EditorGUI.PropertyField(rect, property.FindPropertyRelative("pivot")); + rect.y += EditorGUIUtility.singleLineHeight; + EditorGUI.PropertyField(rect, property.FindPropertyRelative("eulerAngles")); + + if (property.serializedObject.hasModifiedProperties) + property.serializedObject.ApplyModifiedProperties(); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + if (property.isExpanded) return EditorGUIUtility.singleLineHeight * 3; + return EditorGUIUtility.singleLineHeight; + } +} \ No newline at end of file diff --git a/Package/Editor/GenericAnimation/RotationDrawer.cs.meta b/Package/Editor/GenericAnimation/RotationDrawer.cs.meta new file mode 100644 index 0000000..dc163db --- /dev/null +++ b/Package/Editor/GenericAnimation/RotationDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a1f692092f31efb44bd72386f10137aa +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/PowerEnumDrawer.cs b/Package/Editor/PowerEnumDrawer.cs new file mode 100644 index 0000000..8b3f53d --- /dev/null +++ b/Package/Editor/PowerEnumDrawer.cs @@ -0,0 +1,50 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEditor; +using UnityEngine; + +[CustomPropertyDrawer(typeof(PowerEnum<,>), true)] +public class PowerEnumDrawer : PropertyDrawer +{ + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(position, label, property); + + var enumProp = property.FindPropertyRelative("enumValue"); + var customProp = property.FindPropertyRelative("customValue"); + var useCustomProp = property.FindPropertyRelative("useCustom"); + + List options = new List(enumProp.enumDisplayNames); + options.Add("Custom"); + + int selectedIndex = -1; + if (!useCustomProp.boolValue) + selectedIndex = enumProp.enumValueIndex; + else selectedIndex = options.Count - 1; + + var rect = new Rect(position.x, position.y, position.width, position.height); + var ctrlRect = EditorGUI.PrefixLabel(rect, label); + + int index; + + // Custom + if (selectedIndex == options.Count - 1) + { + var width = ctrlRect.width; + ctrlRect.width *= 0.25f; + var ctrlRect2 = new Rect(ctrlRect.x + ctrlRect.width, ctrlRect.y, width * 0.75f, ctrlRect.height); + index = EditorGUI.Popup(ctrlRect, selectedIndex, options.ToArray()); + EditorGUI.PropertyField(ctrlRect2, customProp, GUIContent.none); + } + // Normal + else + { + index = EditorGUI.Popup(ctrlRect, selectedIndex, options.ToArray()); + } + + useCustomProp.boolValue = index == options.Count - 1; + + EditorGUI.EndProperty(); + } +} \ No newline at end of file diff --git a/Package/Editor/PowerEnumDrawer.cs.meta b/Package/Editor/PowerEnumDrawer.cs.meta new file mode 100644 index 0000000..a2a84fc --- /dev/null +++ b/Package/Editor/PowerEnumDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 902c3b25cdf4d8949ba559745fb12c63 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/TMPAnimation Editor/TMPAnimationEditorBase.cs b/Package/Editor/TMPAnimation Editor/TMPAnimationEditorBase.cs index 919714a..02f4d23 100644 --- a/Package/Editor/TMPAnimation Editor/TMPAnimationEditorBase.cs +++ b/Package/Editor/TMPAnimation Editor/TMPAnimationEditorBase.cs @@ -71,8 +71,12 @@ public override void OnPreviewSettings() animate = !animate; if (!animate) animator.ResetAnimations(); } + if (GUILayout.Button("Restart")) + { + animator.ResetTime(); OnChange(anim); + } } public override void DrawPreview(Rect previewArea) diff --git a/Package/Editor/TMPAnimationPreview.cs b/Package/Editor/TMPAnimationPreview.cs new file mode 100644 index 0000000..54f9cbc --- /dev/null +++ b/Package/Editor/TMPAnimationPreview.cs @@ -0,0 +1,338 @@ +//using System; +//using System.Collections; +//using System.Collections.Generic; +//using System.Linq; +//using TMPEffects.CharacterData; +//using TMPEffects.Components; +//using TMPEffects.Tags; +//using TMPEffects.TMPAnimations; +//using TMPEffects.TMPSceneAnimations; +//using TMPro; +//using UnityEditor; +//using UnityEngine; + +//[CustomPreview(typeof(ITMPAnimation))] +//public class TMPAnimationPreview : ObjectPreview +//{ + +// PreviewRenderUtility previewUtility; +// private GameObject targetObject; +// private TMP_Text targetText; +// private TMPAnimator animator; + +// private void Call() +// { +// Debug.Log("CALL"); +// } + +// public override bool HasPreviewGUI() +// { +// return target != null && (target as ITMPAnimation).ValidateParameters(new Dictionary()); +// } + +// public override void Initialize(UnityEngine.Object[] targets) +// { +// base.Initialize(targets); + +// previewUtility = new PreviewRenderUtility(); +// SetupPreviewScene(); +// } + +// private class WrapperAnimation : TMPSceneAnimation +// { +// public ITMPAnimation tmpanimation; + +// public override void Animate(CharData cData, IAnimationContext context) +// { +// tmpanimation.Animate(cData, context); +// } + +// public override object GetNewCustomData() => tmpanimation.GetNewCustomData(); + +// public override void SetParameters(object customData, IDictionary parameters) +// => tmpanimation.SetParameters(customData, parameters); + +// public override bool ValidateParameters(IDictionary parameters) +// => tmpanimation.ValidateParameters(parameters); +// } + +// private void SetupPreviewScene() +// { +// EditorApplication.update += Updatess; + +// //Debug.Log("Called with null " + (m_Targets == null)); +// //Debug.Log("Called with " + m_Targets.Length + " And " + m_Targets.Where(x => x != null).Count()); + +// //Debug.Log("Hello"); +// targetObject = new GameObject("Test"); +// targetText = targetObject.AddComponent(); +// targetObject.transform.position = Vector3.zero; + +// targetText.alignment = TextAlignmentOptions.Center; +// targetText.horizontalAlignment = HorizontalAlignmentOptions.Center; +// targetText.text = "TMPEffects"; +// targetText.fontSize = 15; + + +// //Debug.Log("Adding"); +// animator = targetObject.AddComponent(); +// GameObject go = new GameObject(); +// go.transform.parent = targetObject.transform; +// WrapperAnimation anim = go.AddComponent(); + +// //if (go == null) Debug.LogWarning("GO NULL"); +// //else if (anim == null) Debug.LogWarning("ANIM NULL"); +// //else if (target == null) Debug.LogWarning("target NULL"); +// //else if (target as ITMPAnimation == null) Debug.LogWarning("target cast NULL"); +// //else Debug.Log("all fucking good"); + +// anim.tmpanimation = target as ITMPAnimation; +// animator.SceneAnimations.Add("preview", anim); +// animator.enabled = true; + +// animator.SetUpdateFrom(TMPEffects.Components.Animator.UpdateFrom.Script); + +// Debug.Log("Animator " + animator.isActiveAndEnabled + " " + animator.enabled + " " + animator.gameObject.activeInHierarchy); + +// // Since we want to manage this instance ourselves, hide it +// // from the current active scene, but remember to also destroy it. +// //targetObject.hideFlags = HideFlags.HideAndDontSave; +// previewUtility.AddSingleGO(targetObject); + +// // Camera is spawned at origin, so position is in front of the cube. +// previewUtility.camera.transform.position = new Vector3(0f, 0f, -10f); + +// // This is usually set very small for good performance, but +// // we need to shift the range to something our cube can fit between. +// previewUtility.camera.nearClipPlane = 5f; +// previewUtility.camera.farClipPlane = 20f; + +// targetObject.hideFlags = HideFlags.HideAndDontSave; +// go.hideFlags = HideFlags.HideAndDontSave; +// } + +// public override GUIContent GetPreviewTitle() +// { +// return new GUIContent("TMPEffects Animation"); +// } + +// public override string GetInfoString() +// { +// return "This is the info"; +// } + +// public override void Cleanup() +// { +// base.Cleanup(); +// if (targetObject != null) UnityEngine.Object.DestroyImmediate(targetObject); +// if (previewUtility != null) previewUtility.Cleanup(); +// } + +// void Update() +// { +// Debug.Log("Update queueed"); +// } + +// void Updatess() +// { +// if (animator != null) +// animator.UpdateAnimations(Time.deltaTime + 0.1f); +// EditorApplication.QueuePlayerLoopUpdate(); +// } + +// public override void OnPreviewGUI(Rect r, GUIStyle background) +// { +// if (animator.Tags.Count == 0) +// { +// if (!animator.Tags.TryAdd(new TMPEffectTag("preview", TMPAnimator.ANIMATION_PREFIX, new Dictionary()), new TMPEffectTagIndices(0, -1, 0))) +// Debug.LogError("COULDNT ADD TAG??"); +// else Debug.LogWarning("ADDED!!!"); +// } + +// animator.UpdateAnimations(Time.deltaTime); + + +// Rect rect = r; +// previewUtility.BeginPreview(rect, previewBackground: GUIStyle.none); +// previewUtility.Render(); +// var texture = previewUtility.EndPreview(); +// GUI.DrawTexture(rect, texture); + +// //Debug.Log(Environment.StackTrace); +// } +//} + + +////using UnityEngine; +////using UnityEditor; +////using TMPEffects.TMPAnimations; +////using TMPro; +////using TMPEffects.Components; +////using TMPEffects.Databases.AnimationDatabase; +////using TMPEffects.TMPSceneAnimations; +////using TMPEffects.CharacterData; +////using System.Collections.Generic; +////using TMPEffects.Tags; +////using System.Linq; + +////[CustomPreview(typeof(TMPAnimation))] +////public class TMPAnimationPreview : ObjectPreview +////{ +//// private PreviewRenderUtility previewUtility; +//// private GameObject targetObject; +//// private TMP_Text targetText; +//// private TMPAnimator animator; + +//// private void OnEnable() +//// { + +//// } + +//// public override GUIContent GetPreviewTitle() +//// { +//// return new GUIContent("Animation preview"); +//// } + +//// public override void Initialize(Object[] targets) +//// { +//// base.Initialize(targets); + +//// Debug.LogWarning("CALLED"); +//// previewUtility = new PreviewRenderUtility(); +//// SetupPreviewScene(); +//// } + +//// private class WrapperAnimation : TMPSceneAnimation +//// { +//// public ITMPAnimation tmpanimation; + +//// public override void Animate(CharData cData, IAnimationContext context) +//// { +//// tmpanimation.Animate(cData, context); +//// } + +//// public override object GetNewCustomData() => tmpanimation.GetNewCustomData(); + +//// public override void SetParameters(object customData, IDictionary parameters) +//// => tmpanimation.SetParameters(customData, parameters); + +//// public override bool ValidateParameters(IDictionary parameters) +//// => tmpanimation.ValidateParameters(parameters); +//// } + +//// public override void OnInteractivePreviewGUI(Rect r, GUIStyle background) +//// { +//// Debug.Log("Called as well"); +//// base.OnInteractivePreviewGUI(r, background); +//// } + +//// public override void OnPreviewSettings() +//// { +//// base.OnPreviewSettings(); +//// EditorGUILayout.LabelField(new GUIContent("AYOOOOOOOO")); +//// } + +//// private void SetupPreviewScene() +//// { +//// Debug.Log("Called with null " + (m_Targets == null)); +//// Debug.Log("Called with " + m_Targets.Length + " And " + m_Targets.Where(x => x != null).Count()); + +//// //Debug.Log("Hello"); +//// targetObject = new GameObject("Test"); +//// targetText = targetObject.AddComponent(); +//// targetObject.transform.position = Vector3.zero; + +//// targetText.alignment = TextAlignmentOptions.Center; +//// targetText.horizontalAlignment = HorizontalAlignmentOptions.Center; +//// targetText.text = "TMPEffects"; +//// targetText.fontSize = 15; + + +//// //Debug.Log("Adding"); +//// animator = targetObject.AddComponent(); +//// GameObject go = new GameObject(); +//// go.transform.parent = targetObject.transform; +//// WrapperAnimation anim = go.AddComponent(); + +//// if (go == null) Debug.LogWarning("GO NULL"); +//// else if (anim == null) Debug.LogWarning("ANIM NULL"); +//// else if (target == null) Debug.LogWarning("target NULL"); +//// else if (target as ITMPAnimation == null) Debug.LogWarning("target cast NULL"); +//// else Debug.Log("all fucking good"); + +//// anim.tmpanimation = target as ITMPAnimation; +//// animator.AddSceneAnimation("preview", anim); +//// //animator.SetUpdateFrom(TMPEffects.Components.Animator.UpdateFrom.Script); + +//// // Since we want to manage this instance ourselves, hide it +//// // from the current active scene, but remember to also destroy it. +//// //targetObject.hideFlags = HideFlags.HideAndDontSave; +//// previewUtility.AddSingleGO(targetObject); + +//// // Camera is spawned at origin, so position is in front of the cube. +//// previewUtility.camera.transform.position = new Vector3(0f, 0f, -10f); + +//// // This is usually set very small for good performance, but +//// // we need to shift the range to something our cube can fit between. +//// previewUtility.camera.nearClipPlane = 5f; +//// previewUtility.camera.farClipPlane = 20f; + +//// targetObject.hideFlags = HideFlags.HideAndDontSave; +//// go.hideFlags = HideFlags.HideAndDontSave; +//// } + +//// public override bool HasPreviewGUI() +//// { +//// return true; +//// } + +//// //private void Update() +//// //{ +//// // Debug.Log("update"); +//// // // Just do some random modifications here. +//// // float time = (float)EditorApplication.timeSinceStartup * 15; +//// // //targetObject.transform.rotation = Quaternion.Euler(time * 2f, time * 4f, time * 3f); + +//// // if (!animator.Preqweqw) +//// // { +//// // animator.StartPreviewPublic(); +//// // } + +//// // // Since this is the most important window in the editor, let's use our +//// // // resources to make this nice and smooth, even when running in the background. +//// // Repaint(); + +//// // //animator.UpdateAnimations(Time.deltaTime); +//// //} + +//// public override void Cleanup() +//// { +//// base.Cleanup(); +//// if (targetObject != null) Object.DestroyImmediate(targetObject); +//// if (previewUtility != null) previewUtility.Cleanup(); +//// } + +//// public override void OnPreviewGUI(Rect r, GUIStyle background) +//// { +//// Debug.Log("CALLELELE"); +//// if (!animator.Preqweqw) +//// { +//// if (animator.Tags.Count == 0) +//// { +//// if (!animator.Tags.TryAdd(new TMPEffectTag("preview", TMPAnimator.ANIMATION_PREFIX, new Dictionary()), new TMPEffectTagIndices(0, -1, 0))) +//// Debug.LogError("COULDNT ADD TAG??"); +//// else Debug.LogWarning("ADDED!!!"); +//// } + +//// animator.StartPreviewPublic(); +//// } +//// ////Rect rect = new Rect(0, 0, base.position.width, base.position.height); +//// Rect rect = r; +//// previewUtility.BeginPreview(rect, previewBackground: GUIStyle.none); +//// previewUtility.Render(); +//// var texture = previewUtility.EndPreview(); +//// GUI.DrawTexture(rect, texture); + +//// EditorApplication.QueuePlayerLoopUpdate(); +//// } +////} \ No newline at end of file diff --git a/Package/Editor/TMPAnimationPreview.cs.meta b/Package/Editor/TMPAnimationPreview.cs.meta new file mode 100644 index 0000000..706e051 --- /dev/null +++ b/Package/Editor/TMPAnimationPreview.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9404feb98d4946f40b48c18c27966789 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/TMPEffects.Editor.asmdef b/Package/Editor/TMPEffects.Editor.asmdef index 8625419..e84e276 100644 --- a/Package/Editor/TMPEffects.Editor.asmdef +++ b/Package/Editor/TMPEffects.Editor.asmdef @@ -17,6 +17,12 @@ "precompiledReferences": [], "autoReferenced": false, "defineConstraints": [], - "versionDefines": [], + "versionDefines": [ + { + "name": "com.unity.timeline", + "expression": "1.4.8", + "define": "TIMELINE_INSTALLED" + } + ], "noEngineReferences": false } \ No newline at end of file diff --git a/Package/Editor/Timeline.meta b/Package/Editor/Timeline.meta new file mode 100644 index 0000000..17ac881 --- /dev/null +++ b/Package/Editor/Timeline.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 61814318172d418499cdc2f87935630b +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/Timeline/KeyFrameEditorWindow.cs b/Package/Editor/Timeline/KeyFrameEditorWindow.cs new file mode 100644 index 0000000..a980b28 --- /dev/null +++ b/Package/Editor/Timeline/KeyFrameEditorWindow.cs @@ -0,0 +1,1093 @@ +// using System; +// using System.Collections; +// using System.Collections.Generic; +// using System.Linq; +// using TMPEffects.CharacterData; +// using TMPEffects.Components; +// using TMPEffects.Components.Animator; +// using TMPEffects.TMPAnimations; +// using TMPEffects.TMPSceneAnimations; +// using TMPro; +// using UnityEditor; +// using UnityEngine; +// using UnityEngine.Rendering; +// using AnimationUtility = TMPEffects.TMPAnimations.AnimationUtility; +// using Object = UnityEngine.Object; +// +// namespace TMPEffects.Editor.Timeline +// { +// public class KeyFrameEditorWindow : EditorWindow +// { +// protected PreviewRenderUtility previewUtility; +// protected Camera previewCamera; +// protected GameObject targetObject; +// protected TMP_Text targetText; +// protected TMPAnimator animator; +// protected float lastUpdateTime = -1f; +// +// protected char previewChar = 'A'; +// +// private TMPMeshModifiers modifier; +// +// private WrapAnimation anim; +// +// private SmthThatAppliesModifiers applier; +// +// private GameObject shadowObject; +// private TMP_Text shadowText; +// +// private Rect vertexWindowRect; +// private Rect characterWindowRect; +// +// private string vertexWindowTitle = ""; +// private string characterWindowTitle = "Character"; +// +// private bool visualsFoldout; +// +// private bool shadowFoldout; +// private bool showCharacterShadow; +// private bool showMeshShadow; +// +// private Color meshShadowColor; +// private Color characterShadowColor; +// +// private Color meshColor = Color.white; +// +// [Flags] +// private enum Selection +// { +// BL, +// TL, +// TR, +// BR, +// Character +// } +// +// private Selection selection; +// +// private int blID, tlID, trID, brID; +// +// #region Init +// +// private void OnEnable() +// { +// Debug.Log("KeyFrameEditorWindow OnEnable"); +// previewUtility = new PreviewRenderUtility(true, true); +// vertexWindowRect = new Rect(position.x, position.y, 250, 350); +// characterWindowRect = new Rect(position.x, position.y, 250, 350); +// +// SetupPreviewScene(); +// wantsMouseMove = true; +// } +// +// protected void SetupPreviewScene() +// { +// targetObject = SetupTargetObject(); +// targetText = SetupTargetText(targetObject); +// animator = SetupAnimator(targetObject); +// anim = SetupAnimation(targetObject, animator); +// shadowObject = SetupShadow(targetObject); +// shadowText = shadowObject.GetComponent(); +// +// previewUtility.AddSingleGO(targetObject); +// previewUtility.camera.transform.position = new Vector3(0f, 0f, -10f); +// previewUtility.camera.nearClipPlane = 0.1f; +// previewUtility.camera.farClipPlane = 1000f; +// previewCamera = previewUtility.camera; +// } +// +// private GameObject SetupTargetObject() +// { +// var targetObject = EditorUtility.CreateGameObjectWithHideFlags("Test " + UnityEngine.Random.Range(0, 100), +// HideFlags.HideAndDontSave); +// +// targetObject.transform.position = Vector3.zero; +// return targetObject; +// } +// +// private TMP_Text SetupTargetText(GameObject targetObject) +// { +// var targetText = targetObject.AddComponent(); +// targetText.gameObject.AddComponent(); +// +// targetText.alignment = TextAlignmentOptions.Center; +// targetText.horizontalAlignment = HorizontalAlignmentOptions.Center; +// targetText.text = "" + previewChar.ToString(); +// targetText.fontSize = 15; +// targetText.overflowMode = TextOverflowModes.Overflow; +// targetText.alignment = TextAlignmentOptions.Center; +// targetText.verticalAlignment = VerticalAlignmentOptions.Middle; +// targetText.enableWordWrapping = false; +// targetText.raycastTarget = true; +// +// return targetText; +// } +// +// private TMPAnimator SetupAnimator(GameObject targetObject) +// { +// var animator = targetObject.AddComponent(); +// animator.enabled = true; +// animator.SetUpdateFrom(TMPEffects.Components.Animator.UpdateFrom.Script); +// return animator; +// } +// +// private WrapAnimation SetupAnimation(GameObject targetObject, TMPAnimator animator) +// { +// var sceneAnimationGO = EditorUtility.CreateGameObjectWithHideFlags("Anim", HideFlags.HideAndDontSave); +// var anim = sceneAnimationGO.AddComponent(); +// +// anim.Modifier = new TMPMeshModifiers(); +// modifier = anim.Modifier; +// anim.Applier = new SmthThatAppliesModifiers(); +// applier = anim.Applier; +// +// sceneAnimationGO.transform.SetParent(targetObject.transform); +// if (!animator.SceneAnimations.TryAdd("animation", anim)) +// { +// throw new Exception("Failed to add scene animation"); +// } +// +// return anim; +// } +// +// private GameObject SetupShadow(GameObject targetObject) +// { +// var shadow = SetupTargetObject(); +// var shadowText = SetupTargetText(shadow); +// shadow.name = "Shadow"; +// shadowText.text = "A"; // TODO ugly +// +// shadow.transform.SetParent(targetObject.transform, true); +// shadow.transform.position = Vector3.zero; +// shadowText.color = characterShadowColor; +// +// shadowText.GetComponent().sortingOrder = -1; +// +// return shadow; +// } +// +// private void OnDisable() +// { +// if (targetObject != null) +// { +// try +// { +// Object.DestroyImmediate(targetObject); +// } +// catch +// { +// Debug.LogError("Failed to dispose targetObject correctly"); +// } +// } +// +// if (previewUtility != null) previewUtility.Cleanup(); +// } +// +// #endregion +// +// private void HandleVisualSettings() +// { +// visualsFoldout = EditorGUILayout.Foldout(visualsFoldout, "Visual Settings"); +// if (!visualsFoldout) return; +// +// EditorGUI.indentLevel++; +// HandleMesh(); +// HandleShadow(); +// HandleGrid(); +// EditorGUI.indentLevel--; +// } +// +// private void HandleMesh() +// { +// EditorGUI.indentLevel++; +// meshColor = EditorGUILayout.ColorField(new GUIContent("Mesh Color"), meshColor, GUILayout.Width(240)); +// EditorGUI.indentLevel--; +// } +// +// private void HandleShadow() +// { +// shadowFoldout = EditorGUILayout.Foldout(shadowFoldout, "Shadow"); +// if (shadowFoldout) +// { +// EditorGUI.indentLevel++; +// +// EditorGUILayout.BeginHorizontal(GUILayout.Width(240)); +// +// EditorGUI.BeginChangeCheck(); +// showCharacterShadow = +// EditorGUILayout.Toggle(new GUIContent("Show shadow"), showCharacterShadow, GUILayout.Width(135)); +// if (EditorGUI.EndChangeCheck()) +// { +// shadowObject.SetActive(showCharacterShadow); +// if (showCharacterShadow) +// { +// shadowText.color = characterShadowColor; +// shadowText.ForceMeshUpdate(true, true); +// } +// } +// +// EditorGUI.BeginChangeCheck(); +// characterShadowColor = EditorGUILayout.ColorField(characterShadowColor, GUILayout.Width(100)); +// if (EditorGUI.EndChangeCheck()) +// { +// shadowText.color = characterShadowColor; +// shadowText.ForceMeshUpdate(true, true); +// } +// +// EditorGUILayout.EndHorizontal(); +// +// EditorGUILayout.BeginHorizontal(GUILayout.Width(240)); +// showMeshShadow = +// EditorGUILayout.Toggle(new GUIContent("Show Mesh Shadow"), showMeshShadow, GUILayout.Width(135)); +// meshShadowColor = EditorGUILayout.ColorField(meshShadowColor, GUILayout.Width(100)); +// EditorGUILayout.EndHorizontal(); +// +// EditorGUI.indentLevel--; +// } +// } +// +// private float gridSize = 0.25f; +// private bool enableGrid = false; +// private bool gridFoldout = false; +// +// private void HandleGrid() +// { +// gridFoldout = EditorGUILayout.Foldout(gridFoldout, new GUIContent("Grid")); +// if (gridFoldout) +// { +// EditorGUI.indentLevel++; +// enableGrid = EditorGUILayout.Toggle(new GUIContent("Enable Grid"), enableGrid, GUILayout.Width(100)); +// +// EditorGUILayout.LabelField(new GUIContent("Grid Size")); +// gridSize = EditorGUILayout.Slider(GUIContent.none, gridSize, 0.01f, 1f, +// GUILayout.Width(240)); +// +// +// EditorGUI.indentLevel--; +// } +// } +// +// private void HandleWindows() +// { +// BeginWindows(); +// characterWindowRect = +// GUI.Window(GUIUtility.GetControlID(FocusType.Passive), characterWindowRect, OnCharacterWindowGUI, +// "Character"); +// +// if (selectedID.HasValue) +// { +// vertexWindowRect = +// GUI.Window(selectedID.Value, vertexWindowRect, OnVertexWindowGUI, +// vertexWindowTitle); +// } +// +// EndWindows(); +// } +// +// private int? selectedID; +// +// private void HandleSelection() +// { +// var hotControl = EditorGUIUtility.hotControl; +// +// if (hotControl == blID) +// { +// selectedID = blID; +// vertexWindowTitle = "Vertex BL"; +// } +// else if (hotControl == tlID) +// { +// selectedID = tlID; +// vertexWindowTitle = "Vertex TL"; +// } +// else if (hotControl == trID) +// { +// selectedID = trID; +// vertexWindowTitle = "Vertex TR"; +// } +// else if (hotControl == brID) +// { +// selectedID = brID; +// vertexWindowTitle = "Vertex BR"; +// } +// } +// +// private void OnGUI() +// { +// blID = GUIUtility.GetControlID(FocusType.Passive); +// tlID = GUIUtility.GetControlID(FocusType.Passive); +// trID = GUIUtility.GetControlID(FocusType.Passive); +// brID = GUIUtility.GetControlID(FocusType.Passive); +// +// HandleSelection(); +// +// UpdateAnimation(); +// +// DrawPreview(new Rect(0, 0, position.width, position.height)); +// +// Handles.DrawAAPolyLine(2f, new Color[] { Color.red, Color.red }, +// new Vector3[] { position.center, (Vector3)position.center + new Vector3(0f, -position.height) }); +// +// if (GUILayout.Button("Reset character")) +// { +// targetText.transform.position = Vector3.zero; +// targetText.transform.localScale = Vector3.one; +// targetText.transform.rotation = Quaternion.Euler(0f, 0f, 0f); +// +// modifier = new TMPMeshModifiers(); +// anim.Modifier = modifier; +// applier = +// new SmthThatAppliesModifiers(); // To make sure changes show instantly and not when moving again +// anim.Applier = applier; +// UpdateAnimation(); +// } +// +// HandleVisualSettings(); +// HandleWindows(); +// } +// +// #region Hover Windows +// +// private void OnVertexWindowGUI(int id) +// { +// (var bl, var tl, var tr, var br) = +// applier.CalculateVertexPositions( +// new CharData(0, targetText.textInfo.characterInfo[0], 0), modifier); +// +// if (id == blID) +// { +// modifier.BL_Delta += EditorGUILayout.Vector3Field("Position", bl) - bl; +// modifier.BL_Delta = +// EditorGUILayout.Vector3Field("Offset from original position", modifier.BL_Delta); +// +// EditorGUILayout.BeginHorizontal(); +// EditorGUILayout.LabelField("Color", GUILayout.Width(EditorGUIUtility.labelWidth)); +// +// if (EditorGUILayout.Toggle(modifier.BL_Color.HasValue)) +// { +// EditorGUILayout.EndHorizontal(); +// if (!modifier.BL_Color.HasValue) +// modifier.BL_Color.Value = Color.white; +// +// Color c = modifier.BL_Color.Value; +// +// modifier.BL_Color.Value = EditorGUILayout.ColorField("Color", c); +// } +// else +// { +// modifier.BL_Color = null; +// EditorGUILayout.EndHorizontal(); +// } +// } +// else if (id == tlID) +// { +// modifier.TL_Delta += EditorGUILayout.Vector3Field("Position", tl) - tl; +// modifier.TL_Delta = +// EditorGUILayout.Vector3Field("Offset from original position", modifier.TL_Delta); +// +// EditorGUILayout.BeginHorizontal(); +// EditorGUILayout.LabelField("Color", GUILayout.Width(EditorGUIUtility.labelWidth)); +// if (EditorGUILayout.Toggle(modifier.TL_Color.HasValue)) +// { +// EditorGUILayout.EndHorizontal(); +// if (!modifier.TL_Color.HasValue) +// modifier.TL_Color.Value = Color.white; +// +// Color c = modifier.TL_Color.Value; +// +// modifier.TL_Color.Value = EditorGUILayout.ColorField("Color", c); +// } +// else +// { +// modifier.TL_Color = null; +// EditorGUILayout.EndHorizontal(); +// } +// } +// else if (id == trID) +// { +// modifier.TR_Delta += EditorGUILayout.Vector3Field("Position", tr) - tr; +// modifier.TR_Delta = +// EditorGUILayout.Vector3Field("Offset from original position", modifier.TR_Delta); +// +// EditorGUILayout.BeginHorizontal(); +// EditorGUILayout.LabelField("Color", GUILayout.Width(EditorGUIUtility.labelWidth)); +// if (EditorGUILayout.Toggle(modifier.TR_Color.HasValue)) +// { +// EditorGUILayout.EndHorizontal(); +// if (!modifier.TR_Color.HasValue) +// modifier.TR_Color.Value = Color.white; +// +// Color c = modifier.TR_Color.Value; +// +// modifier.TR_Color.Value = EditorGUILayout.ColorField("Color", c); +// } +// else +// { +// modifier.TR_Color = null; +// EditorGUILayout.EndHorizontal(); +// } +// } +// else if (id == brID) +// { +// modifier.BR_Delta += EditorGUILayout.Vector3Field("Position", br) - br; +// modifier.BR_Delta = +// EditorGUILayout.Vector3Field("Offset from original position", modifier.BR_Delta); +// +// EditorGUILayout.BeginHorizontal(); +// EditorGUILayout.LabelField("Color", GUILayout.Width(EditorGUIUtility.labelWidth)); +// if (EditorGUILayout.Toggle(modifier.BR_Color.HasValue)) +// { +// EditorGUILayout.EndHorizontal(); +// if (!modifier.BR_Color.HasValue) +// modifier.BR_Color.Value = Color.white; +// +// Color c = modifier.BR_Color.Value; +// +// modifier.BR_Color.Value = EditorGUILayout.ColorField("Color", c); +// } +// else +// { +// modifier.BR_Color = null; +// EditorGUILayout.EndHorizontal(); +// } +// } +// else EditorGUILayout.LabelField("Aint shit here; BL is " + blID + " selected is " + selectedID); +// +// +// GUI.DragWindow(); +// } +// +// private void OnCharacterWindowGUI(int id) +// { +// // modifier.PositionDelta += EditorGUILayout.Vector3Field("Position", modifier.PositionDelta) - modifier.PositionDelta; +// modifier.PositionDelta = +// EditorGUILayout.Vector3Field("Position", modifier.PositionDelta); +// +// // TODO inspector rotation broken +// Vector3 angles = modifier.RotationDelta.eulerAngles; +// angles = +// EditorGUILayout.Vector3Field("Rotation", angles); +// modifier.RotationDelta = Quaternion.Euler(angles); +// +// Vector3 scale = modifier.ScaleDelta.MultiplyPoint3x4(Vector3.one); +// scale = +// EditorGUILayout.Vector3Field("Scale", scale); +// modifier.ScaleDelta = Matrix4x4.Scale(scale); +// +// GUI.DragWindow(); +// } +// +// #endregion +// +// private void UpdateAnimation() +// { +// animator.UpdateAnimations(lastUpdateTime == -1f ? 0f : Time.time - lastUpdateTime); +// lastUpdateTime = Time.time; +// } +// +// // todo provisory name +// private void PreviewHandles() +// { +// // Get vertex positions +// (var bl, var tl, var tr, var br) = +// applier.CalculateVertexPositions( +// new CharData(0, targetText.textInfo.characterInfo[0], 0), modifier); +// +// Handles.zTest = CompareFunction.Less; +// +// // Draw shadow +// if (showMeshShadow) +// { +// CharData charData = new CharData(0, targetText.textInfo.characterInfo[0], 0); +// Handles.DrawAAPolyLine( +// new Color[] { meshShadowColor, meshShadowColor, meshShadowColor, meshShadowColor, meshShadowColor }, +// new Vector3[] +// { +// charData.initialMesh.GetPosition(0), charData.initialMesh.GetPosition(1), +// charData.initialMesh.GetPosition(2), charData.initialMesh.GetPosition(3), +// charData.initialMesh.GetPosition(0), +// } +// ); +// +// Handles.color = meshShadowColor; +// Handles.SphereHandleCap(0, charData.initialMesh.GetPosition(0), Quaternion.identity, 0.04f, +// EventType.Repaint); +// Handles.SphereHandleCap(0, charData.initialMesh.GetPosition(1), Quaternion.identity, 0.04f, +// EventType.Repaint); +// Handles.SphereHandleCap(0, charData.initialMesh.GetPosition(2), Quaternion.identity, 0.04f, +// EventType.Repaint); +// Handles.SphereHandleCap(0, charData.initialMesh.GetPosition(3), Quaternion.identity, 0.04f, +// EventType.Repaint); +// } +// +// Handles.zTest = CompareFunction.Always; +// // Character tools handle +// switch (Tools.current) +// { +// case Tool.Move: +// modifier.PositionDelta = Handles.PositionHandle(Handles.PositionHandleIds.@default, +// targetText.transform.position + modifier.PositionDelta, +// Quaternion.identity) - +// targetText.transform.position; +// break; +// +// case Tool.Scale: +// var vec = modifier.ScaleDelta.MultiplyPoint3x4(Vector3.one); +// vec = Handles.ScaleHandle(vec, modifier.PositionDelta + targetText.transform.position, +// Quaternion.identity); +// modifier.ScaleDelta = Matrix4x4.Scale(vec); +// break; +// +// case Tool.Rotate: +// modifier.RotationDelta = Handles.RotationHandle(modifier.RotationDelta, +// targetText.transform.position + modifier.PositionDelta); +// break; +// } +// +// // Vertex handles +// Handles.color = meshColor; +// modifier.BL_Delta += +// Handles.FreeMoveHandle(blID, bl, 0.04f, Vector3.zero, +// Handles.SphereHandleCap) - bl; +// modifier.TL_Delta += +// Handles.FreeMoveHandle(tlID, tl, 0.04f, Vector3.zero, +// Handles.SphereHandleCap) - tl; +// modifier.TR_Delta += +// Handles.FreeMoveHandle(trID, tr, 0.04f, Vector3.zero, +// Handles.SphereHandleCap) - tr; +// modifier.BR_Delta += +// Handles.FreeMoveHandle(brID, br, 0.04f, Vector3.zero, +// Handles.SphereHandleCap) - br; +// +// // Background lines +// Handles.DrawAAPolyLine( +// new Color[] { meshColor, meshColor, meshColor, meshColor, meshColor }, +// new Vector3[] { bl, tl, tr, br, bl } +// ); +// } +// +// public void DrawPreview(Rect previewArea) +// { +// previewUtility.BeginPreview(previewArea, previewBackground: GUIStyle.none); +// previewUtility.camera.Render(); +// +// using (new Handles.DrawingScope(Matrix4x4.identity)) +// { +// Handles.SetCamera(previewUtility.camera); +// PreviewHandles(); +// } +// +// previewUtility.EndAndDrawPreview(previewArea); +// } +// +// [MenuItem("TMPEffects/Editor/KeyFrameEditorWindow")] +// public static void ShowWindow() +// { +// KeyFrameEditorWindow window = GetWindow(); +// window.titleContent = new GUIContent("TMPEffects Keyframe Editor"); +// } +// +// private class WrapAnimation : TMPSceneAnimation +// { +// public TMPMeshModifiers Modifier; +// public SmthThatAppliesModifiers Applier; +// +// public override void Animate(CharData cData, IAnimationContext context) +// { +// (var bl, var tl, var tr, var br) = +// Applier.CalculateVertexPositions(cData, Modifier); +// +// cData.mesh.SetPosition(0, AnimationUtility.GetRawVertex(0, bl, cData, context)); +// cData.mesh.SetPosition(1, AnimationUtility.GetRawVertex(1, tl, cData, context)); +// cData.mesh.SetPosition(2, AnimationUtility.GetRawVertex(2, tr, cData, context)); +// cData.mesh.SetPosition(3, AnimationUtility.GetRawVertex(3, br, cData, context)); +// +// (var blC, var tlC, var trC, var brC) = +// Applier.CalculateVertexColors(cData, Modifier); +// +// cData.mesh.SetColor(0, blC); +// cData.mesh.SetColor(1, tlC); +// cData.mesh.SetColor(2, trC); +// cData.mesh.SetColor(3, brC); +// } +// +// public override bool ValidateParameters(IDictionary parameters) +// { +// return true; +// } +// +// public override object GetNewCustomData() +// { +// return null; +// } +// +// public override void SetParameters(object customData, IDictionary parameters) +// { +// } +// } +// } +// } +// +// +// /* +// * +// *using System; +// using System.Collections; +// using System.Collections.Generic; +// using System.Linq; +// using TMPEffects.CharacterData; +// using TMPEffects.Components; +// using TMPEffects.Components.Animator; +// using TMPEffects.TMPAnimations; +// using TMPEffects.TMPSceneAnimations; +// using TMPro; +// using UnityEditor; +// using UnityEngine; +// using UnityEngine.TextCore.Text; +// using UnityEngine.UIElements; +// using AnimationUtility = TMPEffects.TMPAnimations.AnimationUtility; +// using Object = UnityEngine.Object; +// +// namespace TMPEffects.Editor.Timeline +// { +// public class KeyFrameEditorWindow : EditorWindow +// { +// protected PreviewRenderUtility previewUtility; +// protected Camera previewCamera; +// protected GameObject targetObject; +// protected TMP_Text targetText; +// protected TMPAnimator animator; +// protected float lastUpdateTime = -1f; +// +// protected char previewChar = 'A'; +// +// private TMPMeshModifiers modifier; +// +// private WrapAnimation anim; +// +// private SmthThatAppliesModifiers applier; +// +// private GameObject shadowObject; +// private TMP_Text shadowText; +// +// private Rect vertexWindowRect; +// private Rect characterWindowRect; +// +// private bool shadowFoldout; +// private bool showCharacterShadow; +// private bool showMeshShadow; +// +// private Color meshShadowColor; +// private Color characterShadowColor; +// +// [Flags] +// private enum Selection +// { +// BL, +// TL, +// TR, +// BR, +// Character +// } +// +// private Selection selection; +// +// #region Init +// +// private void OnEnable() +// { +// Debug.Log("KeyFrameEditorWindow OnEnable"); +// previewUtility = new PreviewRenderUtility(); +// vertexWindowRect = new Rect(position.x, position.y, 250, 350); +// characterWindowRect = new Rect(position.x, position.y, 250, 350); +// +// SetupPreviewScene(); +// wantsMouseMove = true; +// } +// +// protected void SetupPreviewScene() +// { +// targetObject = SetupTargetObject(); +// targetText = SetupTargetText(targetObject); +// animator = SetupAnimator(targetObject); +// anim = SetupAnimation(targetObject, animator); +// shadowObject = SetupShadow(targetObject); +// shadowText = shadowObject.GetComponent(); +// +// previewUtility.AddSingleGO(targetObject); +// previewUtility.camera.transform.position = new Vector3(0f, 0f, -10f); +// previewUtility.camera.nearClipPlane = 0.1f; +// previewUtility.camera.farClipPlane = 1000f; +// previewCamera = previewUtility.camera; +// } +// +// private GameObject SetupTargetObject() +// { +// var targetObject = EditorUtility.CreateGameObjectWithHideFlags("Test " + UnityEngine.Random.Range(0, 100), +// HideFlags.HideAndDontSave); +// +// targetObject.transform.position = Vector3.zero; +// return targetObject; +// } +// +// private TMP_Text SetupTargetText(GameObject targetObject) +// { +// var targetText = targetObject.AddComponent(); +// targetText.gameObject.AddComponent(); +// +// targetText.alignment = TextAlignmentOptions.Center; +// targetText.horizontalAlignment = HorizontalAlignmentOptions.Center; +// targetText.text = "" + previewChar.ToString(); +// targetText.fontSize = 15; +// targetText.overflowMode = TextOverflowModes.Overflow; +// targetText.alignment = TextAlignmentOptions.Center; +// targetText.verticalAlignment = VerticalAlignmentOptions.Middle; +// targetText.enableWordWrapping = false; +// targetText.raycastTarget = true; +// +// return targetText; +// } +// +// private TMPAnimator SetupAnimator(GameObject targetObject) +// { +// var animator = targetObject.AddComponent(); +// animator.enabled = true; +// animator.SetUpdateFrom(TMPEffects.Components.Animator.UpdateFrom.Script); +// return animator; +// } +// +// private WrapAnimation SetupAnimation(GameObject targetObject, TMPAnimator animator) +// { +// var sceneAnimationGO = EditorUtility.CreateGameObjectWithHideFlags("Anim", HideFlags.HideAndDontSave); +// var anim = sceneAnimationGO.AddComponent(); +// +// anim.Modifier = new TMPMeshModifiers(); +// modifier = anim.Modifier; +// anim.Applier = new SmthThatAppliesModifiers(); +// applier = anim.Applier; +// +// sceneAnimationGO.transform.SetParent(targetObject.transform); +// if (!animator.SceneAnimations.TryAdd("animation", anim)) +// { +// throw new Exception("Failed to add scene animation"); +// } +// +// return anim; +// } +// +// private GameObject SetupShadow(GameObject targetObject) +// { +// var shadow = SetupTargetObject(); +// var shadowText = SetupTargetText(shadow); +// shadow.name = "Shadow"; +// shadowText.text = "A"; // TODO ugly +// +// shadow.transform.SetParent(targetObject.transform, true); +// shadow.transform.position = Vector3.zero; +// shadowText.color = characterShadowColor; +// +// shadowText.GetComponent().sortingOrder = -1; +// +// return shadow; +// } +// +// private void OnDisable() +// { +// if (targetObject != null) +// { +// try +// { +// Object.DestroyImmediate(targetObject); +// } +// catch +// { +// Debug.LogError("Failed to dispose targetObject correctly"); +// } +// } +// +// if (previewUtility != null) previewUtility.Cleanup(); +// } +// +// #endregion +// +// private void HandleShadow() +// { +// shadowFoldout = EditorGUILayout.Foldout(shadowFoldout, "Shadow"); +// if (shadowFoldout) +// { +// GUILayout.BeginHorizontal(GUIContent.none, GUIStyle.none, GUILayout.Width(240)); +// +// EditorGUI.BeginChangeCheck(); +// showCharacterShadow = +// GUILayout.Toggle(showCharacterShadow, new GUIContent("Show shadow"), GUILayout.Width(135)); +// if (EditorGUI.EndChangeCheck()) +// { +// shadowObject.SetActive(showCharacterShadow); +// if (showCharacterShadow) +// { +// shadowText.color = characterShadowColor; +// shadowText.ForceMeshUpdate(true, true); +// } +// } +// +// EditorGUI.BeginChangeCheck(); +// characterShadowColor = EditorGUILayout.ColorField(characterShadowColor, GUILayout.Width(100)); +// if (EditorGUI.EndChangeCheck()) +// { +// shadowText.color = characterShadowColor; +// shadowText.ForceMeshUpdate(true, true); +// } +// GUILayout.EndHorizontal(); +// +// GUILayout.BeginHorizontal(GUIContent.none, GUIStyle.none, GUILayout.Width(240)); +// showMeshShadow = +// GUILayout.Toggle(showMeshShadow, new GUIContent("Show Mesh Shadow"), GUILayout.Width(135)); +// meshShadowColor = EditorGUILayout.ColorField(meshShadowColor, GUILayout.Width(100)); +// GUILayout.EndHorizontal(); +// } +// } +// +// private void HandleWindows() +// { +// BeginWindows(); +// characterWindowRect = +// GUI.Window(GUIUtility.GetControlID(FocusType.Passive), characterWindowRect, OnCharacterWindowGUI, +// "Character"); +// vertexWindowRect = +// GUI.Window(GUIUtility.GetControlID(FocusType.Passive), vertexWindowRect, OnVertexWindowGUI, "MyWindow"); +// EndWindows(); +// } +// +// private void OnGUI() +// { +// Debug.Log("Targetobj pos: " + targetObject.transform.position + " : Shadowobj pos: " + shadowObject.transform.position); +// +// UpdateAnimation(); +// DrawPreview(new Rect(0, 0, position.width, position.height)); +// +// if (GUILayout.Button("Reset character")) +// { +// targetText.transform.position = Vector3.zero; +// targetText.transform.localScale = Vector3.one; +// targetText.transform.rotation = Quaternion.Euler(0f, 0f, 0f); +// +// modifier = new TMPMeshModifiers(); +// anim.Modifier = modifier; +// applier = +// new SmthThatAppliesModifiers(); // To make sure changes show instantly and not when moving again +// anim.Applier = applier; +// UpdateAnimation(); +// } +// +// HandleShadow(); +// HandleWindows(); +// } +// +// #region Hover Windows +// +// private void OnVertexWindowGUI(int id) +// { +// (var bl, var tl, var tr, var br) = +// applier.CalculateVertexPositions( +// new CharData(0, targetText.textInfo.characterInfo[0], 0), modifier); +// +// modifier.BL_Delta += EditorGUILayout.Vector3Field("Position", bl) - bl; +// modifier.BL_Delta = +// EditorGUILayout.Vector3Field("Offset from original position", modifier.BL_Delta); +// +// EditorGUILayout.BeginHorizontal(); +// EditorGUILayout.LabelField("Color", GUILayout.Width(EditorGUIUtility.labelWidth)); +// if (EditorGUILayout.Toggle(modifier.BL_Color.HasValue)) +// { +// EditorGUILayout.EndHorizontal(); +// if (!modifier.BL_Color.HasValue) +// modifier.BL_Color = Color.white; +// +// Color c = modifier.BL_Color.Value; +// +// modifier.BL_Color = EditorGUILayout.ColorField("Color", c); +// } +// else +// { +// modifier.BL_Color = null; +// EditorGUILayout.EndHorizontal(); +// } +// +// GUI.DragWindow(); +// } +// +// private void OnCharacterWindowGUI(int id) +// { +// // modifier.PositionDelta += EditorGUILayout.Vector3Field("Position", modifier.PositionDelta) - modifier.PositionDelta; +// modifier.PositionDelta = +// EditorGUILayout.Vector3Field("Position", modifier.PositionDelta); +// +// // TODO inspector rotation broken +// Vector3 angles = modifier.RotationDelta.eulerAngles; +// angles = +// EditorGUILayout.Vector3Field("Rotation", angles); +// modifier.RotationDelta = Quaternion.Euler(angles); +// +// Vector3 scale = modifier.ScaleDelta.MultiplyPoint3x4(Vector3.one); +// scale = +// EditorGUILayout.Vector3Field("Scale", scale); +// modifier.ScaleDelta = Matrix4x4.Scale(scale); +// +// GUI.DragWindow(); +// } +// +// #endregion +// +// private void UpdateAnimation() +// { +// animator.UpdateAnimations(lastUpdateTime == -1f ? 0f : Time.time - lastUpdateTime); +// lastUpdateTime = Time.time; +// } +// +// // todo provisory name +// private void PreviewHandles() +// { +// // Get vertex positions +// (var bl, var tl, var tr, var br) = +// applier.CalculateVertexPositions( +// new CharData(0, targetText.textInfo.characterInfo[0], 0), modifier); +// +// // Draw shadow +// if (showMeshShadow) +// { +// CharData charData = new CharData(0, targetText.textInfo.characterInfo[0], 0); +// Handles.DrawAAPolyLine( +// new Color[] { meshShadowColor, meshShadowColor, meshShadowColor, meshShadowColor, meshShadowColor }, +// new Vector3[] +// { +// charData.initialMesh.GetPosition(0), charData.initialMesh.GetPosition(1), +// charData.initialMesh.GetPosition(2), charData.initialMesh.GetPosition(3), +// charData.initialMesh.GetPosition(0), +// } +// ); +// +// Handles.color = meshShadowColor; +// Handles.SphereHandleCap(0, charData.initialMesh.GetPosition(0), Quaternion.identity, 0.04f, +// EventType.Repaint); +// Handles.SphereHandleCap(0, charData.initialMesh.GetPosition(1), Quaternion.identity, 0.04f, +// EventType.Repaint); +// Handles.SphereHandleCap(0, charData.initialMesh.GetPosition(2), Quaternion.identity, 0.04f, +// EventType.Repaint); +// Handles.SphereHandleCap(0, charData.initialMesh.GetPosition(3), Quaternion.identity, 0.04f, +// EventType.Repaint); +// } +// +// // Character tools handle +// switch (Tools.current) +// { +// case Tool.Move: +// modifier.PositionDelta = Handles.PositionHandle(Handles.PositionHandleIds.@default, +// targetText.transform.position + modifier.PositionDelta, +// Quaternion.identity) - +// targetText.transform.position; +// break; +// +// case Tool.Scale: +// var vec = modifier.ScaleDelta.MultiplyPoint3x4(Vector3.one); +// vec = Handles.ScaleHandle(vec, modifier.PositionDelta + targetText.transform.position, +// Quaternion.identity); +// modifier.ScaleDelta = Matrix4x4.Scale(vec); +// break; +// +// case Tool.Rotate: +// modifier.RotationDelta = Handles.RotationHandle(modifier.RotationDelta, +// targetText.transform.position + modifier.PositionDelta); +// break; +// } +// +// int blID = GUIUtility.GetControlID(FocusType.Passive); +// int tlID = GUIUtility.GetControlID(FocusType.Passive); +// int trID = GUIUtility.GetControlID(FocusType.Passive); +// int brID = GUIUtility.GetControlID(FocusType.Passive); +// +// // Vertex handles +// modifier.BL_Delta += +// Handles.FreeMoveHandle(blID, bl, 0.04f, Vector3.zero, +// Handles.SphereHandleCap) - bl; +// modifier.TL_Delta += +// Handles.FreeMoveHandle(tlID, tl, 0.04f, Vector3.zero, +// Handles.SphereHandleCap) - tl; +// modifier.TR_Delta += +// Handles.FreeMoveHandle(trID, tr, 0.04f, Vector3.zero, +// Handles.SphereHandleCap) - tr; +// modifier.BR_Delta += +// Handles.FreeMoveHandle(brID, br, 0.04f, Vector3.zero, +// Handles.SphereHandleCap) - br; +// +// // Background lines +// Handles.DrawAAPolyLine( +// new Color[] { Color.white, Color.white, Color.white, Color.white, Color.white, }, +// new Vector3[] { bl, tl, tr, br, bl } +// ); +// +// } +// +// public void DrawPreview(Rect previewArea) +// { +// previewUtility.BeginPreview(previewArea, previewBackground: GUIStyle.none); +// previewUtility.camera.Render(); +// +// using (new Handles.DrawingScope(Matrix4x4.identity)) +// { +// Handles.SetCamera(previewUtility.camera); +// PreviewHandles(); +// } +// +// previewUtility.EndAndDrawPreview(previewArea); +// } +// +// [MenuItem("TMPEffects/Editor/KeyFrameEditorWindow")] +// public static void ShowWindow() +// { +// KeyFrameEditorWindow window = GetWindow(); +// window.titleContent = new GUIContent("TMPEffects Keyframe Editor"); +// } +// +// private class WrapAnimation : TMPSceneAnimation +// { +// public TMPMeshModifiers Modifier; +// public SmthThatAppliesModifiers Applier; +// +// public override void Animate(CharData cData, IAnimationContext context) +// { +// (var bl, var tl, var tr, var br) = +// Applier.CalculateVertexPositions(cData, Modifier); +// +// cData.mesh.SetPosition(0, AnimationUtility.GetRawVertex(0, bl, cData, context)); +// cData.mesh.SetPosition(1, AnimationUtility.GetRawVertex(1, tl, cData, context)); +// cData.mesh.SetPosition(2, AnimationUtility.GetRawVertex(2, tr, cData, context)); +// cData.mesh.SetPosition(3, AnimationUtility.GetRawVertex(3, br, cData, context)); +// +// (var blC, var tlC, var trC, var brC) = +// Applier.CalculateVertexColors(cData, Modifier); +// +// cData.mesh.SetColor(0, blC); +// cData.mesh.SetColor(1, tlC); +// cData.mesh.SetColor(2, trC); +// cData.mesh.SetColor(3, brC); +// } +// +// public override bool ValidateParameters(IDictionary parameters) +// { +// return true; +// } +// +// public override object GetNewCustomData() +// { +// return null; +// } +// +// public override void SetParameters(object customData, IDictionary parameters) +// { +// } +// } +// } +// } +// * +// * +// */ \ No newline at end of file diff --git a/Package/Editor/Timeline/KeyFrameEditorWindow.cs.meta b/Package/Editor/Timeline/KeyFrameEditorWindow.cs.meta new file mode 100644 index 0000000..4f9cdbb --- /dev/null +++ b/Package/Editor/Timeline/KeyFrameEditorWindow.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4ce7e06c40bd9cc4bb7abe305437c3fd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/Timeline/StyleSheets.meta b/Package/Editor/Timeline/StyleSheets.meta new file mode 100644 index 0000000..b9e918f --- /dev/null +++ b/Package/Editor/Timeline/StyleSheets.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b3eef023c18d1d24da1c5ee56467594c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/Timeline/StyleSheets/Extensions.meta b/Package/Editor/Timeline/StyleSheets/Extensions.meta new file mode 100644 index 0000000..49b1d93 --- /dev/null +++ b/Package/Editor/Timeline/StyleSheets/Extensions.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 4800a09ca6be6bf479a1e0d1b9f68bdf +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/Timeline/StyleSheets/Extensions/common.uss b/Package/Editor/Timeline/StyleSheets/Extensions/common.uss new file mode 100644 index 0000000..b7f99a8 --- /dev/null +++ b/Package/Editor/Timeline/StyleSheets/Extensions/common.uss @@ -0,0 +1,110 @@ +TMPWriterMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/typewriter"); +} + +.TMPWriterMarkerStyle:checked +{ + width: 50px; + height: 20px; +} + +.TMPWriterMarkerStyle:hover:focus:checked +{ + width: 20px; + height: 50px; +} + + +TMPStartWriterMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/writer-play"); +} + +TMPStopWriterMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/writer-stop"); +} + +TMPRestartWriterMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/writer-restart"); +} + +TMPResetWriterMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/writer-reset"); +} + +TMPSkipWriterMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/writer-skip"); +} + +TMPWriterWaitMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/writer-wait"); +} + +TMPSetSkippableMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/writer-settings"); +} + +TMPStartAnimatingMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/animator-start"); +} + +TMPStopAnimatingMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/animator-stop"); +} + +TMPUpdateAnimationsMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/animator-updateonce"); +} + +TMPSettingsMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/animator-settings"); +} + +TMPResetAnimationsMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/animator-resetanimations"); +} + +TMPResetTimeMarkerStyle +{ + width: 30px; + height: 30px; + background-image: resource("MarkerIcons/animator-resetanimations"); +} \ No newline at end of file diff --git a/Package/Editor/Timeline/StyleSheets/Extensions/common.uss.meta b/Package/Editor/Timeline/StyleSheets/Extensions/common.uss.meta new file mode 100644 index 0000000..0daa16a --- /dev/null +++ b/Package/Editor/Timeline/StyleSheets/Extensions/common.uss.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c3aded84506ec484f997d1dc98db7670 +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} + disableValidation: 0 diff --git a/Package/Editor/Timeline/StyleSheets/Extensions/dark.uss b/Package/Editor/Timeline/StyleSheets/Extensions/dark.uss new file mode 100644 index 0000000..0c267c8 --- /dev/null +++ b/Package/Editor/Timeline/StyleSheets/Extensions/dark.uss @@ -0,0 +1,64 @@ +TMPWriterMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPStartWriterMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPStopWriterMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPRestartWriterMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPResetWriterMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPSkipWriterMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPWriterWaitMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPStartAnimatingMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPStopAnimatingMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPUpdateAnimationsMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPSettingsMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPResetAnimationsMarkerStyle +{ + color: rgb(0, 0, 0); +} + +TMPResetTimeMarkerStyle +{ + color: rgb(0, 0, 0); +} \ No newline at end of file diff --git a/Package/Editor/Timeline/StyleSheets/Extensions/dark.uss.meta b/Package/Editor/Timeline/StyleSheets/Extensions/dark.uss.meta new file mode 100644 index 0000000..982ec51 --- /dev/null +++ b/Package/Editor/Timeline/StyleSheets/Extensions/dark.uss.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 781d142ebb0597c44ae30b1e379842bf +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} + disableValidation: 0 diff --git a/Package/Editor/Timeline/StyleSheets/Extensions/light.uss b/Package/Editor/Timeline/StyleSheets/Extensions/light.uss new file mode 100644 index 0000000..fe1b8c1 --- /dev/null +++ b/Package/Editor/Timeline/StyleSheets/Extensions/light.uss @@ -0,0 +1,64 @@ +TMPWriterMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPStartWriterMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPStopWriterMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPRestartWriterMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPResetWriterMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPSkipWriterMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPWriterWaitMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPStartAnimatingMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPStopAnimatingMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPUpdateAnimationsMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPSettingsMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPResetAnimationsMarkerStyle +{ + color: rgb(255, 255, 255); +} + +TMPResetTimeMarkerStyle +{ + color: rgb(255, 255, 255); +} \ No newline at end of file diff --git a/Package/Editor/Timeline/StyleSheets/Extensions/light.uss.meta b/Package/Editor/Timeline/StyleSheets/Extensions/light.uss.meta new file mode 100644 index 0000000..aff3a3f --- /dev/null +++ b/Package/Editor/Timeline/StyleSheets/Extensions/light.uss.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 529b257e12c70c04d95ba52b2621ee1d +ScriptedImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 2 + userData: + assetBundleName: + assetBundleVariant: + script: {fileID: 12385, guid: 0000000000000000e000000000000000, type: 0} + disableValidation: 0 diff --git a/Package/Editor/Timeline/TMPAnimatorMarkerEditor.cs b/Package/Editor/Timeline/TMPAnimatorMarkerEditor.cs new file mode 100644 index 0000000..f0eeb74 --- /dev/null +++ b/Package/Editor/Timeline/TMPAnimatorMarkerEditor.cs @@ -0,0 +1,74 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEditor.Timeline; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomTimelineEditor(typeof(TMPStartAnimatingMarker))] +public class TMPStartAnimatingMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Start Animating"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPStopAnimatingMarker))] +public class TMPStopAnimatingMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Stop Animating"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPUpdateAnimationsMarker))] +public class TMPUpdateAnimationsMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + var mark = marker as TMPUpdateAnimationsMarker; + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Update Animations (" + mark.DeltaTime + ")"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPResetAnimationsMarker))] +public class TMPResetAnimationsMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Reset Animations"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPResetTimeMarker))] +public class TMPResetTimeMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + var mark = marker as TMPResetTimeMarker; + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Reset Time (" + mark.Time + ")"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPSetUpdateFromMarker))] +public class TMPSetUpdateFromMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + var mark = marker as TMPSetUpdateFromMarker; + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Set UpdateFrom (" + mark.UpdateFrom + ")"; + return s; + } +} \ No newline at end of file diff --git a/Package/Editor/Timeline/TMPAnimatorMarkerEditor.cs.meta b/Package/Editor/Timeline/TMPAnimatorMarkerEditor.cs.meta new file mode 100644 index 0000000..1b8395b --- /dev/null +++ b/Package/Editor/Timeline/TMPAnimatorMarkerEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 113961d08707c5b44a76c4600798c9a7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/Timeline/TMPEffects.Timeline.Editor.asmdef b/Package/Editor/Timeline/TMPEffects.Timeline.Editor.asmdef new file mode 100644 index 0000000..6d56f4b --- /dev/null +++ b/Package/Editor/Timeline/TMPEffects.Timeline.Editor.asmdef @@ -0,0 +1,31 @@ +{ + "name": "TMPEffects.Timeline.Editor", + "rootNamespace": "", + "references": [ + "GUID:96c64e576ede81e46ad482a315c680f9", + "GUID:2c6405daa630a0d46993e21d14b1fa30", + "GUID:f06555f75b070af458a003d92f9efb00", + "GUID:6055be8ebefd69e48b49212b09b47b2f", + "GUID:a86700a2afb0a6d4f8916928522caee6", + "GUID:02f771204943f4a40949438e873e3eff" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [ + "TIMELINE_INSTALLED" + ], + "versionDefines": [ + { + "name": "com.unity.timeline", + "expression": "1.4.8", + "define": "TIMELINE_INSTALLED" + } + ], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Package/Editor/Timeline/TMPEffects.Timeline.Editor.asmdef.meta b/Package/Editor/Timeline/TMPEffects.Timeline.Editor.asmdef.meta new file mode 100644 index 0000000..1206985 --- /dev/null +++ b/Package/Editor/Timeline/TMPEffects.Timeline.Editor.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 17895070d030d514aa273fb6161b7ec7 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/Timeline/TMPMeshModifierClipEditor.cs b/Package/Editor/Timeline/TMPMeshModifierClipEditor.cs new file mode 100644 index 0000000..0c46b53 --- /dev/null +++ b/Package/Editor/Timeline/TMPMeshModifierClipEditor.cs @@ -0,0 +1,115 @@ +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using UnityEditor; +using UnityEditor.Timeline; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +internal static class TMPEffectsTimelineEditorPrefsKeys +{ + internal const string DRAW_CURVES_EDITORPREFS_KEY = "TMPEffects.Timeline.DrawCurves.EditorPrefs"; +} + +[CustomTimelineEditor(typeof(TMPMeshModifierClip))] +public class TMPMeshModifierClipEditor : ClipEditor +{ + public override void OnClipChanged(TimelineClip clip) + { + var mClip = clip.asset as TMPMeshModifierClip; + mClip.Step.Step.duration = (float)clip.duration; + mClip.name = clip.displayName; + + if (mClip.Step.lastMovedEntry == 0) + { + mClip.Step.Step.entryDuration = Mathf.Clamp(mClip.Step.Step.entryDuration, 0f, (float)clip.duration); + mClip.Step.Step.exitDuration = Mathf.Clamp(mClip.Step.Step.exitDuration, 0f, + (float)clip.duration - mClip.Step.Step.entryDuration); + } + else + { + mClip.Step.Step.exitDuration = Mathf.Clamp(mClip.Step.Step.exitDuration, 0f, (float)clip.duration); + mClip.Step.Step.entryDuration = Mathf.Clamp(mClip.Step.Step.entryDuration, 0f, + (float)clip.duration - mClip.Step.Step.exitDuration); + } + } + + public override void DrawBackground(TimelineClip clip, ClipBackgroundRegion region) + { + var mClip = clip.asset as TMPMeshModifierClip; + + float leftWidth, rightWidth; + + leftWidth = (mClip.Step.Step.entryDuration / (float)clip.duration) * region.position.width; + rightWidth = (mClip.Step.Step.exitDuration / (float)clip.duration) * region.position.width; + + var rect = region.position; + if (TimelineEditor.selectedClips.Contains(clip)) + { + rect.yMin += 1f; + rect.yMax -= 0f; + } + else + { + rect.yMin -= 0.75f; + rect.yMax += 2.5f; + } + + var inRect = new Rect(rect.x, rect.y, leftWidth, rect.height); + var outRect = new Rect(rect.x + rect.width - rightWidth, rect.y, rightWidth, rect.height); + + EditorGUI.DrawRect(inRect, new Color(0.2f, 0.6f, 1f, 0.3f)); + EditorGUI.DrawRect(outRect, new Color(0.2f, 0.6f, 1f, 0.3f)); + + var drawCurves = EditorPrefs.GetBool(TMPEffectsTimelineEditorPrefsKeys.DRAW_CURVES_EDITORPREFS_KEY); + if (drawCurves) + { + DrawBackgroundWithCurve(mClip.Step.Step.entryCurve.Curve, inRect, leftWidth, true); + DrawBackgroundWithCurve(mClip.Step.Step.exitCurve.Curve, outRect, rightWidth, false); + } + else + { + Handles.color = Color.black; + Handles.DrawAAPolyLine(new Vector3(inRect.xMin, inRect.yMax), new Vector3(inRect.xMax, inRect.yMin)); + Handles.DrawAAPolyLine(outRect.min, outRect.max); + } + } + + public override ClipDrawOptions GetClipOptions(TimelineClip clip) + { + return new ClipDrawOptions() + { + tooltip = "My tooltip :)", + hideScaleIndicator = true, + }; + } + + void DrawBackgroundWithCurve(AnimationCurve curve, Rect position, float width, bool blendin) + { + if (curve == null) + return; + if ((int)(width * 5) <= 3) + return; + + Rect rect = position; + Vector3[] points = new Vector3[(int)(width * 5)]; + points[0] = new Vector3(rect.xMin + width, rect.yMin, 0); + points[1] = new Vector3(rect.xMin + width, rect.yMax, 0); + points[2] = new Vector3(rect.xMin, rect.yMax, 0); + + for (int i = 0; i < points.Length - 3; i++) + { + float t = (float)i / (points.Length - 4); + + float x = Mathf.Lerp(rect.xMin, rect.xMin + width, t); + float y = rect.yMax - curve.Evaluate(blendin ? t : 1 - t) * rect.height; + points[i + 3] = new Vector3(x, y, 0); + } + + Handles.BeginGUI(); + Handles.color = Color.black; + Handles.DrawAAPolyLine(points); + Handles.EndGUI(); + } +} \ No newline at end of file diff --git a/Package/Editor/Timeline/TMPMeshModifierClipEditor.cs.meta b/Package/Editor/Timeline/TMPMeshModifierClipEditor.cs.meta new file mode 100644 index 0000000..6dd2bc7 --- /dev/null +++ b/Package/Editor/Timeline/TMPMeshModifierClipEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4d1e535751243f049b7b08d63687b6f2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/Timeline/TMPWriterClipDataDrawer.cs b/Package/Editor/Timeline/TMPWriterClipDataDrawer.cs new file mode 100644 index 0000000..bb1b899 --- /dev/null +++ b/Package/Editor/Timeline/TMPWriterClipDataDrawer.cs @@ -0,0 +1,80 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; +using TMPEffects.Components; +using TMPEffects.TMPAnimations; +using UnityEditor; +using UnityEditor.Timeline.Actions; +using UnityEngine; +using UnityEditor; +using UnityEngine; +using UnityEngine.UIElements; +using Object = UnityEngine.Object; + + +[MenuEntry("Unpack Generic Animation")] +public class UnpackGenericAnimation : TimelineAction +{ + public override bool Execute(ActionContext context) + { + bool result = TimelineUtility.UnpackGenericDialog(context); + + if (!result) + return false; + + return TimelineUtility.UnpackGeneric(context); + } + + public override ActionValidity Validate(ActionContext context) + { + return context.clips.Any(clip => clip.asset is TMPAnimationClip) + ? ActionValidity.Valid + : ActionValidity.NotApplicable; + } +} + +[MenuEntry("Export TMPAnimation/Generic Animation SO")] +public class ExportToGenericAnimation : TimelineAction +{ + public override bool Execute(ActionContext context) + { + // Export to generic + int result = TimelineUtility.ExportAsGenericDialog(context); + + if (result == 1) + return false; + + return TimelineUtility.ExportAsGeneric(context, result); + } + + public override ActionValidity Validate(ActionContext context) + { + return context.tracks.Any(track => track is TMPMeshModifierTrack) + ? ActionValidity.Valid + : ActionValidity.NotApplicable; + } +} + +[MenuEntry("Export TMPAnimation/TMPAnimation Script")] +public class ExportToTMPAnimationScript : TimelineAction +{ + public override bool Execute(ActionContext context) + { + // Export to script + int result = TimelineUtility.ExportAsScriptDialog(context); + + if (result == 1) + return false; + + return TimelineUtility.ExportAsScript(context, result); + } + + public override ActionValidity Validate(ActionContext context) + { + return context.tracks.Any(track => track is TMPMeshModifierTrack) + ? ActionValidity.Valid + : ActionValidity.NotApplicable; + } +} \ No newline at end of file diff --git a/Package/Editor/Timeline/TMPWriterClipDataDrawer.cs.meta b/Package/Editor/Timeline/TMPWriterClipDataDrawer.cs.meta new file mode 100644 index 0000000..158aef2 --- /dev/null +++ b/Package/Editor/Timeline/TMPWriterClipDataDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d3eef1f9080abe04ba1b1ab9d6b6913d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/Timeline/TMPWriterMarkerEditor.cs b/Package/Editor/Timeline/TMPWriterMarkerEditor.cs new file mode 100644 index 0000000..5a670b1 --- /dev/null +++ b/Package/Editor/Timeline/TMPWriterMarkerEditor.cs @@ -0,0 +1,93 @@ +using UnityEditor.Timeline; +using UnityEngine.Timeline; + +[CustomTimelineEditor(typeof(TMPStartWriterMarker))] +public class TMPStartWriterMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Start Writer"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPStopWriterMarker))] +public class TMPStopWriterMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Stop Writer"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPRestartWriterMarker))] +public class TMPRestartWriterMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Restart Writer"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPResetWriterMarker))] +public class TMPResetWriterMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + var mark = marker as TMPResetWriterMarker; + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Reset Writer (" + mark.TextIndex + ")"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPWriterWaitMarker))] +public class TMPWriterWaitMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + var mark = marker as TMPWriterWaitMarker; + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Wait (" + mark.WaitTime + ")"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPWriterResetWaitMarker))] +public class TMPWriterResetWaitMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Reset Wait"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPSkipWriterMarker))] +public class TMPSkipWriterMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Skip Writer"; + return s; + } +} + +[CustomTimelineEditor(typeof(TMPWriterSetSkippableMarker))] +public class TMPSetSkippableMarkerEditor : MarkerEditor +{ + public override MarkerDrawOptions GetMarkerOptions(IMarker marker) + { + var mark = marker as TMPWriterSetSkippableMarker; + MarkerDrawOptions s = new MarkerDrawOptions(); + s.tooltip = "Set Skippable ("+ mark.Skippable +")"; + return s; + } +} \ No newline at end of file diff --git a/Package/Editor/Timeline/TMPWriterMarkerEditor.cs.meta b/Package/Editor/Timeline/TMPWriterMarkerEditor.cs.meta new file mode 100644 index 0000000..103e051 --- /dev/null +++ b/Package/Editor/Timeline/TMPWriterMarkerEditor.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: eefa4dabff5158e4f8c5c1b729db4e30 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/Timeline/Text (TMP)Timeline.playable b/Package/Editor/Timeline/Text (TMP)Timeline.playable new file mode 100644 index 0000000..6c155a7 --- /dev/null +++ b/Package/Editor/Timeline/Text (TMP)Timeline.playable @@ -0,0 +1,950 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-6142259828328378184 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73fa5eac7a691b04692db83c6d3e95f3, type: 3} + m_Name: TMPMeshModifierClip + m_EditorClassIdentifier: + step: + Step: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 5 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + lastMovedEntry: 0 +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bfda56da833e2384a9677cd3c976a436, type: 3} + m_Name: Text (TMP)Timeline + m_EditorClassIdentifier: + m_Version: 0 + m_Tracks: + - {fileID: 8825731739713252798} + m_FixedDuration: 0 + m_EditorSettings: + m_Framerate: 60 + m_ScenePreview: 1 + m_DurationMode: 0 + m_MarkerTrack: {fileID: 0} +--- !u!114 &5311929197858101644 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73fa5eac7a691b04692db83c6d3e95f3, type: 3} + m_Name: TMPMeshModifierClip + m_EditorClassIdentifier: + step: + Step: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333334 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 2.9999938 + outSlope: 2.9999943 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333403 + outWeight: 0.33333397 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333397 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 1.95 + exitCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: -0.002105713 + value: 1.0040283 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 1.5725082 + outSlope: 1.5725082 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 3.05 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 5 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 80.01, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: + - eulerAngles: {x: 0, y: 0, z: 69.85} + pivot: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Position: + vector: {x: -7.97, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: -7.61, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 7.66, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 7.81, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + lastMovedEntry: 0 +--- !u!114 &7237167247931217711 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73fa5eac7a691b04692db83c6d3e95f3, type: 3} + m_Name: TMPMeshModifierClip + m_EditorClassIdentifier: + step: + Step: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 5 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1.75, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + lastMovedEntry: 0 +--- !u!114 &8825731739713252798 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 904f8d22bfe6f2147af0c2edc5912739, type: 3} + m_Name: TMP Mesh Modifier Track + m_EditorClassIdentifier: + m_Version: 3 + m_AnimClip: {fileID: 0} + m_Locked: 0 + m_Muted: 0 + m_CustomPlayableFullTypename: + m_Curves: {fileID: 0} + m_Parent: {fileID: 11400000} + m_Children: [] + m_Clips: + - m_Version: 1 + m_Start: 1.6166666666666667 + m_ClipIn: 0 + m_Asset: {fileID: 5311929197858101644} + m_Duration: 5 + m_TimeScale: 1 + m_ParentTrack: {fileID: 8825731739713252798} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0 + m_BlendOutDuration: 0 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 1 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: 2.1999999999999993 + m_PreExtrapolationTime: 1.6166666666666667 + m_DisplayName: TMPMeshModifierClip + - m_Version: 1 + m_Start: 8.816666666666666 + m_ClipIn: 0 + m_Asset: {fileID: 7237167247931217711} + m_Duration: 5 + m_TimeScale: 1 + m_ParentTrack: {fileID: 8825731739713252798} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0 + m_BlendOutDuration: 0 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 1 + m_PostExtrapolationTime: 2.9499999999999993 + m_PreExtrapolationTime: 0 + m_DisplayName: TMPMeshModifierClip + - m_Version: 1 + m_Start: 16.766666666666666 + m_ClipIn: 0 + m_Asset: {fileID: -6142259828328378184} + m_Duration: 5 + m_TimeScale: 1 + m_ParentTrack: {fileID: 8825731739713252798} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0 + m_BlendOutDuration: 0 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: Infinity + m_PreExtrapolationTime: 2.9499999999999993 + m_DisplayName: TMPMeshModifierClip + m_Markers: + m_Objects: [] diff --git a/Package/Editor/Timeline/Text (TMP)Timeline.playable.meta b/Package/Editor/Timeline/Text (TMP)Timeline.playable.meta new file mode 100644 index 0000000..f3be517 --- /dev/null +++ b/Package/Editor/Timeline/Text (TMP)Timeline.playable.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 873b78b91a07fe94685843ff7694ab14 +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/Timeline/TimelineAnimationStepDrawer.cs b/Package/Editor/Timeline/TimelineAnimationStepDrawer.cs new file mode 100644 index 0000000..666d2b3 --- /dev/null +++ b/Package/Editor/Timeline/TimelineAnimationStepDrawer.cs @@ -0,0 +1,53 @@ +using System; +using TMPEffects.TMPAnimations; +using UnityEditor; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +[CustomPropertyDrawer(typeof(TimelineAnimationStep), false)] +public class TimelineAnimationStepDrawer : AnimationStepDrawer +{ + private bool entry = false; + + + private SerializedProperty entryCurve; + private SerializedProperty exitCurve; + private SerializedProperty entryDuration; + private SerializedProperty exitDuration; + + private SerializedProperty modifiers; + private SerializedProperty initModifiers; + private SerializedProperty useInitModifiers; + private SerializedProperty wave; + private SerializedProperty waveOffsetType; + private SerializedProperty useWave; + + private Color backgroundColor; + + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + Init(property.FindPropertyRelative("Step")); + + EditorGUI.BeginProperty(position, label, property); + + var rect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight); + + var drawCurves = EditorPrefs.GetBool(TMPEffectsTimelineEditorPrefsKeys.DRAW_CURVES_EDITORPREFS_KEY); + var set = EditorGUI.Toggle(rect, new GUIContent("Draw blending curves"), drawCurves); + if (drawCurves != set) + EditorPrefs.SetBool(TMPEffectsTimelineEditorPrefsKeys.DRAW_CURVES_EDITORPREFS_KEY, set); + + rect.y += EditorGUIUtility.singleLineHeight * 2; + + DrawCommon(rect, property.FindPropertyRelative("Step"), label); + + EditorGUI.EndProperty(); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + Init(property.FindPropertyRelative("Step")); + return GetCommonHeight(property.FindPropertyRelative("Step")) + EditorGUIUtility.singleLineHeight *2; + } +} \ No newline at end of file diff --git a/Package/Editor/Timeline/TimelineAnimationStepDrawer.cs.meta b/Package/Editor/Timeline/TimelineAnimationStepDrawer.cs.meta new file mode 100644 index 0000000..253adb3 --- /dev/null +++ b/Package/Editor/Timeline/TimelineAnimationStepDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c5adab32181d800489dcfc04390ff78b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/Timeline/TimelineUtility.cs b/Package/Editor/Timeline/TimelineUtility.cs new file mode 100644 index 0000000..c06bacb --- /dev/null +++ b/Package/Editor/Timeline/TimelineUtility.cs @@ -0,0 +1,311 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Reflection; +using TMPEffects.TMPAnimations; +using UnityEditor; +using UnityEditor.Timeline; +using UnityEditor.Timeline.Actions; +using UnityEngine; +using UnityEngine.Timeline; +using ScriptableWizard = UnityEditor.ScriptableWizard; + +internal static class TimelineUtility +{ + #region ExportAsGeneric + public static int ExportAsGenericDialog(ActionContext context) + { + GenericAnimation animation = ScriptableObject.CreateInstance(); + + int result = EditorUtility.DisplayDialogComplex("Export to Generic Animation", + @"You are exporting to a generic animation asset. +Which clips do you want to use for the export?", "Selected Only", "Cancel", "All Clips"); + + // ExportToGenericAnimationUtilityWindow.Init(Application.dataPath); + + return result; + } + + private static GenericAnimation CreateGenericFromAllClips(ActionContext context) + { + var anim = ScriptableObject.CreateInstance(); + anim.Tracks.Tracks.Clear(); + + var tracks = context.timeline.GetOutputTracks().OfType().ToList(); + + foreach (var track in tracks) + { + var clips = track.GetClips(); + + var animTrack = new GenericAnimation.Track(); + anim.Tracks.Tracks.Add(animTrack); + foreach (var clip in clips) + { + TMPMeshModifierClip mClip = clip.asset as TMPMeshModifierClip; + if (mClip == null) continue; + + var copy = UnityEngine.Object.Instantiate(mClip); + var step = copy.Step.Step; + + // Copy over clip properties + step.name = clip.displayName; + step.duration = (float)clip.duration; + step.startTime = (float)clip.start; + step.preExtrapolation = clip.preExtrapolationMode.ConvertExtrapolation(); + step.postExtrapolation = clip.postExtrapolationMode.ConvertExtrapolation(); + + animTrack.Clips.Add(step); + + // TODO What was this about again? + float endTime = (float)clip.end; + if (endTime > anim.Duration) + { + anim.Duration = endTime; + } + } + } + + anim.Repeat = true; + + return anim; + } + + private static GenericAnimation CreateGenericAnimationFromSelectedClips(ActionContext context) + { + var anim = ScriptableObject.CreateInstance(); + anim.Tracks.Tracks.Clear(); + + var tracks = context.tracks.OfType().ToList(); + + foreach (var track in tracks) + { + var clips = track.GetClips(); + + var animTrack = new GenericAnimation.Track(); + anim.Tracks.Tracks.Add(animTrack); + foreach (var clip in clips) + { + TMPMeshModifierClip mClip = clip.asset as TMPMeshModifierClip; + if (mClip == null) continue; + + var copy = UnityEngine.Object.Instantiate(mClip); + var step = copy.Step.Step; + + // Copy over clip properties + step.name = clip.displayName; + step.duration = (float)clip.duration; + step.startTime = (float)clip.start; + step.preExtrapolation = clip.preExtrapolationMode.ConvertExtrapolation(); + step.postExtrapolation = clip.postExtrapolationMode.ConvertExtrapolation(); + + animTrack.Clips.Add(step); + + // TODO What was this about again? + float endTime = (float)clip.end; + if (endTime > anim.Duration) + { + anim.Duration = endTime; + } + } + } + + anim.Repeat = true; + + return anim; + } + + public static bool ExportAsGeneric(ActionContext context, int option) + { + if (option == 1) throw new SystemException(); + + // Selected only + if (option == 0) + { + var anim = CreateGenericAnimationFromSelectedClips(context); + GenerateScriptableFromContext(Application.dataPath + "/GenericExpors.asset", anim); + return true; + } + + // All clips + if (option == 2) + { + var anim = CreateGenericFromAllClips(context); + GenerateScriptableFromContext(Application.dataPath + "/GenericExpors.asset", anim); + return true; + } + + return false; + } + #endregion + + #region Directory stuff + static string MakeRelative(string filePath, string referencePath) + { + var fileUri = new Uri(filePath); + var referenceUri = new Uri(referencePath); + return Uri.UnescapeDataString(referenceUri.MakeRelativeUri(fileUri).ToString()) + .Replace('/', Path.DirectorySeparatorChar); + } + + static void EnsureDirectoryExists(string directoryPath) + { + var hierarchy = directoryPath.Split('/'); + string dirPath = hierarchy[0]; + + // Ensure directory exists + for (int i = 1; i < hierarchy.Length; i++) + { + if (!Directory.Exists(dirPath)) + { + Directory.CreateDirectory(dirPath); + } + + dirPath += "/" + hierarchy[i]; + } + } + #endregion + + static void GenerateScriptableFromContext(string filePath, GenericAnimation anim) + { + EnsureDirectoryExists(filePath); + + string relativePath = MakeRelative(filePath, Application.dataPath); + Debug.Log(relativePath); + AssetDatabase.CreateAsset(anim, relativePath); + AssetDatabase.SaveAssets(); + EditorUtility.FocusProjectWindow(); + Selection.activeObject = anim; + } + + static bool GenerateScriptFromContext(string fileNamePath, string code) + { + var hierarchy = fileNamePath.Split('/'); + string filename = hierarchy[hierarchy.Length - 1]; + string dirPath = hierarchy[0]; + + for (int i = 1; i < hierarchy.Length; i++) + { + if (!Directory.Exists(dirPath)) + { + Directory.CreateDirectory(dirPath); + } + + dirPath += "/" + hierarchy[i]; + } + + if (File.Exists(dirPath)) + { + var text = File.ReadAllText(dirPath); + if (text == code) + { + // fileNames.Add(code.fileName); + return false; + } + } + + File.WriteAllText(dirPath, code); + AssetDatabase.Refresh(); + AssetDatabase.SaveAssets(); + + return true; + } + + #region ExportAsScript + public static int ExportAsScriptDialog(ActionContext context) + { + int result = EditorUtility.DisplayDialogComplex("Export to TMPAnimation Script", + @"You are exporting to an animation script. +Which clips do you want to use for the export?", "Selected Only", "Cancel", "All Clips"); + + return result; + } + + public static bool ExportAsScript(ActionContext context, int option) + { + if (option == 1) throw new SystemException(); + + // Selected only + if (option == 0) + { + var anim = CreateGenericAnimationFromSelectedClips(context); + GenericAnimationExporter.Export(anim, Application.dataPath + "/GenericExpors.cs"); + return true; + } + + // All clips + if (option == 2) + { + var anim = CreateGenericFromAllClips(context); + GenericAnimationExporter.Export(anim, Application.dataPath + "/GenericExpors.cs"); + return true; + } + + return false; + } + #endregion + + #region UnpackGeneric + public static bool UnpackGenericDialog(ActionContext context) + { + bool result = EditorUtility.DisplayDialog("Unpack generic animation", + @"You are unpacking a GenericAnimation, which will convert the GenericAnimation clip into equivalent, editable TMPMeshModifier clips. +The GenericAnimation asset itself will remain unchanged. +Proceed?", "Ok", "Cancel"); + + return result; + } + + public static bool UnpackGeneric(ActionContext context) + { + var clips = context.clips.Where(clip => clip.asset is TMPAnimationClip); + HashSet tracks = new HashSet(); + + foreach (var clip in clips) + { + var track = clip.GetParentTrack(); + tracks.Add(track); + + var tmpAnimationClip = clip.asset as TMPAnimationClip; + var genericAnim = tmpAnimationClip.animation; + var mainParentTrack = context.timeline.CreateTrack(genericAnim.name); + + int trackCounter = 0; + foreach (var animTrack in genericAnim.Tracks.Tracks) + { + var parentTrack = context.timeline.CreateTrack(mainParentTrack, genericAnim.name + "_Track" + trackCounter++); + + foreach (var animClip in animTrack.Clips) + { + var timelineClip = parentTrack.CreateClip(); + var modClip = timelineClip.asset as TMPMeshModifierClip; + modClip.Step.Step = new AnimationStep(animClip); + + timelineClip.displayName = animClip.name; + + timelineClip.start = animClip.startTime; + timelineClip.duration = animClip.duration; + + // TODO Is there really no way to set the mode on creation... + var reflected = typeof(TimelineClip).GetField("m_PostExtrapolationMode", BindingFlags.NonPublic | BindingFlags.Instance); + reflected.SetValue(timelineClip, animClip.postExtrapolation.ConvertExtrapolation()); + + reflected = typeof(TimelineClip).GetField("m_PreExtrapolationMode", BindingFlags.NonPublic | BindingFlags.Instance); + reflected.SetValue(timelineClip, animClip.preExtrapolation.ConvertExtrapolation()); + } + } + + EditorUtility.SetDirty(context.timeline); + TimelineEditor.Refresh(RefreshReason.ContentsAddedOrRemoved); + } + + // foreach (var track in tracks) + // { + // context.timeline.DeleteTrack(track); + // } + + return true; + } + #endregion +} \ No newline at end of file diff --git a/Package/Editor/Timeline/TimelineUtility.cs.meta b/Package/Editor/Timeline/TimelineUtility.cs.meta new file mode 100644 index 0000000..c9dc342 --- /dev/null +++ b/Package/Editor/Timeline/TimelineUtility.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a25a9b1589620614cb8c6343b323fd8b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/TypedVectorDrawer.cs b/Package/Editor/TypedVectorDrawer.cs new file mode 100644 index 0000000..419865e --- /dev/null +++ b/Package/Editor/TypedVectorDrawer.cs @@ -0,0 +1,47 @@ +using TMPEffects.Parameters; +using UnityEditor; +using UnityEngine; +using GUIContent = UnityEngine.GUIContent; + +[CustomPropertyDrawer(typeof(ParameterTypes.TypedVector3))] +public class TypedVector3Drawer : PropertyDrawer +{ + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + TypedVectorDrawerUtility.Draw(position, property, label, 100); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + return EditorGUIUtility.singleLineHeight; + } +} + +[CustomPropertyDrawer(typeof(ParameterTypes.TypedVector2))] +public class TypedVector2Drawer : PropertyDrawer +{ + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + TypedVectorDrawerUtility.Draw(position, property, label, 100); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + return EditorGUIUtility.singleLineHeight; + } +} + +internal static class TypedVectorDrawerUtility +{ + public static void Draw(Rect position, SerializedProperty property, GUIContent label, float toggleWidth) + { + position = EditorGUI.PrefixLabel(position, label); + EditorGUI.PropertyField(position, property.FindPropertyRelative("vector"), GUIContent.none); + + position.x -= toggleWidth; + position.width = toggleWidth; + + property.FindPropertyRelative("type").enumValueIndex = (int)(ParameterTypes.VectorType) + EditorGUI.EnumPopup(position, GUIContent.none,(ParameterTypes.VectorType)property.FindPropertyRelative("type").enumValueIndex); + } +} \ No newline at end of file diff --git a/Package/Editor/TypedVectorDrawer.cs.meta b/Package/Editor/TypedVectorDrawer.cs.meta new file mode 100644 index 0000000..43c0c47 --- /dev/null +++ b/Package/Editor/TypedVectorDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3f1bb21c0325ddf4fae70bae07e4311f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/UnityNullableDrawer.cs b/Package/Editor/UnityNullableDrawer.cs new file mode 100644 index 0000000..fe7bae9 --- /dev/null +++ b/Package/Editor/UnityNullableDrawer.cs @@ -0,0 +1,47 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEditor; +using UnityEditor.UIElements; +using UnityEngine; +using UnityEngine.UIElements; + +[CustomPropertyDrawer(typeof(UnityNullable<>), false)] +public class UnityNullableDrawer : PropertyDrawer +{ + public override void OnGUI(Rect position, SerializedProperty property, GUIContent label) + { + EditorGUI.BeginProperty(position, label, property); + + position = EditorGUI.PrefixLabel(position, GUIUtility.GetControlID(FocusType.Passive), label); + + var indent = EditorGUI.indentLevel; + EditorGUI.indentLevel = 0; + + // Calculate rects + var hasValueRect = new Rect(position.x, position.y, 30, position.height); + var valueRect = new Rect(position.x + 35, position.y, position.width - 35, position.height); + + // Draw fields - pass GUIContent.none to each so they are drawn without labels + EditorGUI.PropertyField(hasValueRect, property.FindPropertyRelative("hasValue"), GUIContent.none); + + if (property.FindPropertyRelative("hasValue").boolValue) + { + EditorGUI.PropertyField(valueRect, property.FindPropertyRelative("value"), GUIContent.none); + } + else + { + EditorGUI.BeginDisabledGroup(true); + EditorGUI.PropertyField(valueRect, property.FindPropertyRelative("value"), GUIContent.none); + EditorGUI.EndDisabledGroup(); + } + + EditorGUI.indentLevel = indent; + + EditorGUI.EndProperty(); + } + + public override float GetPropertyHeight(SerializedProperty property, GUIContent label) + { + return EditorGUIUtility.singleLineHeight; + } +} \ No newline at end of file diff --git a/Package/Editor/UnityNullableDrawer.cs.meta b/Package/Editor/UnityNullableDrawer.cs.meta new file mode 100644 index 0000000..311e270 --- /dev/null +++ b/Package/Editor/UnityNullableDrawer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 83bf7df8354c81c45a8cedd8fda5a82c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Editor/timelinetest.cs b/Package/Editor/timelinetest.cs new file mode 100644 index 0000000..88c502b --- /dev/null +++ b/Package/Editor/timelinetest.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +public class timelinetest : MonoBehaviour +{ + // Start is called before the first frame update + void Start() + { + + } + + // Update is called once per frame + void Update() + { + + } +} diff --git a/Package/Editor/timelinetest.cs.meta b/Package/Editor/timelinetest.cs.meta new file mode 100644 index 0000000..6e602e0 --- /dev/null +++ b/Package/Editor/timelinetest.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8e00e43e3b63ff148be625b32dbd73e3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Example SceneAnimations.meta b/Package/Example SceneAnimations.meta new file mode 100644 index 0000000..f4b0930 --- /dev/null +++ b/Package/Example SceneAnimations.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 39c139204b39a6d4cbdbd8533db98279 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Example SceneAnimations/Basic.meta b/Package/Example SceneAnimations/Basic.meta new file mode 100644 index 0000000..7724821 --- /dev/null +++ b/Package/Example SceneAnimations/Basic.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 88ae9a222240df3468fe91b882a5d7ec +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Example SceneAnimations/Basic/DraggableAnimation.cs b/Package/Example SceneAnimations/Basic/DraggableAnimation.cs new file mode 100644 index 0000000..0920236 --- /dev/null +++ b/Package/Example SceneAnimations/Basic/DraggableAnimation.cs @@ -0,0 +1,160 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.Components; +using TMPEffects.CharacterData; +using TMPEffects.TMPAnimations; +using TMPro; +using UnityEngine; + +namespace TMPEffects.TMPSceneAnimations +{ + public class Draggable : TMPSceneAnimation + { + [SerializeField] Camera cam; + [SerializeField] TMP_Text text; + + private Canvas canvas; + + private void OnEnable() + { + if (text == null) + { + text = GetComponentInParent(); + if (text == null) + { + Debug.LogError("Could not find TMP_Text component on gameobject or its parent; Please either put this component on a gameobject with a TMP_Text component in its ancestors or manually assign a component."); + } + } + + if (text is TextMeshProUGUI) + { + canvas = text.GetComponentInParent(); + if (canvas == null) + { + Debug.LogError("Could not find Canvas component on gameobject of TMP_Text or its parents"); + } + } + + if (cam == null) + { + cam = Camera.main; + if (cam == null) + { + Debug.LogError("Could not find Camera component"); + } + } + } + + public override void Animate(CharData cData, IAnimationContext context) + { + if (!Application.isPlaying) return; + + Data d = context.CustomData as Data; + int segmentIndex = context.SegmentData.SegmentIndexOf(cData); + + // Initialize all offsets to 0 + if (d.offsets == null) + { + d.offsets = new(context.SegmentData.length); + for (int i = 0; i < context.SegmentData.length; i++) + { + d.offsets.Add(i, Vector3.zero); + } + } + + // If mouse button not clicked, set and return + if (!Input.GetMouseButton(0)) + { + if (d.dragging != -1) + { + if (d.dragging == cData.info.index) + { + d.offsets[segmentIndex] = d.offsets[segmentIndex] + d.dynamicOffset; + d.dynamicOffset = Vector3.zero; + d.dragging = -1; + } + } + + cData.PositionDelta += + AnimationUtility.IgnoreScaling(d.offsets[segmentIndex], cData, context); + return; + } + + // If dragging something + if (d.dragging != -1) + { + // If dragging another character, set and return + if (d.dragging != cData.info.index) + { + cData.PositionDelta += + AnimationUtility.IgnoreScaling(d.offsets[segmentIndex], cData, context); + // AnimationUtility.AddPositionDeltaRaw(d.offsets[segmentIndex], cData, context); + return; + } + + // If dragging this, update offset, set and return + + d.dynamicOffset = (Input.mousePosition - d.startPosition) / (canvas == null ? 1f : canvas.scaleFactor); + cData.PositionDelta += + AnimationUtility.IgnoreScaling(d.offsets[segmentIndex], cData, context); + // AnimationUtility.AddPositionDeltaRaw(d.offsets[segmentIndex] + d.dynamicOffset, cData, context); + return; + } + + // Issue what if animation is updated only during e.g. fixedupdate + if (Input.GetMouseButtonDown(0)) + { + if (d.dragging != -1) Debug.LogError("how the fuck did this happen"); + + float scaleFactor = (canvas == null ? 1f : canvas.scaleFactor); + Camera input = canvas == null ? null : (canvas.renderMode == RenderMode.ScreenSpaceOverlay ? null : cam); + int index = TMP_TextUtilities.FindIntersectingCharacter(text, Input.mousePosition - d.offsets[segmentIndex] * scaleFactor, input, true); + + if (index != cData.info.index) + { + cData.PositionDelta += + AnimationUtility.IgnoreScaling(d.offsets[segmentIndex], cData, context); + // AnimationUtility.AddPositionDeltaRaw(d.offsets[segmentIndex], cData, context); + return; + } + + d.dynamicOffset = Vector3.zero; + d.dragging = cData.info.index; + d.startPosition = Input.mousePosition; + cData.PositionDelta += + AnimationUtility.IgnoreScaling(d.offsets[segmentIndex], cData, context); + // AnimationUtility.AddPositionDeltaRaw(d.offsets[segmentIndex], cData, context); + + return; + } + + if (d.offsets[segmentIndex] != Vector3.zero) + cData.PositionDelta += + AnimationUtility.IgnoreScaling(d.offsets[segmentIndex], cData, context); + // AnimationUtility.AddPositionDeltaRaw(d.offsets[segmentIndex], cData, context); + } + + public override void SetParameters(object customData, IDictionary parameters) + { + } + + public override bool ValidateParameters(IDictionary parameters) + { + return true; + } + + public override object GetNewCustomData() + { + return new Data(); + } + + private class Data + { + public Vector3 dynamicOffset; + public Dictionary offsets = null; + public int dragging = -1; + public Vector3 startPosition; + } + } +} + diff --git a/Package/Example SceneAnimations/Basic/DraggableAnimation.cs.meta b/Package/Example SceneAnimations/Basic/DraggableAnimation.cs.meta new file mode 100644 index 0000000..8728cc7 --- /dev/null +++ b/Package/Example SceneAnimations/Basic/DraggableAnimation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 6c31b5e0db32e0a469dd588f40196607 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Example SceneAnimations/Basic/FlashlightAnimation.cs b/Package/Example SceneAnimations/Basic/FlashlightAnimation.cs new file mode 100644 index 0000000..5f6d217 --- /dev/null +++ b/Package/Example SceneAnimations/Basic/FlashlightAnimation.cs @@ -0,0 +1,160 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.Components; +using TMPEffects.CharacterData; +using TMPEffects.TMPAnimations; +using TMPro; +using UnityEngine; +using static TMPEffects.Parameters.ParameterUtility; + +// using static TMPEffects.ParameterUtility; + +namespace TMPEffects.TMPSceneAnimations.Animations +{ + public class FlashlightAnimation : TMPSceneAnimation + { + [SerializeField] Camera cam; + [SerializeField] TMP_Text text; + + [SerializeField] float hiddenOpacity; + [SerializeField] float shownOpacity; + [SerializeField] AnimationCurve fallOffCurve; + [SerializeField] float radius; + + private Canvas canvas; + + private void OnEnable() + { + if (text == null) + { + text = GetComponentInParent(); + if (text == null) + { + Debug.LogError( + "Could not find TMP_Text component on gameobject or its parent; Please either put this component on a gameobject with a TMP_Text component in its ancestors or manually assign a component."); + } + } + + if (text is TextMeshProUGUI) + { + canvas = text.GetComponentInParent(); + if (canvas == null) + { + Debug.LogError("Could not find Canvas component on gameobject of TMP_Text or its parents"); + } + } + + if (cam == null) + { + cam = Camera.main; + if (cam == null) + { + Debug.LogError("Could not find Camera component"); + } + } + } + + public override void Animate(CharData cData, IAnimationContext context) + { + if (!Application.isPlaying) + { + return; + } + + Data d = context.CustomData as Data; + + Camera input = canvas == null ? null : (canvas.renderMode == RenderMode.ScreenSpaceOverlay ? null : cam); + + if (!TMP_TextUtilities.ScreenPointToWorldPointInRectangle(text.transform, Input.mousePosition, input, + out Vector3 res)) + { + Debug.LogError("Failed to calculate ScreenPointToWorldPointInRectangle"); + } + + context.AnimatorContext.Modifiers.CalculateVertexPositions(cData, context.AnimatorContext); + for (int i = 0; i < 4; i++) + { + Vector3 vertex; + + switch (i) + { + case 0: + vertex = text.transform.TransformPoint(context.AnimatorContext.Modifiers.BL_Result); + break; + case 1: + vertex = text.transform.TransformPoint(context.AnimatorContext.Modifiers.TL_Result); + break; + case 2: + vertex = text.transform.TransformPoint(context.AnimatorContext.Modifiers.TR_Result); + break; + case 3: + vertex = text.transform.TransformPoint(context.AnimatorContext.Modifiers.BR_Result); + break; + default: throw new System.Exception(); + } + + float magnitude = (res - vertex).magnitude; + + Color32 color = context.AnimatorContext.Modifiers.MeshModifiers.TL_Color.GetValue(cData.InitialMesh.TL_Color); + + if (magnitude < d.radius) + { + float t = magnitude / d.radius; + float t2 = 1 - d.fallOffCurve.Evaluate(t); + float opacity = Mathf.LerpUnclamped(d.hiddenOpacity, d.shownOpacity, t2); + + color.a = (byte)opacity; + cData.mesh.SetColor(i, color); + } + else + { + color.a = (byte)0; + cData.mesh.SetColor(i, color); + } + } + } + + public override void SetParameters(object customData, IDictionary parameters) + { + if (parameters == null) return; + + Data d = customData as Data; + if (TryGetFloatParameter(out float f, parameters, "hiddenOpacity", "hOpacity", "hOp", "hidden")) + d.hiddenOpacity = f; + if (TryGetFloatParameter(out f, parameters, "shownOpacity", "sOpacity", "sOp", "shown")) d.shownOpacity = f; + if (TryGetFloatParameter(out f, parameters, "radius", "rad", "r")) d.radius = f; + if (TryGetAnimCurveParameter(out var crv, parameters, "fallOffCurve", "foCurve", "foCrv")) + d.fallOffCurve = crv; + } + + public override bool ValidateParameters(IDictionary parameters) + { + if (parameters == null) return true; + + if (HasNonFloatParameter(parameters, "hiddenOpacity", "hOpacity", "hOp", "hidden")) return false; + if (HasNonFloatParameter(parameters, "shownOpacity", "sOpacity", "sOp", "shown")) return false; + if (HasNonFloatParameter(parameters, "radius", "rad", "r")) return false; + if (HasNonAnimCurveParameter(parameters, "fallOffCurve", "foCurve", "foCrv")) return false; + return true; + } + + public override object GetNewCustomData() + { + return new Data() + { + hiddenOpacity = this.hiddenOpacity, + shownOpacity = this.shownOpacity, + fallOffCurve = this.fallOffCurve, + radius = this.radius + }; + } + + private class Data + { + public float hiddenOpacity; + public float shownOpacity; + public AnimationCurve fallOffCurve; + public float radius; + } + } +} \ No newline at end of file diff --git a/Package/Example SceneAnimations/Basic/FlashlightAnimation.cs.meta b/Package/Example SceneAnimations/Basic/FlashlightAnimation.cs.meta new file mode 100644 index 0000000..56262aa --- /dev/null +++ b/Package/Example SceneAnimations/Basic/FlashlightAnimation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4a3b5d89f0c59d54f92ac73f41783d7e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/EasingFunctionPresets.unitypackage b/Package/Resources/EasingFunctionPresets.unitypackage new file mode 100644 index 0000000..8cc8a54 Binary files /dev/null and b/Package/Resources/EasingFunctionPresets.unitypackage differ diff --git a/Package/Resources/EasingFunctionPresets.unitypackage.meta b/Package/Resources/EasingFunctionPresets.unitypackage.meta new file mode 100644 index 0000000..7d38423 --- /dev/null +++ b/Package/Resources/EasingFunctionPresets.unitypackage.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: 8c28c7372778b204b9f05902dd941368 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons.meta b/Package/Resources/MarkerIcons.meta new file mode 100644 index 0000000..1cfb430 --- /dev/null +++ b/Package/Resources/MarkerIcons.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: a5927f18e8820ba4f9832de40485d80a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/animator-resetanimations.png b/Package/Resources/MarkerIcons/animator-resetanimations.png new file mode 100644 index 0000000..65db840 Binary files /dev/null and b/Package/Resources/MarkerIcons/animator-resetanimations.png differ diff --git a/Package/Resources/MarkerIcons/animator-resetanimations.png.meta b/Package/Resources/MarkerIcons/animator-resetanimations.png.meta new file mode 100644 index 0000000..0c81150 --- /dev/null +++ b/Package/Resources/MarkerIcons/animator-resetanimations.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: 3e5d0ab8b9a74de42b1e2bf651df4101 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/animator-settings.png b/Package/Resources/MarkerIcons/animator-settings.png new file mode 100644 index 0000000..f04029c Binary files /dev/null and b/Package/Resources/MarkerIcons/animator-settings.png differ diff --git a/Package/Resources/MarkerIcons/animator-settings.png.meta b/Package/Resources/MarkerIcons/animator-settings.png.meta new file mode 100644 index 0000000..1ab2bbc --- /dev/null +++ b/Package/Resources/MarkerIcons/animator-settings.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: 3421197f6bce0fd4890a9fef424bd346 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/animator-start.png b/Package/Resources/MarkerIcons/animator-start.png new file mode 100644 index 0000000..2775da6 Binary files /dev/null and b/Package/Resources/MarkerIcons/animator-start.png differ diff --git a/Package/Resources/MarkerIcons/animator-start.png.meta b/Package/Resources/MarkerIcons/animator-start.png.meta new file mode 100644 index 0000000..ff2b1ad --- /dev/null +++ b/Package/Resources/MarkerIcons/animator-start.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: 5c1079517f1a6bd4bbdf7e1785e147bd +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/animator-stop.png b/Package/Resources/MarkerIcons/animator-stop.png new file mode 100644 index 0000000..74293f2 Binary files /dev/null and b/Package/Resources/MarkerIcons/animator-stop.png differ diff --git a/Package/Resources/MarkerIcons/animator-stop.png.meta b/Package/Resources/MarkerIcons/animator-stop.png.meta new file mode 100644 index 0000000..1bee235 --- /dev/null +++ b/Package/Resources/MarkerIcons/animator-stop.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: 6015a90035a3d3a40b9e3fa3b8856ab5 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/animator-updateonce.png b/Package/Resources/MarkerIcons/animator-updateonce.png new file mode 100644 index 0000000..5fb0ddb Binary files /dev/null and b/Package/Resources/MarkerIcons/animator-updateonce.png differ diff --git a/Package/Resources/MarkerIcons/animator-updateonce.png.meta b/Package/Resources/MarkerIcons/animator-updateonce.png.meta new file mode 100644 index 0000000..1b1760c --- /dev/null +++ b/Package/Resources/MarkerIcons/animator-updateonce.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: cc24ef6e7f375784c9aa2fcb6e62b99f +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/writer-play.png b/Package/Resources/MarkerIcons/writer-play.png new file mode 100644 index 0000000..ad3f85e Binary files /dev/null and b/Package/Resources/MarkerIcons/writer-play.png differ diff --git a/Package/Resources/MarkerIcons/writer-play.png.meta b/Package/Resources/MarkerIcons/writer-play.png.meta new file mode 100644 index 0000000..9094957 --- /dev/null +++ b/Package/Resources/MarkerIcons/writer-play.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: 69bb27c9a9612634b910f4cc1f8f942d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/writer-reset.png b/Package/Resources/MarkerIcons/writer-reset.png new file mode 100644 index 0000000..3ad4de9 Binary files /dev/null and b/Package/Resources/MarkerIcons/writer-reset.png differ diff --git a/Package/Resources/MarkerIcons/writer-reset.png.meta b/Package/Resources/MarkerIcons/writer-reset.png.meta new file mode 100644 index 0000000..351de5a --- /dev/null +++ b/Package/Resources/MarkerIcons/writer-reset.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: 6dd765b38aa835341b710833b4f52f61 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/writer-restart.png b/Package/Resources/MarkerIcons/writer-restart.png new file mode 100644 index 0000000..30c8d4a Binary files /dev/null and b/Package/Resources/MarkerIcons/writer-restart.png differ diff --git a/Package/Resources/MarkerIcons/writer-restart.png.meta b/Package/Resources/MarkerIcons/writer-restart.png.meta new file mode 100644 index 0000000..5b86121 --- /dev/null +++ b/Package/Resources/MarkerIcons/writer-restart.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: bab88973baf23e840a1788458f2affab +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/writer-settings.png b/Package/Resources/MarkerIcons/writer-settings.png new file mode 100644 index 0000000..0f6a827 Binary files /dev/null and b/Package/Resources/MarkerIcons/writer-settings.png differ diff --git a/Package/Resources/MarkerIcons/writer-settings.png.meta b/Package/Resources/MarkerIcons/writer-settings.png.meta new file mode 100644 index 0000000..26b1ca5 --- /dev/null +++ b/Package/Resources/MarkerIcons/writer-settings.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: dfc466424e368814c973aa522509eb11 +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/writer-skip.png b/Package/Resources/MarkerIcons/writer-skip.png new file mode 100644 index 0000000..5b55408 Binary files /dev/null and b/Package/Resources/MarkerIcons/writer-skip.png differ diff --git a/Package/Resources/MarkerIcons/writer-skip.png.meta b/Package/Resources/MarkerIcons/writer-skip.png.meta new file mode 100644 index 0000000..83aabc6 --- /dev/null +++ b/Package/Resources/MarkerIcons/writer-skip.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: 5eb449908fb63554ba4f7d3449db8def +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/writer-stop.png b/Package/Resources/MarkerIcons/writer-stop.png new file mode 100644 index 0000000..d09b27d Binary files /dev/null and b/Package/Resources/MarkerIcons/writer-stop.png differ diff --git a/Package/Resources/MarkerIcons/writer-stop.png.meta b/Package/Resources/MarkerIcons/writer-stop.png.meta new file mode 100644 index 0000000..751d581 --- /dev/null +++ b/Package/Resources/MarkerIcons/writer-stop.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: 01b2e308327daf04c9f5f08d0f62acfb +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/writer-wait.png b/Package/Resources/MarkerIcons/writer-wait.png new file mode 100644 index 0000000..7ffc0c7 Binary files /dev/null and b/Package/Resources/MarkerIcons/writer-wait.png differ diff --git a/Package/Resources/MarkerIcons/writer-wait.png.meta b/Package/Resources/MarkerIcons/writer-wait.png.meta new file mode 100644 index 0000000..ee3a9c0 --- /dev/null +++ b/Package/Resources/MarkerIcons/writer-wait.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: 429e725831cf9de46a61d2dbb561b99d +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Resources/MarkerIcons/writer.png b/Package/Resources/MarkerIcons/writer.png new file mode 100644 index 0000000..115ec77 Binary files /dev/null and b/Package/Resources/MarkerIcons/writer.png differ diff --git a/Package/Resources/MarkerIcons/writer.png.meta b/Package/Resources/MarkerIcons/writer.png.meta new file mode 100644 index 0000000..0993950 --- /dev/null +++ b/Package/Resources/MarkerIcons/writer.png.meta @@ -0,0 +1,140 @@ +fileFormatVersion: 2 +guid: b82bc6ac8fb314f429822c8da55947eb +TextureImporter: + internalIDToNameTable: [] + externalObjects: {} + serializedVersion: 12 + mipmaps: + mipMapMode: 0 + enableMipMap: 1 + sRGBTexture: 1 + linearTexture: 0 + fadeOut: 0 + borderMipMap: 0 + mipMapsPreserveCoverage: 0 + alphaTestReferenceValue: 0.5 + mipMapFadeDistanceStart: 1 + mipMapFadeDistanceEnd: 3 + bumpmap: + convertToNormalMap: 0 + externalNormalMap: 0 + heightScale: 0.25 + normalMapFilter: 0 + flipGreenChannel: 0 + isReadable: 0 + streamingMipmaps: 0 + streamingMipmapsPriority: 0 + vTOnly: 0 + ignoreMipmapLimit: 0 + grayScaleToAlpha: 0 + generateCubemap: 6 + cubemapConvolution: 0 + seamlessCubemap: 0 + textureFormat: 1 + maxTextureSize: 2048 + textureSettings: + serializedVersion: 2 + filterMode: 1 + aniso: 1 + mipBias: 0 + wrapU: 0 + wrapV: 0 + wrapW: 0 + nPOTScale: 1 + lightmap: 0 + compressionQuality: 50 + spriteMode: 0 + spriteExtrude: 1 + spriteMeshType: 1 + alignment: 0 + spritePivot: {x: 0.5, y: 0.5} + spritePixelsToUnits: 100 + spriteBorder: {x: 0, y: 0, z: 0, w: 0} + spriteGenerateFallbackPhysicsShape: 1 + alphaUsage: 1 + alphaIsTransparency: 0 + spriteTessellationDetail: -1 + textureType: 0 + textureShape: 1 + singleChannelComponent: 0 + flipbookRows: 1 + flipbookColumns: 1 + maxTextureSizeSet: 0 + compressionQualitySet: 0 + textureFormatSet: 0 + ignorePngGamma: 0 + applyGammaDecoding: 0 + swizzle: 50462976 + cookieLightType: 0 + platformSettings: + - serializedVersion: 3 + buildTarget: DefaultTexturePlatform + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: WebGL + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Standalone + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + - serializedVersion: 3 + buildTarget: Windows Store Apps + maxTextureSize: 2048 + resizeAlgorithm: 0 + textureFormat: -1 + textureCompression: 1 + compressionQuality: 50 + crunchedCompression: 0 + allowsAlphaSplitting: 0 + overridden: 0 + ignorePlatformSupport: 0 + androidETC2FallbackOverride: 0 + forceMaximumCompressionQuality_BC6H_BC7: 0 + spriteSheet: + serializedVersion: 2 + sprites: [] + outline: [] + physicsShape: [] + bones: [] + spriteID: + internalID: 0 + vertices: [] + indices: + edges: [] + weights: [] + secondaryTextures: [] + nameFileIdTable: {} + mipmapLimitGroupName: + pSDRemoveMatte: 0 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/CharData.cs b/Package/Runtime/CharData/CharData.cs index 64864cb..3a86adb 100644 --- a/Package/Runtime/CharData/CharData.cs +++ b/Package/Runtime/CharData/CharData.cs @@ -1,67 +1,99 @@ +using System.Collections.Generic; +using System.Collections.ObjectModel; +using System.Linq; +using TMPEffects.Parameters; +using TMPEffects.TMPAnimations; using UnityEngine; using TMPro; namespace TMPEffects.CharacterData { - /// - /// Holds information about a character.
- /// In addition to holding a selection of data supplied by the respective - /// , accessible through the field, - /// also holds specific data and methods to manipulate said data. - ///
public partial class CharData { + internal IAnimationContext context; + + // TODO FOR TESTING; THESE SHOULD (PROBABLY) NOT BE PUBLIC + public TMPCharacterModifiers CharacterModifierss => CharacterModifiers; + + public TMPMeshModifiers MeshModifiers + { + get => mesh.modifiers; + set => mesh.modifiers = value; + } + + internal TMPCharacterModifiers CharacterModifiers; + /// /// Whether the position has been manipulated from the character's initial position. /// - public bool positionDirty => position != InitialPosition; + public bool positionDirty => CharacterModifiers.PositionDelta != Vector3.zero; + /// /// Whether the rotation has been manipulated from the character's initial rotation. /// - public bool rotationDirty => rotation != defaultRotation; + public bool rotationDirty => CharacterModifiers.Rotations.Any(); + /// /// Whether the scale has been manipulated from the character's initial scale. /// - public bool scaleDirty => scale != defaultScale; + public bool scaleDirty => CharacterModifiers.ScaleDelta != Matrix4x4.identity; + /// /// Whether the vertices have been manipulated. /// public bool verticesDirty => mesh.positionsDirty; + /// /// Whether the vertex colors have been manipulated. /// - public bool colorsDirty => mesh.colorsDirty; + public bool colorsDirty => mesh.colorsDirty; + /// /// Whether the vertex alphas have been manipulated. /// public bool alphasDirty => mesh.alphasDirty; + /// /// Whether the UVs have been manipulated. /// public bool uvsDirty => mesh.uvsDirty; + public Vector3 Position + { + get => CharacterModifiers.PositionDelta + InitialPosition; + set => CharacterModifiers.PositionDelta = value - InitialPosition; + } + /// /// The character's position. /// - public Vector3 Position => position; + public Vector3 PositionDelta + { + get => CharacterModifiers.PositionDelta; + set => CharacterModifiers.PositionDelta = value; + } + /// /// The character's scale. /// - public Vector3 Scale => scale; - /// - /// The character's rotation. - /// - public Quaternion Rotation => rotation; + public Vector3 Scale + { + get => CharacterModifiers.ScaleDelta.lossyScale; + set => CharacterModifiers.ScaleDelta = Matrix4x4.Scale(value); + } + /// - /// The character's rotation pivot. + /// The character's rotations. /// - public Vector3 RotationPivot => pivot; + public IReadOnlyList Rotations => CharacterModifiers.Rotations; #region Fields + /// /// The default scale of any CharData. /// public static readonly Vector3 defaultScale = new Vector3(1, 1, 1); + /// /// The default rotation of any CharData. /// @@ -71,6 +103,7 @@ public partial class CharData /// Holds a selection of data. /// public readonly Info info; + /// /// The mesh of the character. /// @@ -79,176 +112,126 @@ public partial class CharData /// /// The initial mesh of this character. /// - public ReadOnlyVertexData initialMesh => mesh.initial; + public readonly ReadOnlyVertexData InitialMesh; + /// /// The initial position of this character. /// public readonly Vector3 InitialPosition; + /// /// The initial rotation of this character. /// public readonly Quaternion InitialRotation; + /// /// The initial scale of this character. /// public readonly Vector3 InitialScale; - private Vector3 position; - private Vector3 scale; - private Quaternion rotation; - private Vector3 pivot; - #endregion + #endregion public CharData(int index, TMP_CharacterInfo cInfo, int wordIndex) { - VertexData vData = new VertexData(cInfo); - mesh = vData; - info = new Info(index, cInfo, wordIndex); + info = new CharData.Info(index, cInfo, wordIndex); + mesh = new VertexData(cInfo); + InitialMesh = new ReadOnlyVertexData(cInfo); InitialRotation = defaultRotation; InitialScale = defaultScale; - InitialPosition = GetCenter(in mesh.initial); - - position = InitialPosition; - rotation = defaultRotation; - scale = defaultScale; - pivot = InitialPosition; + InitialPosition = GetCenter(InitialMesh); + CharacterModifiers = new TMPCharacterModifiers(); } + public CharData(int index, TMP_CharacterInfo cInfo, int wordIndex, TMP_WordInfo? wInfo = null) { - VertexData vData = new VertexData(cInfo); - mesh = vData; - info = wInfo == null ? new Info(index, cInfo, wordIndex) : new Info(index, cInfo, wordIndex, wInfo.Value); + info = wInfo == null + ? new CharData.Info(index, cInfo, wordIndex) + : new CharData.Info(index, cInfo, wordIndex, wInfo.Value); + mesh = new VertexData(cInfo); + InitialMesh = new ReadOnlyVertexData(cInfo); InitialRotation = defaultRotation; InitialScale = defaultScale; - InitialPosition = GetCenter(in mesh.initial); - - position = InitialPosition; - rotation = defaultRotation; - scale = defaultScale; - pivot = InitialPosition; - } - - - /// - /// Set the position of the vertex at the given index. - /// - /// The index of the vertex. - /// The new position of the vertex. - public void SetVertex(int index, Vector3 position) - { - mesh.SetPosition(index, position); - } - - /// - /// Add a positon delta to the vertex at the given index. - /// - /// The index of the vertex. - /// The delta to add to the position of the vertex. - public void AddVertexDelta(int index, Vector3 delta) - { - mesh.SetPosition(index, mesh.GetPosition(index) + delta); + InitialPosition = GetCenter(InitialMesh); + CharacterModifiers = new TMPCharacterModifiers(); } + #region Position /// /// Set the position of the character. /// /// The new position of the character. public void SetPosition(Vector3 position) { - this.position = position; + CharacterModifiers.PositionDelta = position - InitialPosition; } - /// - /// Add a delta to the position of the character. - /// - /// The delta to add to the position of the character. - public void AddPositionDelta(Vector3 delta) + // public void ClearPosition() + // { + // CharacterModifiers.ClearModifierFlags(TMPCharacterModifiers.ModifierFlags.Position); + // } + #endregion + + #region PositionDelta + public void SetPositionDelta(Vector3 delta) { - position += delta; + CharacterModifiers.PositionDelta = delta; } - /// - /// Set the pivot of this character.
- /// Note that the pivot is independent of the character's position, scale and rotation. - ///
- /// The new position of the pivot. - public void SetPivot(Vector3 pivot) + public void ClearPosition() + { + CharacterModifiers.ClearModifierFlags(TMPCharacterModifiers.ModifierFlags.PositionDelta); + } + #endregion + + #region Rotations + public void AddRotation(Vector3 eulerAngles, Vector3 pivot) { - this.pivot = pivot; + CharacterModifiers.AddRotation(new Rotation(eulerAngles, pivot)); } - /// - /// Add a delta to the pivot of the character.
- /// Note that the pivot is independent of the character's position, rotation and scale. - ///
- /// The delta to add to the position of the pivot. - public void AddPivotDelta(Vector3 delta) + + public void RemoveRotation(int index) { - pivot += delta; + CharacterModifiers.RemoveRotation(index); } - /// - /// Set the rotation of this character. - /// - /// The new rotation of this character. - public void SetRotation(Quaternion rotation) + public void InsertRotation(int index, Vector3 eulerAngles, Vector3 pivot) { - this.rotation = rotation; - //this.pivot = initialPosition; + CharacterModifiers.InsertRotation(index, new Rotation(eulerAngles, pivot)); } + public void ClearRotations() + { + CharacterModifiers.ClearModifierFlags(TMPCharacterModifiers.ModifierFlags.Rotations); + } + #endregion + + #region Scale /// /// Set the scale of this character. /// /// The new scale of this character. public void SetScale(Vector3 scale) { - this.scale = scale; + CharacterModifiers.ScaleDelta = Matrix4x4.Scale(scale); + } + + public void ClearScale() + { + CharacterModifiers.ClearModifierFlags(TMPCharacterModifiers.ModifierFlags.Scale); } + #endregion /// /// Reset changes made to the character's mesh, position, rotation, scale and pivot. /// public void Reset() { - ResetPosition(); - ResetRotation(); - ResetScale(); - ResetPivot(); - mesh.Reset(); + CharacterModifiers.ClearModifierFlags(); + mesh.modifiers.ClearModifiers(); } - /// - /// Reset the character's scale. - /// - public void ResetScale() => this.scale = defaultScale; - /// - /// Reset the character's position. - /// - public void ResetPosition() => this.position = InitialPosition; - /// - /// Reset the character's rotation. - /// - public void ResetRotation() => this.rotation = defaultRotation; - /// - /// Reset the character's pivot. - /// - public void ResetPivot() => this.pivot = InitialPosition; - /// - /// Reset the character's vertices. - /// - public void ResetVertices() => mesh.ResetPositions(); - /// - /// Reset the character's UVs. - /// - public void ResetUVs() => mesh.ResetUVs(); - /// - /// Reset the character's vertex colors. - /// - public void ResetColors() => mesh.ResetColors(); - - private Vector3 GetCenter(in ReadOnlyVertexData data) { Vector3 center = Vector3.zero; @@ -256,7 +239,291 @@ private Vector3 GetCenter(in ReadOnlyVertexData data) { center += data.GetPosition(i); } + return center / 4; } } + + + // /// + // /// Holds information about a character.
+ // /// In addition to holding a selection of data supplied by the respective + // /// , accessible through the field, + // /// also holds specific data and methods to manipulate said data. + // ///
+ // public partial class CharData + // { + // /// + // /// Whether the position has been manipulated from the character's initial position. + // /// + // public bool positionDirty => position != InitialPosition; + // + // /// + // /// Whether the rotation has been manipulated from the character's initial rotation. + // /// + // public bool rotationDirty => rotation != defaultRotation; + // + // /// + // /// Whether the scale has been manipulated from the character's initial scale. + // /// + // public bool scaleDirty => scale != defaultScale; + // + // /// + // /// Whether the vertices have been manipulated. + // /// + // public bool verticesDirty => mesh.positionsDirty; + // + // /// + // /// Whether the vertex colors have been manipulated. + // /// + // public bool colorsDirty => mesh.colorsDirty; + // + // /// + // /// Whether the vertex alphas have been manipulated. + // /// + // public bool alphasDirty => mesh.alphasDirty; + // + // /// + // /// Whether the UVs have been manipulated. + // /// + // public bool uvsDirty => mesh.uvsDirty; + // + // /// + // /// The character's position. + // /// + // public Vector3 Position => position; + // + // /// + // /// The character's scale. + // /// + // public Vector3 Scale => scale; + // + // /// + // /// The character's rotation. + // /// + // public Quaternion Rotation => rotation; + // + // /// + // /// The character's rotation pivot. + // /// + // public Vector3 RotationPivot => pivot; + // + // #region Fields + // + // /// + // /// The default scale of any CharData. + // /// + // public static readonly Vector3 defaultScale = new Vector3(1, 1, 1); + // + // /// + // /// The default rotation of any CharData. + // /// + // public static readonly Quaternion defaultRotation = Quaternion.identity; + // + // /// + // /// Holds a selection of data. + // /// + // public readonly Info info; + // + // /// + // /// The mesh of the character. + // /// + // public readonly VertexData mesh; + // + // /// + // /// The initial mesh of this character. + // /// + // public ReadOnlyVertexData initialMesh => mesh.initial; + // + // /// + // /// The initial position of this character. + // /// + // public readonly Vector3 InitialPosition; + // + // /// + // /// The initial rotation of this character. + // /// + // public readonly Quaternion InitialRotation; + // + // /// + // /// The initial scale of this character. + // /// + // public readonly Vector3 InitialScale; + // + // private Vector3 position; + // private Vector3 scale; + // private Quaternion rotation; + // private Vector3 pivot; + // + // #endregion + // + // public CharData(int index, TMP_CharacterInfo cInfo, int wordIndex) + // { + // VertexData vData = new VertexData(cInfo); + // mesh = vData; + // info = new Info(index, cInfo, wordIndex); + // + // InitialRotation = defaultRotation; + // InitialScale = defaultScale; + // InitialPosition = GetCenter(in mesh.initial); + // + // position = InitialPosition; + // rotation = defaultRotation; + // scale = defaultScale; + // pivot = InitialPosition; + // } + // + // public CharData(int index, TMP_CharacterInfo cInfo, int wordIndex, TMP_WordInfo? wInfo = null) + // { + // VertexData vData = new VertexData(cInfo); + // mesh = vData; + // info = wInfo == null ? new Info(index, cInfo, wordIndex) : new Info(index, cInfo, wordIndex, wInfo.Value); + // + // InitialRotation = defaultRotation; + // InitialScale = defaultScale; + // InitialPosition = GetCenter(in mesh.initial); + // + // position = InitialPosition; + // rotation = defaultRotation; + // scale = defaultScale; + // pivot = InitialPosition; + // } + // + // + // /// + // /// Set the position of the vertex at the given index. + // /// + // /// The index of the vertex. + // /// The new position of the vertex. + // public void SetVertex(int index, Vector3 position) + // { + // mesh.SetPosition(index, position); + // } + // + // /// + // /// Add a positon delta to the vertex at the given index. + // /// + // /// The index of the vertex. + // /// The delta to add to the position of the vertex. + // public void AddVertexDelta(int index, Vector3 delta) + // { + // mesh.SetPosition(index, mesh.GetPosition(index) + delta); + // } + // + // /// + // /// Set the position of the character. + // /// + // /// The new position of the character. + // public void SetPosition(Vector3 position) + // { + // this.position = position; + // } + // + // /// + // /// Add a delta to the position of the character. + // /// + // /// The delta to add to the position of the character. + // public void AddPositionDelta(Vector3 delta) + // { + // position += delta; + // } + // + // /// + // /// Set the pivot of this character.
+ // /// Note that the pivot is independent of the character's position, scale and rotation. + // ///
+ // /// The new position of the pivot. + // public void SetPivot(Vector3 pivot) + // { + // this.pivot = pivot; + // } + // + // /// + // /// Add a delta to the pivot of the character.
+ // /// Note that the pivot is independent of the character's position, rotation and scale. + // ///
+ // /// The delta to add to the position of the pivot. + // public void AddPivotDelta(Vector3 delta) + // { + // pivot += delta; + // } + // + // /// + // /// Set the rotation of this character. + // /// + // /// The new rotation of this character. + // public void SetRotation(Quaternion rotation) + // { + // this.rotation = rotation; + // //this.pivot = initialPosition; + // } + // + // /// + // /// Set the scale of this character. + // /// + // /// The new scale of this character. + // public void SetScale(Vector3 scale) + // { + // this.scale = scale; + // } + // + // /// + // /// Reset changes made to the character's mesh, position, rotation, scale and pivot. + // /// + // public void Reset() + // { + // ResetPosition(); + // ResetRotation(); + // ResetScale(); + // ResetPivot(); + // mesh.Reset(); + // } + // + // /// + // /// Reset the character's scale. + // /// + // public void ResetScale() => this.scale = defaultScale; + // + // /// + // /// Reset the character's position. + // /// + // public void ResetPosition() => this.position = InitialPosition; + // + // /// + // /// Reset the character's rotation. + // /// + // public void ResetRotation() => this.rotation = defaultRotation; + // + // /// + // /// Reset the character's pivot. + // /// + // public void ResetPivot() => this.pivot = InitialPosition; + // + // /// + // /// Reset the character's vertices. + // /// + // public void ResetVertices() => mesh.ResetPositions(); + // + // /// + // /// Reset the character's UVs. + // /// + // public void ResetUVs() => mesh.ResetUVs(); + // + // /// + // /// Reset the character's vertex colors. + // /// + // public void ResetColors() => mesh.ResetColors(); + // + // + // private Vector3 GetCenter(in ReadOnlyVertexData data) + // { + // Vector3 center = Vector3.zero; + // for (int i = 0; i < 4; i++) + // { + // center += data.GetPosition(i); + // } + // + // return center / 4; + // } + // } } \ No newline at end of file diff --git a/Package/Runtime/CharData/CharDataState.cs b/Package/Runtime/CharData/CharDataState.cs index edac7a3..d811a77 100644 --- a/Package/Runtime/CharData/CharDataState.cs +++ b/Package/Runtime/CharData/CharDataState.cs @@ -151,10 +151,10 @@ public void Reset(AnimatorContext context, CharData cData) public void CalculateVertexPositions() { // Apply vertex transformations - Vector3 vtl = cData.initialMesh.TL_Position + TL; - Vector3 vtr = cData.initialMesh.TR_Position + TR; - Vector3 vbr = cData.initialMesh.BR_Position + BR; - Vector3 vbl = cData.initialMesh.BL_Position + BL; + Vector3 vtl = cData.InitialMesh.TL_Position + TL; + Vector3 vtr = cData.InitialMesh.TR_Position + TR; + Vector3 vbr = cData.InitialMesh.BR_Position + BR; + Vector3 vbl = cData.InitialMesh.BL_Position + BL; // For now only the vertex offsets are clamped to min/max of each individual animation, as otherwise stacked animations are likely to deform the character vtl = new Vector3(Mathf.Clamp(vtl.x, TLMin.x, TLMax.x), Mathf.Clamp(vtl.y, TLMin.y, TLMax.y), Mathf.Clamp(vtl.z, TLMin.z, TLMax.z)); @@ -199,7 +199,7 @@ public void UpdateVertexOffsets() { if (cData.positionDirty) { - positionDelta += (cData.Position - cData.InitialPosition); + positionDelta += (cData.PositionDelta - cData.InitialPosition); } if (cData.scaleDirty) @@ -207,15 +207,15 @@ public void UpdateVertexOffsets() scaleDelta *= Matrix4x4.Scale(cData.Scale); } - if (cData.rotationDirty) - { - if (cData.Rotation != Quaternion.identity || cData.Rotation.eulerAngles == Vector3.zero) - { - rotations.Add(cData.Rotation); - var scaled = cData.InitialPosition + AnimationUtility.ScaleVector((cData.RotationPivot - cData.InitialPosition), cData, context); - pivots.Add(scaled); - } - } + // if (cData.rotationDirty) + // { + // if (cData.Rotation != Quaternion.identity || cData.Rotation.eulerAngles == Vector3.zero) + // { + // rotations.Add(cData.Rotation); + // var scaled = cData.InitialPosition + AnimationUtility.ScaleVector((cData.RotationPivot - cData.InitialPosition), cData, context); + // pivots.Add(scaled); + // } + // } if (cData.verticesDirty) { diff --git a/Package/Runtime/CharData/ICharDataState.cs b/Package/Runtime/CharData/ICharDataState.cs index 6770dc5..c770648 100644 --- a/Package/Runtime/CharData/ICharDataState.cs +++ b/Package/Runtime/CharData/ICharDataState.cs @@ -23,64 +23,64 @@ public interface ICharDataState /// public IEnumerable> Rotations { get; } - /// - /// The position of the topleft vertex. - /// - public Vector3 TL { get; } - /// - /// The position of the topright vertex. - /// - public Vector3 TR { get; } - /// - /// The position of the bottomright vertex. - /// - public Vector3 BR { get; } - /// - /// The position of the bottomleft vertex. - /// - public Vector3 BL { get; } + // /// + // /// The position of the topleft vertex. + // /// + // public Vector3 TL { get; } + // /// + // /// The position of the topright vertex. + // /// + // public Vector3 TR { get; } + // /// + // /// The position of the bottomright vertex. + // /// + // public Vector3 BR { get; } + // /// + // /// The position of the bottomleft vertex. + // /// + // public Vector3 BL { get; } - /// - /// The maximum position modification of the topleft vertex.
- /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. - ///
- public Vector3 TLMax { get; } - /// - /// The maximum position modification of the topright vertex.
- /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. - ///
- public Vector3 TRMax { get; } - /// - /// The maximum position modification of the bottomright vertex.
- /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. - ///
- public Vector3 BRMax { get; } - /// - /// The maximum position modification of the bottomleft vertex.
- /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. - ///
- public Vector3 BLMax { get; } + // /// + // /// The maximum position modification of the topleft vertex.
+ // /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. + // ///
+ // public Vector3 TLMax { get; } + // /// + // /// The maximum position modification of the topright vertex.
+ // /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. + // ///
+ // public Vector3 TRMax { get; } + // /// + // /// The maximum position modification of the bottomright vertex.
+ // /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. + // ///
+ // public Vector3 BRMax { get; } + // /// + // /// The maximum position modification of the bottomleft vertex.
+ // /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. + // ///
+ // public Vector3 BLMax { get; } - /// - /// The minimum position modification of the topleft vertex.
- /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. - ///
- public Vector3 TLMin { get; } - /// - /// The minimum position modification of the topright vertex.
- /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. - ///
- public Vector3 TRMin { get; } - /// - /// The minimum position modification of the bottomleft vertex.
- /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. - ///
- public Vector3 BRMin { get; } - /// - /// The minimum position modification of the bottomleft vertex.
- /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. - ///
- public Vector3 BLMin { get; } + // /// + // /// The minimum position modification of the topleft vertex.
+ // /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. + // ///
+ // public Vector3 TLMin { get; } + // /// + // /// The minimum position modification of the topright vertex.
+ // /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. + // ///
+ // public Vector3 TRMin { get; } + // /// + // /// The minimum position modification of the bottomleft vertex.
+ // /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. + // ///
+ // public Vector3 BRMin { get; } + // /// + // /// The minimum position modification of the bottomleft vertex.
+ // /// This is used in calculating the scaling of all vertex position modifications in ; you can most likely ignore this. + // ///
+ // public Vector3 BLMin { get; } /// /// The UV value of the topleft vertex. diff --git a/Package/Runtime/CharData/Info.cs b/Package/Runtime/CharData/Info.cs index ac759f2..f177dd0 100644 --- a/Package/Runtime/CharData/Info.cs +++ b/Package/Runtime/CharData/Info.cs @@ -20,14 +20,17 @@ public struct Info /// The first index of the word this character belongs to. /// public readonly int wordFirstIndex; + /// /// The last index of the word this character belongs to. /// public readonly int wordLastIndex; + /// /// The length of the word this character belongs to. /// public readonly int wordLen; + /// /// The color of this character. /// @@ -52,10 +55,12 @@ public struct Info /// The line number of the line this character belongs to. /// public readonly int lineNumber; + /// /// The page number of the page this character belongs to. /// public readonly int pageNumber; + /// /// The inde /// @@ -65,14 +70,17 @@ public struct Info /// The baseline of the character. /// public readonly float baseLine; + /// /// The ascender of the character. /// public readonly float ascender; + /// /// The descender of the character. /// public readonly float descender; + /// /// The xAdvance factor of the character. /// @@ -82,6 +90,7 @@ public struct Info /// The font asset used for this character. /// public readonly TMP_FontAsset fontAsset; + /// /// The sprite asset used for this sprite. /// @@ -121,8 +130,7 @@ internal Info(int index, TMP_CharacterInfo cInfo, int wordIndex) referenceScale = cInfo.scale; fontAsset = cInfo.fontAsset; -#if UNITY_2023_2_OR_NEWER - +#if TMPRO_3_2_0_PRE_10_OR_NEWER if (cInfo.elementType == TMP_TextElementType.Sprite) { TMP_SpriteCharacter sprite = (TMP_SpriteCharacter)cInfo.textElement; @@ -140,7 +148,8 @@ internal Info(int index, TMP_CharacterInfo cInfo, int wordIndex) origin = cInfo.origin; } - public Info(int index, TMP_CharacterInfo cInfo, int wordIndex, TMP_WordInfo wInfo) : this(index, cInfo, wordIndex) + public Info(int index, TMP_CharacterInfo cInfo, int wordIndex, TMP_WordInfo wInfo) : this(index, cInfo, + wordIndex) { wordFirstIndex = wInfo.firstCharacterIndex; wordLastIndex = wInfo.lastCharacterIndex; @@ -148,5 +157,4 @@ public Info(int index, TMP_CharacterInfo cInfo, int wordIndex, TMP_WordInfo wInf } } } - } \ No newline at end of file diff --git a/Package/Runtime/CharData/Mesh Modifiers.meta b/Package/Runtime/CharData/Mesh Modifiers.meta new file mode 100644 index 0000000..b9a1998 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fda49a9ecbd1f6447b3f4829e3d3644c +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/Mesh Modifiers/CharDataModifiers.cs b/Package/Runtime/CharData/Mesh Modifiers/CharDataModifiers.cs new file mode 100644 index 0000000..91288bd --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/CharDataModifiers.cs @@ -0,0 +1,382 @@ +using System; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.Components.Animator; +using TMPEffects.TMPAnimations; +using UnityEngine; +using UnityEngine.Serialization; +using UnityEngine.UIElements; + +[Serializable] +public class CharDataModifiers +{ + public TMPMeshModifiers MeshModifiers + { + get => meshModifiers; + set => meshModifiers = value; + } + + public TMPCharacterModifiers CharacterModifiers + { + get => characterModifiers; + set => characterModifiers = value; + } + + [SerializeField] private TMPMeshModifiers meshModifiers; + [SerializeField] private TMPCharacterModifiers characterModifiers; + + public Vector3 BL_Result { get; private set; } + public Vector3 TL_Result { get; private set; } + public Vector3 TR_Result { get; private set; } + public Vector3 BR_Result { get; private set; } + + public CharDataModifiers() + { + meshModifiers = new TMPMeshModifiers(); + characterModifiers = new TMPCharacterModifiers(); + } + + public CharDataModifiers(CharDataModifiers original) + { + meshModifiers = new TMPMeshModifiers(original.meshModifiers); + characterModifiers = new TMPCharacterModifiers(original.characterModifiers); + } + + public void Combine(CharDataModifiers other) + { + meshModifiers.Combine(other.meshModifiers); + characterModifiers.Combine(other.characterModifiers); + } + + public void CalculateVertexPositions(CharData cData, IAnimatorContext context) + { + // Apply vertex transformations + Vector3 vbl = cData.InitialMesh.BL_Position; + Vector3 vtl = cData.InitialMesh.TL_Position; + Vector3 vtr = cData.InitialMesh.TR_Position; + Vector3 vbr = cData.InitialMesh.BR_Position; + + if (meshModifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.Deltas)) + { + vbl += AnimationUtility.ScaleVector(meshModifiers.BL_Delta, cData, context); + vtl += AnimationUtility.ScaleVector(meshModifiers.TL_Delta, cData, context); + vtr += AnimationUtility.ScaleVector(meshModifiers.TR_Delta, cData, context); + vbr += AnimationUtility.ScaleVector(meshModifiers.BR_Delta, cData, context); + } + + // TODO Clamp + // For now only the vertex offsets are clamped to min/max of each individual animation, as otherwise stacked animations are likely to deform the character + // If i want to do that again, ill need to update those in combine. + // vtl = new Vector3(Mathf.Clamp(vtl.x, TLMin.x, TLMax.x), Mathf.Clamp(vtl.y, TLMin.y, TLMax.y), Mathf.Clamp(vtl.z, TLMin.z, TLMax.z)); + // vtr = new Vector3(Mathf.Clamp(vtr.x, TRMin.x, TRMax.x), Mathf.Clamp(vtr.y, TRMin.y, TRMax.y), Mathf.Clamp(vtr.z, TRMin.z, TRMax.z)); + // vbr = new Vector3(Mathf.Clamp(vbr.x, BRMin.x, BRMax.x), Mathf.Clamp(vbr.y, BRMin.y, BRMax.y), Mathf.Clamp(vbr.z, BRMin.z, BRMax.z)); + // vbl = new Vector3(Mathf.Clamp(vbl.x, BLMin.x, BLMax.x), Mathf.Clamp(vbl.y, BLMin.y, BLMax.y), Mathf.Clamp(vbl.z, BLMin.z, BLMax.z)); + + // Apply scale + if (characterModifiers.Modifier.HasFlag(TMPCharacterModifiers.ModifierFlags.Scale)) + { + vtl = characterModifiers.ScaleDelta.MultiplyPoint3x4(vtl - cData.InitialPosition) + + cData.InitialPosition; + vtr = characterModifiers.ScaleDelta.MultiplyPoint3x4(vtr - cData.InitialPosition) + + cData.InitialPosition; + vbr = characterModifiers.ScaleDelta.MultiplyPoint3x4(vbr - cData.InitialPosition) + + cData.InitialPosition; + vbl = characterModifiers.ScaleDelta.MultiplyPoint3x4(vbl - cData.InitialPosition) + + cData.InitialPosition; + } + + // Apply rotation + if (characterModifiers.Modifier.HasFlag(TMPCharacterModifiers.ModifierFlags.Rotations)) + { + Vector3 pivot; + Matrix4x4 matrix; + for (int i = 0; i < characterModifiers.Rotations.Count; i++) + { + var rot = characterModifiers.Rotations[i]; + pivot = rot.pivot; + matrix = Matrix4x4.Rotate(Quaternion.Euler(rot.eulerAngles)); + + vbl = matrix.MultiplyPoint3x4(vbl - pivot) + pivot; + vtl = matrix.MultiplyPoint3x4(vtl - pivot) + pivot; + vtr = matrix.MultiplyPoint3x4(vtr - pivot) + pivot; + vbr = matrix.MultiplyPoint3x4(vbr - pivot) + pivot; + } + } + + // Apply transformation + // if (characterModifiers.Modifier.HasFlag(TMPCharacterModifiers.ModifierFlags.Position)) + // { + // var pos = characterModifiers.Position.GetValue(cData.InitialPosition); + // var delta = pos - cData.InitialPosition; + // vbl += delta; + // vtl += delta; + // vtr += delta; + // vbr += delta; + // } + + if (characterModifiers.Modifier.HasFlag(TMPCharacterModifiers.ModifierFlags.PositionDelta)) + { + var scaled = AnimationUtility.ScaleVector(characterModifiers.PositionDelta, cData, context); + vtl += scaled; + vtr += scaled; + vbr += scaled; + vbl += scaled; + } + + BL_Result = vbl; + TL_Result = vtl; + TR_Result = vtr; + BR_Result = vbr; + } + + static Vector3 GetPreciseScale(Matrix4x4 matrix) + { + return new Vector3( + matrix.GetColumn(0).magnitude * Mathf.Sign(matrix.m00), + matrix.GetColumn(1).magnitude * Mathf.Sign(matrix.m11), + matrix.GetColumn(2).magnitude * Mathf.Sign(matrix.m22) + ); + } + + public static void LerpUnclamped(CharData cData, CharDataModifiers start, CharDataModifiers end, float t, + CharDataModifiers result) + { + LerpCharacterModifiersUnclamped(cData, start.CharacterModifiers, end.CharacterModifiers, t, + result.CharacterModifiers); + LerpMeshModifiersUnclamped(cData, start.MeshModifiers, end.MeshModifiers, t, result.MeshModifiers); + } + + public static void LerpCharacterModifiersUnclamped(CharData cData, TMPCharacterModifiers start, + TMPCharacterModifiers end, float t, TMPCharacterModifiers result) + { + result.ClearModifierFlags(); + + var combinedFlags = end.Modifier | start.Modifier; + + if (combinedFlags.HasFlag(TMPCharacterModifiers.ModifierFlags.PositionDelta)) + { + result.PositionDelta = + Vector3.LerpUnclamped(start.PositionDelta, end.PositionDelta, t); + } + + if (combinedFlags.HasFlag(TMPCharacterModifiers.ModifierFlags.Scale)) + { + Vector3 endScale = GetPreciseScale(end.ScaleDelta); + Vector3 startScale = GetPreciseScale(start.ScaleDelta); + Vector3 lerpedScale = Vector3.LerpUnclamped(startScale, endScale, t); + + result.ScaleDelta = Matrix4x4.Scale(lerpedScale); + } + + if (combinedFlags.HasFlag(TMPCharacterModifiers.ModifierFlags.Rotations)) + { + // TODO THis probably isnt right + try + { + for (int i = 0; i < start.Rotations.Count; i++) + { + var rot = start.Rotations[i]; + result.AddRotation( + new Rotation(Vector3.LerpUnclamped(rot.eulerAngles, cData.InitialRotation.eulerAngles, t), + rot.pivot)); + } + + for (int i = 0; i < end.Rotations.Count; i++) + { + var rot = end.Rotations[i]; + result.AddRotation( + new Rotation(Vector3.LerpUnclamped(cData.InitialRotation.eulerAngles, rot.eulerAngles, t), + rot.pivot)); + } + } + catch + { + Debug.LogError("Tried to add to many with " + end.Rotations.Count); + } + } + } + + public static IAnimatorContext ctx; + + public static void LerpMeshModifiersUnclamped(CharData cData, TMPMeshModifiers start, TMPMeshModifiers end, + float t, + TMPMeshModifiers result) + { + result.ClearModifiers(); + + var combinedFlags = start.Modifier | end.Modifier; + + if (combinedFlags.HasFlag(TMPMeshModifiers.ModifierFlags.Deltas)) + { + result.BL_Delta = Vector3.LerpUnclamped(start.BL_Delta, end.BL_Delta, t); + result.TL_Delta = Vector3.LerpUnclamped(start.TL_Delta, end.TL_Delta, t); + result.TR_Delta = Vector3.LerpUnclamped(start.TR_Delta, end.TR_Delta, t); + result.BR_Delta = Vector3.LerpUnclamped(start.BR_Delta, end.BR_Delta, t); + } + + Debug.LogWarning("You better " + result.BR_Color + "; " + start.Modifier + " : " + end.Modifier); + if (end.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.Colors)) + { + if (start.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.Colors)) + { + result.BL_Color = ColorOverride.LerpUnclamped(start.BL_Color, end.BL_Color,t); + result.TL_Color = ColorOverride.LerpUnclamped(start.TL_Color, end.TL_Color,t); + result.TR_Color = ColorOverride.LerpUnclamped(start.TR_Color, end.TR_Color,t); + result.BR_Color = ColorOverride.LerpUnclamped(start.BR_Color, end.BR_Color,t); + } + else if (cData.MeshModifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.Colors)) + { + result.BL_Color = ColorOverride.LerpUnclamped(cData.MeshModifiers.BL_Color, end.BL_Color,t); + result.TL_Color = ColorOverride.LerpUnclamped(cData.MeshModifiers.TL_Color, end.TL_Color,t); + result.TR_Color = ColorOverride.LerpUnclamped(cData.MeshModifiers.TR_Color, end.TR_Color,t); + result.BR_Color = ColorOverride.LerpUnclamped(cData.MeshModifiers.BR_Color, end.BR_Color,t); + } + else if (ctx.Modifiers.MeshModifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.Colors)) + { + result.BL_Color = ColorOverride.LerpUnclamped(ctx.Modifiers.MeshModifiers.BL_Color, end.BL_Color,t); + result.TL_Color = ColorOverride.LerpUnclamped(ctx.Modifiers.MeshModifiers.TL_Color, end.TL_Color,t); + result.TR_Color = ColorOverride.LerpUnclamped(ctx.Modifiers.MeshModifiers.TR_Color, end.TR_Color,t); + result.BR_Color = ColorOverride.LerpUnclamped(ctx.Modifiers.MeshModifiers.BR_Color, end.BR_Color,t); + } + else + { + result.BL_Color = ColorOverride.LerpUnclamped(cData.InitialMesh.BL_Color, end.BL_Color, t); + result.TL_Color = ColorOverride.LerpUnclamped(cData.InitialMesh.TL_Color, end.TL_Color, t); + result.TR_Color = ColorOverride.LerpUnclamped(cData.InitialMesh.TR_Color, end.TR_Color, t); + result.BR_Color = ColorOverride.LerpUnclamped(cData.InitialMesh.BR_Color, end.BR_Color, t); + } + } + + if (combinedFlags.HasFlag(TMPMeshModifiers.ModifierFlags.UVs)) + { + var startVector = start.BL_UV0.GetValue(cData.InitialMesh.BL_UV0); + var endVector = end.BL_UV0.GetValue(cData.InitialMesh.BL_UV0); + result.BL_UV0 = + new Vector3Override(Vector3.LerpUnclamped(startVector, endVector, t)); + + startVector = start.TL_UV0.GetValue(cData.InitialMesh.TL_UV0); + endVector = end.TL_UV0.GetValue(cData.InitialMesh.TL_UV0); + result.TL_UV0 = + new Vector3Override(Vector3.LerpUnclamped(startVector, endVector, t)); + + startVector = start.TR_UV0.GetValue(cData.InitialMesh.TR_UV0); + endVector = end.TR_UV0.GetValue(cData.InitialMesh.TR_UV0); + result.TR_UV0 = + new Vector3Override(Vector3.LerpUnclamped(startVector, endVector, t)); + + startVector = start.BR_UV0.GetValue(cData.InitialMesh.BR_UV0); + endVector = end.BR_UV0.GetValue(cData.InitialMesh.BR_UV0); + result.BR_UV0 = + new Vector3Override(Vector3.LerpUnclamped(startVector, endVector, t)); + } + } + + public static CharDataModifiers LerpUnclamped(CharData cData, CharDataModifiers modifiers, float t) + { + CharDataModifiers storage = new CharDataModifiers(); + LerpUnclamped(cData, modifiers, t, storage); + return storage; + } + + public static void LerpUnclamped(CharData cData, CharDataModifiers modifiers, float t, + CharDataModifiers result) + { + LerpCharacterModifiersUnclamped(cData, modifiers.CharacterModifiers, t, result.CharacterModifiers); + LerpMeshModifiersUnclamped(cData, modifiers.MeshModifiers, t, result.MeshModifiers); + } + + public static void LerpCharacterModifiersUnclamped(CharData cData, TMPCharacterModifiers modifiers, float t, + TMPCharacterModifiers result) + { + // result.ClearModifierFlags(); + + if (modifiers.Modifier.HasFlag(TMPCharacterModifiers.ModifierFlags.PositionDelta)) + { + result.PositionDelta = + modifiers.PositionDelta * t; + } + + if (modifiers.Modifier.HasFlag(TMPCharacterModifiers.ModifierFlags.Rotations)) + { + try + { + for (int i = 0; i < modifiers.Rotations.Count; i++) + { + var rot = modifiers.Rotations[i]; + result.AddRotation( + new Rotation(Vector3.LerpUnclamped(cData.InitialRotation.eulerAngles, rot.eulerAngles, t), + rot.pivot)); + } + } + catch + { + Debug.LogError("Tried to add to many with " + modifiers.Rotations.Count); + } + } + + if (modifiers.Modifier.HasFlag(TMPCharacterModifiers.ModifierFlags.Scale)) + { + // TODO + // LossyScale is more lossy than I thought, so this is not an option + // For example: Matrix4x4.Scale(1, -1.5, 1).lossyScale = (-1, 1.5, 0) + // Vector3 endScale = modifiers.characterModifiers.ScaleDelta.lossyScale; + + // For now; GetPreciseScale. Probably fuggin slow though + // Alternatively; store list of vector3s that is combined when needed? + // Could cache that result. Hm + + Vector3 endScale = GetPreciseScale(modifiers.ScaleDelta); + Vector3 startScale = cData.InitialScale; + Vector3 lerpedScale = Vector3.LerpUnclamped(startScale, endScale, t); + + result.ScaleDelta = Matrix4x4.Scale(lerpedScale); + } + } + + public static void LerpMeshModifiersUnclamped(CharData cData, TMPMeshModifiers modifiers, float t, + TMPMeshModifiers result) + { + // result.ClearModifiers(); + + if (modifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.Deltas)) + { + result.BL_Delta = modifiers.BL_Delta * t; + result.TL_Delta = modifiers.TL_Delta * t; + result.TR_Delta = modifiers.TR_Delta * t; + result.BR_Delta = modifiers.BR_Delta * t; + } + + if (modifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.Colors)) + { + result.BL_Color = ColorOverride.LerpUnclamped(cData.InitialMesh.BL_Color, modifiers.BL_Color, t); + result.TL_Color = ColorOverride.LerpUnclamped(cData.InitialMesh.TL_Color, modifiers.TL_Color, t); + result.TR_Color = ColorOverride.LerpUnclamped(cData.InitialMesh.TR_Color, modifiers.TR_Color, t); + result.BR_Color = ColorOverride.LerpUnclamped(cData.InitialMesh.BR_Color, modifiers.BR_Color, t); + } + + if (modifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.UVs)) + { + var vector = modifiers.BL_UV0.GetValue(cData.InitialMesh.BL_UV0); + result.BL_UV0 = + new Vector3Override(Vector3.LerpUnclamped(cData.InitialMesh.BL_UV0, vector, t)); + + vector = modifiers.TL_UV0.GetValue(cData.InitialMesh.TL_UV0); + result.TL_UV0 = + new Vector3Override(Vector3.LerpUnclamped(cData.InitialMesh.TL_UV0, vector, t)); + + vector = modifiers.TR_UV0.GetValue(cData.InitialMesh.TR_UV0); + result.TR_UV0 = + new Vector3Override(Vector3.LerpUnclamped(cData.InitialMesh.TR_UV0, vector, t)); + + vector = modifiers.BR_UV0.GetValue(cData.InitialMesh.BR_UV0); + result.BR_UV0 = + new Vector3Override(Vector3.LerpUnclamped(cData.InitialMesh.BR_UV0, vector, t)); + } + } + + public void Reset() + { + meshModifiers.ClearModifiers(); + characterModifiers.ClearModifierFlags(); + } +} \ No newline at end of file diff --git a/Package/Runtime/CharData/Mesh Modifiers/CharDataModifiers.cs.meta b/Package/Runtime/CharData/Mesh Modifiers/CharDataModifiers.cs.meta new file mode 100644 index 0000000..bb4a2d9 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/CharDataModifiers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 290e7b30d7b904f418f5272f5af35286 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/Mesh Modifiers/ColorOverride.cs b/Package/Runtime/CharData/Mesh Modifiers/ColorOverride.cs new file mode 100644 index 0000000..2dc3aec --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/ColorOverride.cs @@ -0,0 +1,179 @@ +using System; +using UnityEngine; + +public interface ValueOverride +{ + public T OverrideValue { get; } + public T FallbackValue { get; } + public T Value { get; } +} + +[System.Serializable] +public struct ColorOverride +{ + public OverrideMode Override; + public Color32 Color; + + public bool OverrideAlpha => Override.HasFlag(OverrideMode.Alpha); + public bool OverrideColor => Override.HasFlag(OverrideMode.Color); + + public ColorOverride(ColorOverride original) + { + Color = original.Color; + Override = original.Override; + } + + public ColorOverride(Color32 color, OverrideMode overrideMode) + { + Override = overrideMode; + Color = color; + } + + public Color32 GetValue(Color32 fallback) + { + Color32 color; + if (OverrideColor) + color = Color; + else + color = fallback; + + if (OverrideAlpha) + color.a = Color.a; + else + color.a = fallback.a; + + return color; + } + + [Flags] + public enum OverrideMode : byte + { + None = 0, + Color = 1, + Alpha = 1 << 1 + } + + public bool Equals(ColorOverride obj) + { + return Override == obj.Override && + Color.r == obj.Color.r && + Color.g == obj.Color.g && + Color.b == obj.Color.b && + Color.a == obj.Color.a; + } + + public static ColorOverride LerpUnclamped(ColorOverride start, Color32 end, float t) + { + return LerpUnclamped(end, start, 1 - t); + } + + public static ColorOverride LerpUnclamped(Color32 start, ColorOverride end, float t) + { + if (t >= 1) + { + return new ColorOverride(end); + } + + if (t <= 0) + { + return new ColorOverride() + { + Color = start, + Override = end.Override + }; + } + + ColorOverride result = new ColorOverride(); + result.Color = Color32.LerpUnclamped(start, end.Color, t); + result.Override = end.Override; + return result; + } + + public static ColorOverride LerpUnclamped(ColorOverride start, ColorOverride end, float t) + { + ColorOverride result = new ColorOverride(); + + byte r = 0, g = 0, b = 0, a = 0; + + Color32 color; + if (t >= 1) + { + if (end.OverrideAlpha) + result.Override |= OverrideMode.Alpha; + a = end.Color.a; + + if (end.OverrideColor) + result.Override |= OverrideMode.Color; + r = end.Color.r; + g = end.Color.g; + b = end.Color.b; + color = new Color32(r, g, b, a); + } + else if (t <= 0) + { + if (start.OverrideAlpha) + result.Override |= OverrideMode.Alpha; + a = start.Color.a; + + if (start.OverrideColor) + result.Override |= OverrideMode.Color; + r = start.Color.r; + g = start.Color.g; + b = start.Color.b; + color = new Color32(r, g, b, a); + } + else + { + // TODO When should result.overridealpha flip from start.oa to end.oa + color = Color32.Lerp(start.Color, end.Color, t); + + if (start.OverrideAlpha || end.OverrideAlpha) + result.Override |= OverrideMode.Alpha; + if (start.OverrideColor || end.OverrideColor) + result.Override |= OverrideMode.Color; + } + + result.Color = color; + return result; + } + + public static ColorOverride operator +(ColorOverride lhs, ColorOverride rhs) + { + ColorOverride result = new ColorOverride(); + + byte r = 0, g = 0, b = 0, a = 0; + if (rhs.OverrideAlpha) + { + result.Override |= OverrideMode.Alpha; + a = rhs.Color.a; + } + else if (lhs.OverrideAlpha) + { + result.Override |= OverrideMode.Alpha; + a = lhs.Color.a; + } + + if (rhs.OverrideColor) + { + result.Override |= OverrideMode.Color; + r = rhs.Color.r; + g = rhs.Color.g; + b = rhs.Color.b; + } + else if (lhs.OverrideColor) + { + result.Override |= OverrideMode.Color; + r = lhs.Color.r; + g = lhs.Color.g; + b = lhs.Color.b; + } + + result.Color = new Color32(r, g, b, a); + return result; + } + + public override string ToString() + { + return "{ Color: " + Color + " Override: " + Override + " }"; + } +} \ No newline at end of file diff --git a/Package/Runtime/CharData/Mesh Modifiers/ColorOverride.cs.meta b/Package/Runtime/CharData/Mesh Modifiers/ColorOverride.cs.meta new file mode 100644 index 0000000..fce3d7d --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/ColorOverride.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 18cd76ec0544dbb40a4e6c1ae9ea5371 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/Mesh Modifiers/EditorFriendlyCharDataModifiers.cs b/Package/Runtime/CharData/Mesh Modifiers/EditorFriendlyCharDataModifiers.cs new file mode 100644 index 0000000..30431bb --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/EditorFriendlyCharDataModifiers.cs @@ -0,0 +1,200 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.Components.Animator; +using TMPEffects.Parameters; +using TMPEffects.TMPAnimations; +using UnityEngine; + +[System.Serializable] +public class EditorFriendlyRotation +{ + public Vector3 eulerAngles = Vector3.zero; + + public ParameterTypes.TypedVector3 pivot = + new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero); + + public EditorFriendlyRotation() + { + } + + public EditorFriendlyRotation(Vector3 eulerAngles, ParameterTypes.TypedVector3 pivot) + { + this.eulerAngles = eulerAngles; + this.pivot = pivot; + } +} + +[System.Serializable] +public class EditorFriendlyCharDataModifiers +{ + public ParameterTypes.TypedVector3 Position = + new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero); + + public Vector3 Scale = Vector3.one; + + public List Rotations = + new List(); + + public ParameterTypes.TypedVector3 BL_Position = + new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero); + + public ParameterTypes.TypedVector3 TL_Position = + new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero); + + public ParameterTypes.TypedVector3 TR_Position = + new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero); + + public ParameterTypes.TypedVector3 BR_Position = + new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero); + + public ColorOverride BL_Color = new ColorOverride(); + public ColorOverride TL_Color = new ColorOverride(); + public ColorOverride TR_Color = new ColorOverride(); + public ColorOverride BR_Color = new ColorOverride(); + + public ParameterTypes.TypedVector3 BL_UV0 = + new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero); + + public ParameterTypes.TypedVector3 TL_UV0 = + new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero); + + public ParameterTypes.TypedVector3 TR_UV0 = + new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero); + + public ParameterTypes.TypedVector3 BR_UV0 = + new ParameterTypes.TypedVector3(ParameterTypes.VectorType.Offset, Vector3.zero); + + + public EditorFriendlyCharDataModifiers() {} + + public EditorFriendlyCharDataModifiers(EditorFriendlyCharDataModifiers other) + { + Position = other.Position; + Scale = other.Scale; + Rotations = new List(other.Rotations); + + BL_Position = other.BL_Position; + TL_Position = other.TL_Position; + TR_Position = other.TR_Position; + BR_Position = other.BR_Position; + + BL_Color = other.BL_Color; + TL_Color = other.TL_Color; + TR_Color = other.TR_Color; + BR_Color = other.BR_Color; + + BL_UV0 = other.BL_UV0; + TL_UV0 = other.TL_UV0; + TR_UV0 = other.TR_UV0; + BR_UV0 = other.BR_UV0; + } + + private bool dirty = false; + + public void ToCharDataModifiers(CharData cData, IAnimationContext ctx, CharDataModifiers result) + => ToCharDataModifiers(cData, ctx.AnimatorContext, result); + + public void ToCharDataModifiers(CharData cData, IAnimatorContext ctx, CharDataModifiers result) + { + // Position(Delta) + if (Position.type == ParameterTypes.VectorType.Position) + { + Vector3 position = Position.IgnoreScaling(cData, ctx).ToDelta(cData); + if (position != Vector3.zero) result.CharacterModifiers.PositionDelta = position; + } + else if (Position.vector != Vector3.zero) + { + Vector3 posDelta = Position.ToDelta(cData); + if (posDelta != Vector3.zero) result.CharacterModifiers.PositionDelta = posDelta; + } + + // Scale + if (Scale != Vector3.one) + { + result.CharacterModifiers.ScaleDelta = Matrix4x4.Scale(Scale); + } + + // Rotations + if (Rotations.Count > 0) + { + for (int i = 0; i < Rotations.Count; i++) + { + var rot = Rotations[i]; + if (rot.eulerAngles != Vector3.zero) + { + Vector3 pivot = Vector3.zero; + if (rot.pivot.type == ParameterTypes.VectorType.Offset) + { + Vector3 posDelta = rot.pivot.ToPosition(cData); + pivot = posDelta; + } + else + { + Vector3 position = rot.pivot /*.IgnoreScaling(cData, ctx)*/ + .ToPosition(cData); + pivot = position; + } + + result.CharacterModifiers.AddRotation(new Rotation(rot.eulerAngles, pivot)); + } + } + } + + // Vertex colors + result.MeshModifiers.BL_Color = BL_Color; + result.MeshModifiers.TL_Color = TL_Color; + result.MeshModifiers.TR_Color = TR_Color; + result.MeshModifiers.BR_Color = BR_Color; + + // Vertex deltas + if (BL_Position.type == ParameterTypes.VectorType.Offset) + { + Vector3 posDelta = BL_Position.ToDelta(cData, cData.InitialMesh.BL_Position); + if (posDelta != Vector3.zero) result.MeshModifiers.BL_Delta = posDelta; + } + else + { + Vector3 position = BL_Position.IgnoreScaling(cData, ctx) + .ToDelta(cData, cData.InitialMesh.BL_Position); + result.MeshModifiers.BL_Delta = position; + } + + if (TL_Position.type == ParameterTypes.VectorType.Position) + { + Vector3 position = TL_Position.IgnoreScaling(cData, ctx) + .ToDelta(cData, cData.InitialMesh.TL_Position); + result.MeshModifiers.TL_Delta = position; + } + else + { + Vector3 posDelta = TL_Position.ToDelta(cData, cData.InitialMesh.TL_Position); + if (posDelta != Vector3.zero) result.MeshModifiers.TL_Delta = posDelta; + } + + if (TR_Position.type == ParameterTypes.VectorType.Position) + { + Vector3 position = TR_Position.IgnoreScaling(cData, ctx) + .ToDelta(cData, cData.InitialMesh.TR_Position); + result.MeshModifiers.TR_Delta = position; + } + else + { + Vector3 posDelta = TR_Position.ToDelta(cData, cData.InitialMesh.TR_Position); + if (posDelta != Vector3.zero) result.MeshModifiers.TR_Delta = posDelta; + } + + if (BR_Position.type == ParameterTypes.VectorType.Position) + { + Vector3 position = BR_Position.IgnoreScaling(cData, ctx) + .ToDelta(cData, cData.InitialMesh.BR_Position); + result.MeshModifiers.BR_Delta = position; + } + else + { + Vector3 posDelta = BR_Position.ToDelta(cData, cData.InitialMesh.BR_Position); + result.MeshModifiers.BR_Delta = posDelta; + } + } +} \ No newline at end of file diff --git a/Package/Runtime/CharData/Mesh Modifiers/EditorFriendlyCharDataModifiers.cs.meta b/Package/Runtime/CharData/Mesh Modifiers/EditorFriendlyCharDataModifiers.cs.meta new file mode 100644 index 0000000..e0eee4d --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/EditorFriendlyCharDataModifiers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2f5732d991eea084ba2109d2407d8d26 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/Mesh Modifiers/Rotation.cs b/Package/Runtime/CharData/Mesh Modifiers/Rotation.cs new file mode 100644 index 0000000..5cf1851 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/Rotation.cs @@ -0,0 +1,20 @@ +using System; +using UnityEngine; + +[Serializable] +public struct Rotation +{ + public Vector3 pivot; + public Vector3 eulerAngles; + + public Rotation(Vector3 eulerAngles, Vector3 pivot) + { + this.eulerAngles = eulerAngles; + this.pivot = pivot; + } + + public bool Equals(Rotation other) + { + return pivot.Equals(other.pivot) && eulerAngles.Equals(other.eulerAngles); + } +} \ No newline at end of file diff --git a/Package/Runtime/CharData/Mesh Modifiers/Rotation.cs.meta b/Package/Runtime/CharData/Mesh Modifiers/Rotation.cs.meta new file mode 100644 index 0000000..11df408 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/Rotation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 26051e706c4a6ca4cba0ff446dbc78f1 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/Mesh Modifiers/SmthThatAppliesModifiers.cs b/Package/Runtime/CharData/Mesh Modifiers/SmthThatAppliesModifiers.cs new file mode 100644 index 0000000..0d6ce30 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/SmthThatAppliesModifiers.cs @@ -0,0 +1,251 @@ + // using TMPEffects.CharacterData; + // using TMPEffects.TMPAnimations; + // using UnityEngine; + // + // public class SmthThatAppliesModifiers + // { + // private Vector3 BLMin, BLMax; + // private Vector3 TLMin, TLMax; + // private Vector3 TRMin, TRMax; + // private Vector3 BRMin, BRMax; + // + // private (Vector3 BL, Vector3 TL, Vector3 TR, Vector3 BR)? prevResult = null; + // + // public SmthThatAppliesModifiers() + // { + // } + // + // public void MakeModifierDeltasRaw(CharData cData, IAnimationContext ctx, TMPMeshModifiers modifiers) + // { + // var textCmp = ctx.AnimatorContext.Animator.TextComponent; + // var pointSize = cData.info.pointSize; + // var fontSize = ctx.AnimatorContext.Animator.TextComponent.fontSize; + // + // if (!modifiers.PositionDeltaIsRaw && modifiers.PositionDelta != Vector3.zero) + // { + // modifiers.PositionDeltaIsRaw = true; + // modifiers.PositionDelta = AnimationUtility.InverseScaleVector(modifiers.PositionDelta, textCmp, + // true, true, pointSize, fontSize); + // } + // + // if (!modifiers.BL_DeltaIsRaw && modifiers.BL_Delta != Vector3.zero) + // { + // modifiers.BL_DeltaIsRaw = true; + // modifiers.BL_Delta = AnimationUtility.InverseScaleVector(modifiers.BL_Delta, textCmp, + // true, true, pointSize, fontSize); + // } + // + // if (!modifiers.TL_DeltaIsRaw && modifiers.TL_Delta != Vector3.zero) + // { + // modifiers.TL_DeltaIsRaw = true; + // modifiers.TL_Delta = AnimationUtility.InverseScaleVector(modifiers.TL_Delta, textCmp, + // true, true, pointSize, fontSize); + // } + // + // if (!modifiers.TR_DeltaIsRaw && modifiers.TR_Delta != Vector3.zero) + // { + // modifiers.TR_DeltaIsRaw = true; + // modifiers.TR_Delta = AnimationUtility.InverseScaleVector(modifiers.TR_Delta, textCmp, + // true, true, pointSize, fontSize); + // } + // + // if (!modifiers.BR_DeltaIsRaw && modifiers.BR_Delta != Vector3.zero) + // { + // modifiers.BR_DeltaIsRaw = true; + // modifiers.BR_Delta = AnimationUtility.InverseScaleVector(modifiers.BR_Delta, textCmp, + // true, true, pointSize, fontSize); + // } + // } + // + // // TODO The applier (TMPMeshModifierApplier or so) should be reused within the actual animator + // // (/ in the chardatastate). Does this method still make sense then? + // public void ApplyToCharData(CharData cData, TMPMeshModifiers modifiers) + // { + // if (modifiers.PositionDelta != Vector3.zero) + // cData.SetPosition(cData.InitialPosition + modifiers.PositionDelta); + // + // if (modifiers.RotationDelta != Quaternion.identity) + // cData.SetRotation(cData.InitialRotation * modifiers.RotationDelta); + // + // // TODO I want to be able to use simple V3 scale -- why didnt i originally? some shit with order of applying? + // // if (step.Modifiers.ScaleDelta != Vector3.one) + // + // if (modifiers.BL_Delta != Vector3.zero) + // cData.SetVertex(0, cData.initialMesh.BL_Position + modifiers.BL_Delta); + // + // if (modifiers.TL_Delta != Vector3.zero) + // cData.SetVertex(1, cData.initialMesh.TL_Position + modifiers.TL_Delta); + // + // if (modifiers.TR_Delta != Vector3.zero) + // cData.SetVertex(2, cData.initialMesh.TR_Position + modifiers.TR_Delta); + // + // if (modifiers.BR_Delta != Vector3.zero) + // cData.SetVertex(3, cData.initialMesh.BR_Position + modifiers.BR_Delta); + // + // + // if (modifiers.BL_Color.OverrideColor) + // cData.mesh.SetColor(0, modifiers.BL_Color.Color, !modifiers.BL_Color.OverrideAlpha); + // else if (modifiers.BL_Color.OverrideAlpha) + // cData.mesh.SetAlpha(0, modifiers.BL_Color.Color.a); + // + // if (modifiers.TL_Color.OverrideColor) + // cData.mesh.SetColor(1, modifiers.TL_Color.Color, !modifiers.TL_Color.OverrideAlpha); + // else if (modifiers.TL_Color.OverrideAlpha) + // cData.mesh.SetAlpha(1, modifiers.TL_Color.Color.a); + // + // if (modifiers.TR_Color.OverrideColor) + // cData.mesh.SetColor(2, modifiers.TR_Color.Color, !modifiers.TR_Color.OverrideAlpha); + // else if (modifiers.TR_Color.OverrideAlpha) + // cData.mesh.SetAlpha(2, modifiers.TR_Color.Color.a); + // + // if (modifiers.BR_Color.OverrideColor) + // cData.mesh.SetColor(3, modifiers.BR_Color.Color, !modifiers.BR_Color.OverrideAlpha); + // else if (modifiers.BR_Color.OverrideAlpha) + // cData.mesh.SetAlpha(3, modifiers.TL_Color.Color.a); + // + // if (modifiers.BL_UV0 != Vector3.zero) + // cData.mesh.SetUV0(0, modifiers.BL_UV0); + // + // if (modifiers.TL_UV0 != Vector3.zero) + // cData.mesh.SetUV0(1, modifiers.TL_UV0); + // + // if (modifiers.TR_UV0 != Vector3.zero) + // cData.mesh.SetUV0(2, modifiers.TR_UV0); + // + // if (modifiers.BR_UV0 != Vector3.zero) + // cData.mesh.SetUV0(3, modifiers.BR_UV0); + // } + // + // // TODO qucik test method to see if TMPMEshmodifiers works in concept + // public void ApplyToCurrentCharData(CharData cData, TMPMeshModifiers modifiers) + // { + // if (modifiers.PositionDelta != Vector3.zero) + // cData.SetPosition(cData.Position + modifiers.PositionDelta); + // + // if (modifiers.RotationDelta != Quaternion.identity) + // cData.SetRotation(cData.Rotation * modifiers.RotationDelta); + // + // // TODO I want to be able to use simple V3 scale -- why didnt i originally? some shit with order of applying? + // if (modifiers.ScaleDelta != Matrix4x4.identity) + // cData.SetScale(modifiers.ScaleDelta.MultiplyPoint3x4(Vector3.one)); + // + // if (modifiers.BL_Delta != Vector3.zero) + // cData.AddVertexDelta(0, modifiers.BL_Delta); + // + // if (modifiers.TL_Delta != Vector3.zero) + // cData.AddVertexDelta(1, modifiers.TL_Delta); + // + // if (modifiers.TR_Delta != Vector3.zero) + // cData.AddVertexDelta(2, modifiers.TR_Delta); + // + // if (modifiers.BR_Delta != Vector3.zero) + // cData.AddVertexDelta(3, modifiers.BR_Delta); + // + // + // if (modifiers.BL_Color.OverrideColor) + // cData.mesh.SetColor(0, modifiers.BL_Color.Color, !modifiers.BL_Color.OverrideAlpha); + // else if (modifiers.BL_Color.OverrideAlpha) + // cData.mesh.SetAlpha(0, modifiers.BL_Color.Color.a); + // + // if (modifiers.TL_Color.OverrideColor) + // cData.mesh.SetColor(1, modifiers.TL_Color.Color, !modifiers.TL_Color.OverrideAlpha); + // else if (modifiers.TL_Color.OverrideAlpha) + // cData.mesh.SetAlpha(1, modifiers.TL_Color.Color.a); + // + // if (modifiers.TR_Color.OverrideColor) + // cData.mesh.SetColor(2, modifiers.TR_Color.Color, !modifiers.TR_Color.OverrideAlpha); + // else if (modifiers.TR_Color.OverrideAlpha) + // cData.mesh.SetAlpha(2, modifiers.TR_Color.Color.a); + // + // if (modifiers.BR_Color.OverrideColor) + // cData.mesh.SetColor(3, modifiers.BR_Color.Color, !modifiers.BR_Color.OverrideAlpha); + // else if (modifiers.BR_Color.OverrideAlpha) + // cData.mesh.SetAlpha(3, modifiers.TL_Color.Color.a); + // + // if (modifiers.BL_UV0 != Vector3.zero) + // cData.mesh.SetUV0(0, modifiers.BL_UV0); + // + // if (modifiers.TL_UV0 != Vector3.zero) + // cData.mesh.SetUV0(1, modifiers.TL_UV0); + // + // if (modifiers.TR_UV0 != Vector3.zero) + // cData.mesh.SetUV0(2, modifiers.TR_UV0); + // + // if (modifiers.BR_UV0 != Vector3.zero) + // cData.mesh.SetUV0(3, modifiers.BR_UV0); + // } + // + // // TODO shouldnt have to pass in cdata; make some interface or w/e + // public (Vector3 BL, Vector3 TL, Vector3 TR, Vector3 BR) CalculateVertexPositions(CharData cData, + // TMPMeshModifiers modifiers) + // { + // if (modifiers.Dirty == TMPMeshModifiers.DirtyFlags.None && prevResult.HasValue) + // { + // return prevResult.Value; + // } + // + // Vector3 vbl = cData.initialMesh.BL_Position; //+ modifiers.BL_Delta; + // Vector3 vtl = cData.initialMesh.TL_Position; // + modifiers.TL_Delta; + // Vector3 vtr = cData.initialMesh.TR_Position; // + modifiers.TR_Delta; + // Vector3 vbr = cData.initialMesh.BR_Position; // + modifiers.BR_Delta; + // + // // Apply scale + // vbl = modifiers.ScaleDelta.MultiplyPoint3x4(vbl - cData.InitialPosition) + cData.InitialPosition; + // vtl = modifiers.ScaleDelta.MultiplyPoint3x4(vtl - cData.InitialPosition) + cData.InitialPosition; + // vtr = modifiers.ScaleDelta.MultiplyPoint3x4(vtr - cData.InitialPosition) + cData.InitialPosition; + // vbr = modifiers.ScaleDelta.MultiplyPoint3x4(vbr - cData.InitialPosition) + cData.InitialPosition; + // + // // Apply rotation TODO + // // Vector3 pivot; + // Matrix4x4 matrix = Matrix4x4.Rotate(modifiers.RotationDelta); + // vtl = matrix.MultiplyPoint3x4(vtl); + // vtr = matrix.MultiplyPoint3x4(vtr); + // vbr = matrix.MultiplyPoint3x4(vbr); + // vbl = matrix.MultiplyPoint3x4(vbl); + // + // // TODO Moved those after scaling; since its, well a transformation too. Might have to do the same in CHarDataState + // // TODO Actually it might not be that simple; this does mess with the appearance more than i assumed; maybe separate pre/post modifications? idk + // // Apply vertex transformations + // vbl += modifiers.BL_Delta; + // vtl += modifiers.TL_Delta; + // vtr += modifiers.TR_Delta; + // vbr += modifiers.BR_Delta; + // + // // Apply transformation + // var scaled = modifiers.PositionDelta; + // vbl += scaled; + // vtl += scaled; + // vtr += scaled; + // vbr += scaled; + // + // modifiers.ClearDirtyFlags(); + // prevResult = (vbl, vtl, vtr, vbr); + // return prevResult.Value; + // } + // + // public (Color32 BL, Color32 TL, Color32 TR, Color32 BR) CalculateVertexColors(CharData cData, + // TMPMeshModifiers modifiers) + // { + // throw new System.NotImplementedException(); + // // return + // // ( + // // modifiers.BL_Color.HasValue ? modifiers.BL_Color.Value : cData.initialMesh.BL_Color, + // // modifiers.TL_Color.HasValue ? modifiers.TL_Color.Value : cData.initialMesh.TL_Color, + // // modifiers.TR_Color.HasValue ? modifiers.TR_Color.Value : cData.initialMesh.TR_Color, + // // modifiers.BR_Color.HasValue ? modifiers.BR_Color.Value : cData.initialMesh.BR_Color + // // ); + // } + // + // // TODO same as above + need to have some default value for colors (=> not set); probably nullable + // public (Vector3 BL, Vector3 TL, Vector3 TR, Vector3 BR) CalculateVertexUVs(CharData cData, + // TMPMeshModifiers modifiers) + // { + // return + // ( + // cData.initialMesh.BL_UV0, + // cData.initialMesh.TL_UV0, + // cData.initialMesh.TR_UV0, + // cData.initialMesh.BR_UV0 + // ); + // } + // } \ No newline at end of file diff --git a/Package/Runtime/CharData/Mesh Modifiers/SmthThatAppliesModifiers.cs.meta b/Package/Runtime/CharData/Mesh Modifiers/SmthThatAppliesModifiers.cs.meta new file mode 100644 index 0000000..7cbb7d4 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/SmthThatAppliesModifiers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5fc3eb58f99e92d46a418acb71de332d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/Mesh Modifiers/TMPCharacterModifiers.cs b/Package/Runtime/CharData/Mesh Modifiers/TMPCharacterModifiers.cs new file mode 100644 index 0000000..f6414fa --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/TMPCharacterModifiers.cs @@ -0,0 +1,198 @@ +using System; +using System.Collections.Generic; +using System.Collections.ObjectModel; +using UnityEngine; + +[Serializable] +public class TMPCharacterModifiers +{ + public ModifierFlags Modifier => modifier; + + // public Vector3Override Position + // { + // get => position; + // set + // { + // if (value == position) return; + // if (!value.Override) + // { + // ClearScale(); + // return; + // } + // position = value; + // modifier |= ModifierFlags.Position; + // } + // } + + public Vector3 PositionDelta + { + get => positionDelta; + set + { + if (value == positionDelta) return; + if (value == Vector3.zero) + { + ClearPositionDelta(); + return; + } + + positionDelta = value; + modifier |= ModifierFlags.PositionDelta; + } + } + + public Matrix4x4 ScaleDelta + { + get => scaleDelta; + set + { + // TODO This comparison is slowish + // if (value == scaleDelta) return; + // Maybe go back to having to explicitly clear the changes? + // if (value == Matrix4x4.identity) + // { + // ClearScale(); + // return; + // } + scaleDelta = value; + modifier |= ModifierFlags.Scale; + } + } + + public ReadOnlyCollection Rotations + { + get + { + if (rotationsReadOnly == null) + rotationsReadOnly = new ReadOnlyCollection(rotations); + return rotationsReadOnly; + } + } + + public void InsertRotation(int index, Rotation rotation) + { + rotations.Insert(index, rotation); + modifier |= ModifierFlags.Rotations; + } + + public void AddRotation(Rotation rotation) + { + if (rotations.Count > 100) throw new System.Exception("Cannot add more than 100 rotations."); + rotations.Add(rotation); + modifier |= ModifierFlags.Rotations; + } + + public void RemoveRotation(int index) + { + rotations.RemoveAt(index); + if (rotations.Count == 0) ClearRotations(); + } + + // [SerializeField] private Vector3Override position = Vector3Override.GetDefault; + [SerializeField] private Vector3 positionDelta = Vector3.zero; + [SerializeField] private Matrix4x4 scaleDelta = Matrix4x4.Scale(Vector3.one); + [SerializeField] private List rotations = new List(); + [SerializeField] private ModifierFlags modifier; + private ReadOnlyCollection rotationsReadOnly; + + public TMPCharacterModifiers() + { + } + + public TMPCharacterModifiers(TMPCharacterModifiers original) + { + // position = original.position; + positionDelta = original.positionDelta; + scaleDelta = original.scaleDelta; + rotations = new List(original.rotations); + modifier = original.Modifier; + } + + public void Combine(TMPCharacterModifiers other) + { + // if (other.Position.Override) + // { + // position = other.position; + // } + + if (other.Modifier.HasFlag(ModifierFlags.PositionDelta)) + { + positionDelta += other.positionDelta; + } + + if (other.Modifier.HasFlag(ModifierFlags.Scale)) + { + scaleDelta *= other.ScaleDelta; + } + + if (other.Modifier.HasFlag(ModifierFlags.Rotations)) + { + for (int i = 0; i < other.rotations.Count; i++) + { + rotations.Add(other.rotations[i]); + } + } + + modifier |= other.Modifier; + } + + [Flags] + public enum ModifierFlags : int + { + // Position = 1, + PositionDelta = 1 << 1, + Rotations = 1 << 2, + Scale = 1 << 3 + } + + public void ClearModifierFlags() + { + if (modifier.HasFlag(ModifierFlags.PositionDelta)) + ClearPositionDelta(); + if (modifier.HasFlag(ModifierFlags.Rotations)) + ClearRotations(); + if (modifier.HasFlag(ModifierFlags.Scale)) + ClearScale(); + } + + public void ClearModifierFlags(ModifierFlags flags) + { + var both = modifier & flags; + + // if (both.HasFlag(ModifierFlags.Position)) + // ClearPosition(); + + if (both.HasFlag(ModifierFlags.PositionDelta)) + ClearPositionDelta(); + + if (both.HasFlag(ModifierFlags.Rotations)) + ClearRotations(); + + if (both.HasFlag(ModifierFlags.Scale)) + ClearScale(); + } + + // private void ClearPosition() + // { + // modifier &= ~ModifierFlags.Position; + // position = Vector3Override.GetDefault; + // } + + private void ClearRotations() + { + modifier &= ~ModifierFlags.Rotations; + rotations.Clear(); + } + + private void ClearPositionDelta() + { + modifier &= ~ModifierFlags.PositionDelta; + positionDelta = Vector3.zero; + } + + private void ClearScale() + { + modifier &= ~ModifierFlags.Scale; + scaleDelta = Matrix4x4.identity; + } +} \ No newline at end of file diff --git a/Package/Runtime/CharData/Mesh Modifiers/TMPCharacterModifiers.cs.meta b/Package/Runtime/CharData/Mesh Modifiers/TMPCharacterModifiers.cs.meta new file mode 100644 index 0000000..16831d9 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/TMPCharacterModifiers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0aff1275e1fe2b845beb1ebbec60b8c8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/Mesh Modifiers/TMPMeshModifiers.cs b/Package/Runtime/CharData/Mesh Modifiers/TMPMeshModifiers.cs new file mode 100644 index 0000000..3b836b7 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/TMPMeshModifiers.cs @@ -0,0 +1,386 @@ +using System; +using System.Runtime.CompilerServices; +using UnityEditor; +using UnityEngine; +using UnityEngine.Serialization; + +[Serializable] +public class TMPMeshModifiers +{ + public Vector3 BL_Delta + { + get => bl_Delta; + set + { + if (value == bl_Delta) return; + bl_Delta = value; + modifier |= ModifierFlags.Deltas; + } + } + + public Vector3 TL_Delta + { + get => tl_Delta; + set + { + if (value == tl_Delta) return; + tl_Delta = value; + modifier |= ModifierFlags.Deltas; + } + } + + public Vector3 TR_Delta + { + get => tr_Delta; + set + { + if (value == tr_Delta) return; + tr_Delta = value; + modifier |= ModifierFlags.Deltas; + } + } + + public Vector3 BR_Delta + { + get => br_Delta; + set + { + if (value == br_Delta) return; + br_Delta = value; + modifier |= ModifierFlags.Deltas; + } + } + + public ColorOverride BL_Color + { + get { return bl_Color; } + set + { + if (value.Equals(bl_Color)) return; + if (value.Override == 0) + { + ClearColors(); + return; + } + bl_Color = value; + modifier |= ModifierFlags.Colors; + } + } + + public ColorOverride TL_Color + { + get { return tl_Color; } + set + { + if (value.Equals(tl_Color)) return; + if (value.Override == 0) + { + ClearColors(); + return; + } + tl_Color = value; + modifier |= ModifierFlags.Colors; + } + } + + public ColorOverride TR_Color + { + get { return tr_Color; } + set + { + if (value.Equals(tr_Color)) return; + if (value.Override == 0) + { + ClearColors(); + return; + } + tr_Color = value; + modifier |= ModifierFlags.Colors; + } + } + + public ColorOverride BR_Color + { + get { return br_Color; } + set + { + if (value.Equals(br_Color)) return; + if (value.Override == 0) + { + ClearColors(); + return; + } + br_Color = value; + modifier |= ModifierFlags.Colors; + } + } + + public Vector3Override BL_UV0 + { + get => bl_UV0; + set + { + if (value == bl_UV0) return; + bl_UV0 = value; + modifier |= ModifierFlags.UVs; + } + } + + public Vector3Override TL_UV0 + { + get => tl_UV0; + set + { + if (value == tl_UV0) return; + tl_UV0 = value; + modifier |= ModifierFlags.UVs; + } + } + + public Vector3Override TR_UV0 + { + get => tr_UV0; + set + { + if (value == tr_UV0) return; + tr_UV0 = value; + modifier |= ModifierFlags.UVs; + } + } + + public Vector3Override BR_UV0 + { + get => br_UV0; + set + { + if (value == br_UV0) return; + br_UV0 = value; + modifier |= ModifierFlags.UVs; + } + } + + public Vector3Override BL_UV2 + { + get => bl_UV2; + set + { + if (value == bl_UV2) return; + bl_UV2 = value; + modifier |= ModifierFlags.UVs; + } + } + + public Vector3Override TL_UV2 + { + get => tl_UV2; + set + { + if (value == tl_UV2) return; + tl_UV2 = value; + modifier |= ModifierFlags.UVs; + } + } + + public Vector3Override TR_UV2 + { + get => tr_UV2; + set + { + if (value == tr_UV2) return; + tr_UV2 = value; + modifier |= ModifierFlags.UVs; + } + } + + public Vector3Override BR_UV2 + { + get => br_UV2; + set + { + if (value == br_UV2) return; + br_UV2 = value; + modifier |= ModifierFlags.UVs; + } + } + + [SerializeField] private Vector3 bl_Delta; + [SerializeField] private Vector3 tl_Delta; + [SerializeField] private Vector3 tr_Delta; + [SerializeField] private Vector3 br_Delta; + + [SerializeField] private ColorOverride bl_Color; + [SerializeField] private ColorOverride tl_Color; + [SerializeField] private ColorOverride tr_Color; + [SerializeField] private ColorOverride br_Color; + + [SerializeField] private Vector3Override bl_UV0; + [SerializeField] private Vector3Override tl_UV0; + [SerializeField] private Vector3Override tr_UV0; + [SerializeField] private Vector3Override br_UV0; + + [SerializeField] private Vector3Override bl_UV2; + [SerializeField] private Vector3Override tl_UV2; + [SerializeField] private Vector3Override tr_UV2; + [SerializeField] private Vector3Override br_UV2; + + public ModifierFlags Modifier => modifier; + [SerializeField] private ModifierFlags modifier; + + public TMPMeshModifiers() + { + } + + public TMPMeshModifiers(TMPMeshModifiers original) + { + bl_Delta = original.bl_Delta; + tl_Delta = original.tl_Delta; + tr_Delta = original.tr_Delta; + br_Delta = original.br_Delta; + + bl_UV0 = original.bl_UV0; + tl_UV0 = original.tl_UV0; + tr_UV0 = original.tr_UV0; + br_UV0 = original.br_UV0; + + bl_UV2 = original.bl_UV2; + tl_UV2 = original.tl_UV2; + tr_UV2 = original.tr_UV2; + br_UV2 = original.br_UV2; + + bl_Color = original.bl_Color; + tl_Color = original.tl_Color; + tr_Color = original.tr_Color; + br_Color = original.br_Color; + + modifier = original.Modifier; + } + + public void ClearModifiers() + { + if (modifier.HasFlag(ModifierFlags.Deltas)) + ClearDeltas(); + if (modifier.HasFlag(ModifierFlags.Colors)) + ClearColors(); + if (modifier.HasFlag(ModifierFlags.UVs)) + ClearUVs(); + } + + public void ClearModifiers(ModifierFlags flags) + { + var both = modifier & flags; + + if (both.HasFlag(ModifierFlags.Deltas)) + ClearDeltas(); + + if (both.HasFlag(ModifierFlags.Colors)) + ClearColors(); + + if (both.HasFlag(ModifierFlags.UVs)) + ClearUVs(); + } + + private void ClearDeltas() + { + bl_Delta = Vector3.zero; + tl_Delta = Vector3.zero; + tr_Delta = Vector3.zero; + br_Delta = Vector3.zero; + modifier &= ~ModifierFlags.Deltas; + } + + private void ClearColors() + { + bl_Color = new ColorOverride(); + tl_Color = new ColorOverride(); + tr_Color = new ColorOverride(); + br_Color = new ColorOverride(); + modifier &= ~ModifierFlags.Colors; + } + + private void ClearUVs() + { + bl_UV0 = Vector3Override.GetDefault; + tl_UV0 = Vector3Override.GetDefault; + tr_UV0 = Vector3Override.GetDefault; + br_UV0 = Vector3Override.GetDefault; + + bl_UV2 = Vector3Override.GetDefault; + tl_UV2 = Vector3Override.GetDefault; + tr_UV2 = Vector3Override.GetDefault; + br_UV2 = Vector3Override.GetDefault; + modifier &= ~ModifierFlags.UVs; + } + + public void Combine(TMPMeshModifiers other) + { + if (other.modifier.HasFlag(ModifierFlags.Deltas)) + { + BL_Delta += other.BL_Delta; + TL_Delta += other.TL_Delta; + TR_Delta += other.TR_Delta; + BR_Delta += other.BR_Delta; + } + + if (other.modifier.HasFlag(ModifierFlags.Colors)) + { + BL_Color += other.BL_Color; // TODO does thiswork + TL_Color += other.TL_Color; + TR_Color += other.TR_Color; + BR_Color += other.BR_Color; + } + + if (other.modifier.HasFlag(ModifierFlags.UVs)) + { + BL_UV0 += other.BL_UV0; + TL_UV0 += other.TL_UV0; + TR_UV0 += other.TR_UV0; + BR_UV0 += other.BR_UV0; + + BL_UV2 += other.BL_UV2; + TL_UV2 += other.TL_UV2; + TR_UV2 += other.TR_UV2; + BR_UV2 += other.BR_UV2; + } + + modifier |= other.modifier; + } + + public static TMPMeshModifiers operator +(TMPMeshModifiers lhs, TMPMeshModifiers rhs) + { + if (rhs.modifier.HasFlag(ModifierFlags.Deltas)) + { + lhs.BL_Delta += rhs.BL_Delta; + lhs.TL_Delta += rhs.TL_Delta; + lhs.TR_Delta += rhs.TR_Delta; + lhs.BR_Delta += rhs.BR_Delta; + } + + if (rhs.modifier.HasFlag(ModifierFlags.Colors)) + { + lhs.BL_Color += rhs.BL_Color; // TODO does thiswork + lhs.TL_Color += rhs.TL_Color; + lhs.TR_Color += rhs.TR_Color; + lhs.BR_Color += rhs.BR_Color; + } + + if (rhs.modifier.HasFlag(ModifierFlags.UVs)) + { + lhs.BL_UV0 += rhs.BL_UV0; + lhs.TL_UV0 += rhs.TL_UV0; + lhs.TR_UV0 += rhs.TR_UV0; + lhs.BR_UV0 += rhs.BR_UV0; + } + + return lhs; + } + + [Flags] + public enum ModifierFlags : byte + { + Deltas = 1, + Colors = 1 << 1, + UVs = 1 << 2, + + All = byte.MaxValue + } +} \ No newline at end of file diff --git a/Package/Runtime/CharData/Mesh Modifiers/TMPMeshModifiers.cs.meta b/Package/Runtime/CharData/Mesh Modifiers/TMPMeshModifiers.cs.meta new file mode 100644 index 0000000..892b624 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/TMPMeshModifiers.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ba8687c0905a61d469d901fc16b346b2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/Mesh Modifiers/Text (TMP)Timeline.playable b/Package/Runtime/CharData/Mesh Modifiers/Text (TMP)Timeline.playable new file mode 100644 index 0000000..cbbd4d6 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/Text (TMP)Timeline.playable @@ -0,0 +1,632 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-4571837118181190839 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 904f8d22bfe6f2147af0c2edc5912739, type: 3} + m_Name: TMP Mesh Modifier Track (1) + m_EditorClassIdentifier: + m_Version: 3 + m_AnimClip: {fileID: 0} + m_Locked: 0 + m_Muted: 0 + m_CustomPlayableFullTypename: + m_Curves: {fileID: 0} + m_Parent: {fileID: 11400000} + m_Children: [] + m_Clips: + - m_Version: 1 + m_Start: 0.6 + m_ClipIn: 0 + m_Asset: {fileID: -4569212695537509569} + m_Duration: 2.3833333333333333 + m_TimeScale: 1 + m_ParentTrack: {fileID: -4571837118181190839} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0 + m_BlendOutDuration: 0 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: 0 + m_PreExtrapolationTime: 0 + m_DisplayName: TMPMeshModifierClip + m_Markers: + m_Objects: [] +--- !u!114 &-4569212695537509569 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73fa5eac7a691b04692db83c6d3e95f3, type: 3} + m_Name: TMPMeshModifierClip + m_EditorClassIdentifier: + step: + Step: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 2.3833334 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + lastMovedEntry: 0 +--- !u!114 &-1071990663621319272 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73fa5eac7a691b04692db83c6d3e95f3, type: 3} + m_Name: TMPMeshModifierClip + m_EditorClassIdentifier: + step: + Step: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 2.3833334 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + lastMovedEntry: 0 +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bfda56da833e2384a9677cd3c976a436, type: 3} + m_Name: Text (TMP)Timeline + m_EditorClassIdentifier: + m_Version: 0 + m_Tracks: + - {fileID: 2141070420333279662} + - {fileID: -4571837118181190839} + m_FixedDuration: 0 + m_EditorSettings: + m_Framerate: 60 + m_ScenePreview: 1 + m_DurationMode: 0 + m_MarkerTrack: {fileID: 0} +--- !u!114 &2141070420333279662 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 904f8d22bfe6f2147af0c2edc5912739, type: 3} + m_Name: TMP Mesh Modifier Track + m_EditorClassIdentifier: + m_Version: 3 + m_AnimClip: {fileID: 0} + m_Locked: 0 + m_Muted: 0 + m_CustomPlayableFullTypename: + m_Curves: {fileID: 0} + m_Parent: {fileID: 11400000} + m_Children: [] + m_Clips: + - m_Version: 1 + m_Start: 0.6 + m_ClipIn: 0 + m_Asset: {fileID: -1071990663621319272} + m_Duration: 2.3833333333333333 + m_TimeScale: 1 + m_ParentTrack: {fileID: 2141070420333279662} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0 + m_BlendOutDuration: 0 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: 0 + m_PreExtrapolationTime: 0 + m_DisplayName: TMPMeshModifierClip + m_Markers: + m_Objects: [] diff --git a/Package/Runtime/CharData/Mesh Modifiers/Text (TMP)Timeline.playable.meta b/Package/Runtime/CharData/Mesh Modifiers/Text (TMP)Timeline.playable.meta new file mode 100644 index 0000000..92fd865 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/Text (TMP)Timeline.playable.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 39279cc02b2aa0a468acc0ddb7edf91e +NativeFormatImporter: + externalObjects: {} + mainObjectFileID: 11400000 + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/Mesh Modifiers/UVOverride.cs b/Package/Runtime/CharData/Mesh Modifiers/UVOverride.cs new file mode 100644 index 0000000..e69de29 diff --git a/Package/Runtime/CharData/Mesh Modifiers/UVOverride.cs.meta b/Package/Runtime/CharData/Mesh Modifiers/UVOverride.cs.meta new file mode 100644 index 0000000..2601c17 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/UVOverride.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2521ed73526471a44879d3e0ddc7b38b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/Mesh Modifiers/Vector3Override.cs b/Package/Runtime/CharData/Mesh Modifiers/Vector3Override.cs new file mode 100644 index 0000000..dda29cd --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/Vector3Override.cs @@ -0,0 +1,69 @@ +using System; +using UnityEngine; + +[Serializable] +public struct Vector3Override +{ + public Vector3 OverrideValue => _overrideValue; + public bool Override => _override; + + private bool _override; + private Vector3 _overrideValue; + + public static Vector3Override Default = new Vector3Override(null); + public static Vector3Override GetDefault => Default; + + public Vector3Override(Vector3? overrideValue = null) + { + if (overrideValue.HasValue) + { + _overrideValue = overrideValue.Value; + _override = true; + } + else + { + _overrideValue = Vector3.zero; + _override = false; + } + } + + public Vector3 GetValue(Vector3 fallback) + { + if (Override) return OverrideValue; + return fallback; + } + + public static bool operator ==(Vector3Override a, Vector3Override b) + { + return a.Override == b.Override && a.OverrideValue == b.OverrideValue; + } + + public static bool operator !=(Vector3Override a, Vector3Override b) + { + return a.Override != b.Override || a.OverrideValue != b.OverrideValue; + } + + public static Vector3Override operator +(Vector3Override a, Vector3Override b) + { + if (a.Override) + { + if (b.Override) + return new Vector3Override(a.OverrideValue + b.OverrideValue); + + return new Vector3Override(a.OverrideValue); + } + + if (b.Override) + return new Vector3Override(b.OverrideValue); + + return new Vector3Override(); + } + + public bool Equals(Vector3Override other) + { + if (!other._override) return !_override; + if (!_override) return false; + return _overrideValue == other._overrideValue; + + } +} \ No newline at end of file diff --git a/Package/Runtime/CharData/Mesh Modifiers/Vector3Override.cs.meta b/Package/Runtime/CharData/Mesh Modifiers/Vector3Override.cs.meta new file mode 100644 index 0000000..f1c65a2 --- /dev/null +++ b/Package/Runtime/CharData/Mesh Modifiers/Vector3Override.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5eba868135e489947a9c1cfbe773a2bd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CharData/ReadOnlyVertexData.cs b/Package/Runtime/CharData/ReadOnlyVertexData.cs index 60d7593..f3fa9f1 100644 --- a/Package/Runtime/CharData/ReadOnlyVertexData.cs +++ b/Package/Runtime/CharData/ReadOnlyVertexData.cs @@ -25,12 +25,6 @@ public class ReadOnlyVertexData /// private TMP_Vertex vertex_BR; - - /// - /// The initial vertex of the character. - /// - public readonly ReadOnlyVertexData initial; - /// /// Get or set the color of the bottom left vertex.
/// Note that this will mark both colors and alphas as dirty.
diff --git a/Package/Runtime/CharData/VertexData.cs b/Package/Runtime/CharData/VertexData.cs index 8f7afa8..21e1d0d 100644 --- a/Package/Runtime/CharData/VertexData.cs +++ b/Package/Runtime/CharData/VertexData.cs @@ -8,18 +8,23 @@ namespace TMPEffects.CharacterData ///
public class VertexData { + internal TMPMeshModifiers modifiers; + /// /// The bottom left vertex. Index = 0 /// private TMP_Vertex vertex_BL; + /// /// The top left vertex. Index = 1 /// private TMP_Vertex vertex_TL; + /// /// The top right vertex. Index = 2 /// private TMP_Vertex vertex_TR; + /// /// The bottom right vertex. Index = 3 /// @@ -34,15 +39,18 @@ public class VertexData /// /// Whether the positions have been manipulated. /// - public bool positionsDirty{ get; private set; } + public bool positionsDirty { get; private set; } + /// /// Whether the vertex colors have been manipulated. /// public bool colorsDirty { get; private set; } + /// /// Whether the vertex alphas have been manipulated. /// public bool alphasDirty { get; private set; } + /// /// Whether the UVs have been manipulated. /// @@ -55,14 +63,18 @@ public class VertexData /// public Color32 BL_Color { - get => vertex_BL.color; + get => modifiers.BL_Color.GetValue(vertex_BL.color); set { - vertex_BL.color = value; + var coloroverride = modifiers.BL_Color; + coloroverride.Override |= ColorOverride.OverrideMode.Alpha | ColorOverride.OverrideMode.Color; + coloroverride.Color = value; + modifiers.BL_Color = coloroverride; colorsDirty = true; alphasDirty = true; } } + /// /// Get or set the color of the top left vertex.
/// Note that this will mark both colors and alphas as dirty.
@@ -70,14 +82,18 @@ public Color32 BL_Color ///
public Color32 TL_Color { - get => vertex_TL.color; + get => modifiers.TL_Color.GetValue(vertex_TL.color); set { - vertex_TL.color = value; + var coloroverride = modifiers.TL_Color; + coloroverride.Override |= ColorOverride.OverrideMode.Alpha | ColorOverride.OverrideMode.Color; + coloroverride.Color = value; + modifiers.TL_Color = coloroverride; colorsDirty = true; alphasDirty = true; } } + /// /// Get or set the color of the top right vertex.
/// Note that this will mark both colors and alphas as dirty.
@@ -85,14 +101,18 @@ public Color32 TL_Color ///
public Color32 TR_Color { - get => vertex_TR.color; + get => modifiers.TR_Color.GetValue(vertex_TR.color); set { - vertex_TR.color = value; + var coloroverride = modifiers.TR_Color; + coloroverride.Override |= ColorOverride.OverrideMode.Alpha | ColorOverride.OverrideMode.Color; + coloroverride.Color = value; + modifiers.TR_Color = coloroverride; colorsDirty = true; alphasDirty = true; } } + /// /// Get or set the color of the bottom right vertex.
/// Note that this will mark both colors and alphas as dirty.
@@ -100,10 +120,13 @@ public Color32 TR_Color ///
public Color32 BR_Color { - get => vertex_BR.color; + get => modifiers.BR_Color.GetValue(vertex_BR.color); set { - vertex_BR.color = value; + var coloroverride = modifiers.BR_Color; + coloroverride.Override |= ColorOverride.OverrideMode.Alpha | ColorOverride.OverrideMode.Color; + coloroverride.Color = value; + modifiers.BR_Color = coloroverride; colorsDirty = true; alphasDirty = true; } @@ -114,46 +137,61 @@ public Color32 BR_Color /// public byte BL_Alpha { - get => vertex_BL.color.a; + get => modifiers.BL_Color.GetValue(vertex_BL.color).a; set { - vertex_BL.color.a = value; + var coloroverride = modifiers.BL_Color; + coloroverride.Override |= ColorOverride.OverrideMode.Alpha; + coloroverride.Color.a = value; + modifiers.BL_Color = coloroverride; alphasDirty = true; } } + /// /// Get or set the alpha of the top left vertex. /// public byte TL_Alpha { - get => vertex_TL.color.a; + get => modifiers.TL_Color.GetValue(vertex_TL.color).a; set { - vertex_TL.color.a = value; + var coloroverride = modifiers.TL_Color; + coloroverride.Override |= ColorOverride.OverrideMode.Alpha; + coloroverride.Color.a = value; + modifiers.TL_Color = coloroverride; alphasDirty = true; } } + /// /// Get or set the alpha of the top right vertex. /// public byte TR_Alpha { - get => vertex_TR.color.a; + get => modifiers.TR_Color.GetValue(vertex_TR.color).a; set { - vertex_TR.color.a = value; + var coloroverride = modifiers.TR_Color; + coloroverride.Override |= ColorOverride.OverrideMode.Alpha; + coloroverride.Color.a = value; + modifiers.TR_Color = coloroverride; alphasDirty = true; } } + /// /// Get or set the alpha of the bottom right vertex. /// public byte BR_Alpha { - get => vertex_BR.color.a; + get => modifiers.BR_Color.GetValue(vertex_BR.color).a; set { - vertex_BR.color.a = value; + var coloroverride = modifiers.BR_Color; + coloroverride.Override |= ColorOverride.OverrideMode.Alpha; + coloroverride.Color.a = value; + modifiers.BR_Color = coloroverride; alphasDirty = true; } } @@ -163,46 +201,49 @@ public byte BR_Alpha /// public Vector3 BL_Position { - get => vertex_BL.position; + get => vertex_BL.position + modifiers.BL_Delta; set { - vertex_BL.position = value; + modifiers.BL_Delta = value - vertex_BL.position; positionsDirty = true; } } + /// /// Get or set the position of the top left vertex. /// public Vector3 TL_Position { - get => vertex_TL.position; + get => vertex_TL.position + modifiers.TL_Delta; set { - vertex_TL.position = value; + modifiers.TL_Delta = value - vertex_TL.position; positionsDirty = true; } } + /// /// Get or set the position of the top right vertex. /// public Vector3 TR_Position { - get => vertex_TR.position; + get => vertex_TR.position + modifiers.TR_Delta; set { - vertex_TR.position = value; + modifiers.TR_Delta = value - vertex_TR.position; positionsDirty = true; } } + /// /// Get or set the position of the bottom right vertex. /// public Vector3 BR_Position { - get => vertex_BR.position; + get => vertex_BR.position + modifiers.BR_Delta; set { - vertex_BR.position = value; + modifiers.BR_Delta = value - vertex_BR.position; positionsDirty = true; } } @@ -212,46 +253,51 @@ public Vector3 BR_Position /// public Vector3 BL_UV0 { - get => vertex_BL.uv; + get => modifiers.BL_UV0.GetValue(vertex_BL.uv); set { - vertex_BL.uv = value; + modifiers.BL_UV0 = + new Vector3Override( + value); // TODO maybe rewrite overrides so they store the fallback value? ever so slightly faster uvsDirty = true; } } + /// /// Get or set the UV0 of the bottom right vertex. /// public Vector3 TL_UV0 { - get => vertex_TL.uv; + get => modifiers.TL_UV0.GetValue(vertex_TL.uv); set { - vertex_TL.uv = value; + modifiers.TL_UV0 = new Vector3Override(value); uvsDirty = true; } } + /// /// Get or set the UV0 of the top right vertex. /// public Vector3 TR_UV0 { - get => vertex_TR.uv; + get => modifiers.TR_UV0.GetValue(vertex_TR.uv); set { - vertex_TR.uv = value; + modifiers.TR_UV0 = new Vector3Override(value); uvsDirty = true; } } + /// /// Get or set the UV0 of the bottom right vertex. /// public Vector3 BR_UV0 { - get => vertex_BR.uv; + get => modifiers.BR_UV0.GetValue(vertex_BR.uv); set { - vertex_BR.uv = value; + modifiers.BR_UV0 = new Vector3Override(value); uvsDirty = true; } } @@ -261,46 +307,49 @@ public Vector3 BR_UV0 /// public Vector3 BL_UV2 { - get => vertex_BL.uv2; + get => modifiers.BL_UV2.GetValue(vertex_BL.uv2); set { - vertex_BL.uv2 = value; + modifiers.BL_UV2 = new Vector3Override(value); uvsDirty = true; } } + /// /// Get or set the UV2 of the bottom right vertex. /// public Vector3 TL_UV2 { - get => vertex_TL.uv2; + get => modifiers.TL_UV2.GetValue(vertex_TL.uv2); set { - vertex_TL.uv2 = value; + modifiers.TL_UV2 = new Vector3Override(value); uvsDirty = true; } } + /// /// Get or set the UV2 of the top right vertex. /// public Vector3 TR_UV2 { - get => vertex_TR.uv2; + get => modifiers.TR_UV2.GetValue(vertex_TR.uv2); set { - vertex_TR.uv2 = value; + modifiers.TR_UV2 = new Vector3Override(value); uvsDirty = true; } } + /// /// Get or set the UV2 of the bottom right vertex. /// public Vector3 BR_UV2 { - get => vertex_BR.uv2; + get => modifiers.BR_UV2.GetValue(vertex_BR.uv2); set { - vertex_BR.uv2 = value; + modifiers.BR_UV2 = new Vector3Override(value); uvsDirty = true; } } @@ -317,6 +366,7 @@ public VertexData(TMP_Vertex bl, TMP_Vertex tl, TMP_Vertex tr, TMP_Vertex br) this.vertex_TL = tl; this.vertex_TR = tr; this.vertex_BR = br; + modifiers = new TMPMeshModifiers(); } public VertexData(TMP_CharacterInfo info) @@ -331,6 +381,7 @@ public VertexData(TMP_CharacterInfo info) this.vertex_TL = info.vertex_TL; this.vertex_TR = info.vertex_TR; this.vertex_BR = info.vertex_BR; + modifiers = new TMPMeshModifiers(); } /// @@ -347,10 +398,10 @@ public Vector3 GetPosition(int i) { switch (i) { - case 0: return vertex_BL.position; - case 1: return vertex_TL.position; - case 2: return vertex_TR.position; - case 3: return vertex_BR.position; + case 0: return BL_Position; + case 1: return TL_Position; + case 2: return TR_Position; + case 3: return BR_Position; default: throw new System.ArgumentOutOfRangeException(); } } @@ -368,10 +419,18 @@ public void SetPosition(int i, Vector3 value) { switch (i) { - case 0: vertex_BL.position = value; break; - case 1: vertex_TL.position = value; break; - case 2: vertex_TR.position = value; break; - case 3: vertex_BR.position = value; break; + case 0: + BL_Position = value; + break; + case 1: + TL_Position = value; + break; + case 2: + TR_Position = value; + break; + case 3: + BR_Position = value; + break; default: throw new System.ArgumentOutOfRangeException(); } @@ -392,10 +451,10 @@ public Color32 GetColor(int i) { switch (i) { - case 0: return vertex_BL.color; - case 1: return vertex_TL.color; - case 2: return vertex_TR.color; - case 3: return vertex_BR.color; + case 0: return BL_Color; + case 1: return TL_Color; + case 2: return TR_Color; + case 3: return BR_Color; default: throw new System.ArgumentOutOfRangeException(); } } @@ -417,10 +476,18 @@ public void SetColor(int i, Color32 value, bool ignoreAlpha = false) { switch (i) { - case 0: vertex_BL.color = value; break; - case 1: vertex_TL.color = value; break; - case 2: vertex_TR.color = value; break; - case 3: vertex_BR.color = value; break; + case 0: + BL_Color = value; + break; + case 1: + TL_Color = value; + break; + case 2: + TR_Color = value; + break; + case 3: + BR_Color = value; + break; default: throw new System.ArgumentOutOfRangeException(); } @@ -429,13 +496,38 @@ public void SetColor(int i, Color32 value, bool ignoreAlpha = false) return; } - value = new Color32(value.r, value.g, value.b, initial.GetAlpha(i)); + ColorOverride colorOverride; + Color32 currentColor; switch (i) { - case 0: vertex_BL.color = new Color32(value.r, value.g, value.b, vertex_BL.color.a); break; - case 1: vertex_TL.color = new Color32(value.r, value.g, value.b, vertex_BL.color.a); break; - case 2: vertex_TR.color = new Color32(value.r, value.g, value.b, vertex_BL.color.a); break; - case 3: vertex_BR.color = new Color32(value.r, value.g, value.b, vertex_BL.color.a); break; + case 0: + colorOverride = modifiers.BL_Color; + colorOverride.Override |= ColorOverride.OverrideMode.Color; + currentColor = colorOverride.Color; + colorOverride.Color = new Color32(value.r, value.g, value.b, currentColor.a); + modifiers.BL_Color = colorOverride; + break; + case 1: + colorOverride = modifiers.TL_Color; + colorOverride.Override |= ColorOverride.OverrideMode.Color; + currentColor = colorOverride.Color; + colorOverride.Color = new Color32(value.r, value.g, value.b, currentColor.a); + modifiers.TL_Color = colorOverride; + break; + case 2: + colorOverride = modifiers.TR_Color; + colorOverride.Override |= ColorOverride.OverrideMode.Color; + currentColor = colorOverride.Color; + colorOverride.Color = new Color32(value.r, value.g, value.b, currentColor.a); + modifiers.TR_Color = colorOverride; + break; + case 3: + colorOverride = modifiers.BR_Color; + colorOverride.Override |= ColorOverride.OverrideMode.Color; + currentColor = colorOverride.Color; + colorOverride.Color = new Color32(value.r, value.g, value.b, currentColor.a); + modifiers.BR_Color = colorOverride; + break; default: throw new System.ArgumentOutOfRangeException(); } @@ -456,10 +548,10 @@ public byte GetAlpha(int i) { switch (i) { - case 0: return vertex_BL.color.a; - case 1: return vertex_TL.color.a; - case 2: return vertex_TR.color.a; - case 3: return vertex_BR.color.a; + case 0: return BL_Color.a; + case 1: return TL_Color.a; + case 2: return TR_Color.a; + case 3: return BR_Color.a; default: throw new System.ArgumentOutOfRangeException(); } } @@ -477,10 +569,18 @@ public void SetAlpha(int i, float value) { switch (i) { - case 0: vertex_BL.color.a = (byte)value; break; - case 1: vertex_TL.color.a = (byte)value; break; - case 2: vertex_TR.color.a = (byte)value; break; - case 3: vertex_BR.color.a = (byte)value; break; + case 0: + BL_Alpha = (byte)value; + break; + case 1: + TL_Alpha = (byte)value; + break; + case 2: + TR_Alpha = (byte)value; + break; + case 3: + BR_Alpha = (byte)value; + break; default: throw new System.ArgumentOutOfRangeException(); } @@ -501,10 +601,10 @@ public Vector2 GetUV0(int i) { switch (i) { - case 0: return vertex_BL.uv; - case 1: return vertex_TL.uv; - case 2: return vertex_TR.uv; - case 3: return vertex_BR.uv; + case 0: return BL_UV0; + case 1: return TL_UV0; + case 2: return TR_UV0; + case 3: return BR_UV0; default: throw new System.ArgumentOutOfRangeException(); } } @@ -522,10 +622,18 @@ public void SetUV0(int i, Vector2 value) { switch (i) { - case 0: vertex_BL.uv = value; break; - case 1: vertex_TL.uv = value; break; - case 2: vertex_TR.uv = value; break; - case 3: vertex_BR.uv = value; break; + case 0: + BL_UV0 = value; + break; + case 1: + TL_UV0 = value; + break; + case 2: + TR_UV0 = value; + break; + case 3: + BR_UV0 = value; + break; default: throw new System.ArgumentOutOfRangeException(); } @@ -546,10 +654,10 @@ public Vector2 GetUV2(int i) { switch (i) { - case 0: return vertex_BL.uv2; - case 1: return vertex_TL.uv2; - case 2: return vertex_TR.uv2; - case 3: return vertex_BR.uv2; + case 0: return BL_UV2; + case 1: return TL_UV2; + case 2: return TR_UV2; + case 3: return BR_UV2; default: throw new System.ArgumentOutOfRangeException(); } } @@ -567,10 +675,18 @@ public void SetUV2(int i, Vector2 value) { switch (i) { - case 0: vertex_BL.uv2 = value; break; - case 1: vertex_TL.uv2 = value; break; - case 2: vertex_TR.uv2 = value; break; - case 3: vertex_BR.uv2 = value; break; + case 0: + BL_UV2 = value; + break; + case 1: + TL_UV2 = value; + break; + case 2: + TR_UV2 = value; + break; + case 3: + BR_UV2 = value; + break; default: throw new System.ArgumentOutOfRangeException(); } @@ -582,10 +698,7 @@ public void SetUV2(int i, Vector2 value) /// public void Reset() { - ResetColors(); - ResetAlphas(); - ResetPositions(); - ResetUVs(); + modifiers.ClearModifiers(); } /// @@ -594,20 +707,73 @@ public void Reset() public void ResetColors() { if (!colorsDirty) return; - vertex_BL.color = initial.GetColor(0); - vertex_TL.color = initial.GetColor(1); - vertex_TR.color = initial.GetColor(2); - vertex_BR.color = initial.GetColor(3); + if (alphasDirty) + { + if (modifiers.BL_Color.OverrideAlpha) + modifiers.BL_Color = new ColorOverride(modifiers.BL_Color.Color, + modifiers.BL_Color.Override & ~ColorOverride.OverrideMode.Alpha); + else modifiers.BL_Color = new ColorOverride(initial.GetColor(0), 0); + + if (modifiers.TL_Color.OverrideAlpha) + modifiers.TL_Color = new ColorOverride(modifiers.TL_Color.Color, + modifiers.BL_Color.Override & ~ColorOverride.OverrideMode.Alpha); + else modifiers.TL_Color = new ColorOverride(initial.GetColor(1), 0); + + if (modifiers.TR_Color.OverrideAlpha) + modifiers.TR_Color = new ColorOverride(modifiers.TR_Color.Color, + modifiers.BL_Color.Override & ~ColorOverride.OverrideMode.Alpha); + else modifiers.TR_Color = new ColorOverride(initial.GetColor(2), 0); + + if (modifiers.BR_Color.OverrideAlpha) + modifiers.BR_Color = new ColorOverride(modifiers.BR_Color.Color, + modifiers.BL_Color.Override & ~ColorOverride.OverrideMode.Alpha); + else modifiers.BR_Color = new ColorOverride(initial.GetColor(3), 0); + } + else + { + modifiers.BL_Color = new ColorOverride(initial.GetColor(0), 0); + modifiers.TL_Color = new ColorOverride(initial.GetColor(1), 0); + modifiers.TR_Color = new ColorOverride(initial.GetColor(2), 0); + modifiers.BR_Color = new ColorOverride(initial.GetColor(3), 0); + } + colorsDirty = false; } public void ResetAlphas() { if (!alphasDirty) return; - vertex_BL.color.a = initial.GetColor(0).a; - vertex_TL.color.a = initial.GetColor(1).a; - vertex_TR.color.a = initial.GetColor(2).a; - vertex_BR.color.a = initial.GetColor(3).a; + + if (colorsDirty) + { + if (modifiers.BL_Color.OverrideColor) + modifiers.BL_Color = new ColorOverride(modifiers.BL_Color.Color, + modifiers.BL_Color.Override & ~ColorOverride.OverrideMode.Color); + else modifiers.BL_Color = new ColorOverride(initial.GetColor(0), 0); + + if (modifiers.TL_Color.OverrideColor) + modifiers.TL_Color = new ColorOverride(modifiers.TL_Color.Color, + modifiers.BL_Color.Override & ~ColorOverride.OverrideMode.Color); + else modifiers.TL_Color = new ColorOverride(initial.GetColor(1), 0); + + if (modifiers.TR_Color.OverrideColor) + modifiers.TR_Color = new ColorOverride(modifiers.TR_Color.Color, + modifiers.BL_Color.Override & ~ColorOverride.OverrideMode.Color); + else modifiers.TR_Color = new ColorOverride(initial.GetColor(2), 0); + + if (modifiers.BR_Color.OverrideColor) + modifiers.BR_Color = new ColorOverride(modifiers.BR_Color.Color, + modifiers.BL_Color.Override & ~ColorOverride.OverrideMode.Color); + else modifiers.BR_Color = new ColorOverride(initial.GetColor(1), 0); + } + else + { + modifiers.BL_Color = new ColorOverride(initial.GetColor(0), 0); + modifiers.TL_Color = new ColorOverride(initial.GetColor(1), 0); + modifiers.TR_Color = new ColorOverride(initial.GetColor(2), 0); + modifiers.BR_Color = new ColorOverride(initial.GetColor(3), 0); + } + alphasDirty = false; } @@ -617,10 +783,7 @@ public void ResetAlphas() public void ResetPositions() { if (!positionsDirty) return; - vertex_BL.position = initial.GetPosition(0); - vertex_TL.position = initial.GetPosition(1); - vertex_TR.position = initial.GetPosition(2); - vertex_BR.position = initial.GetPosition(3); + modifiers.ClearModifiers(TMPMeshModifiers.ModifierFlags.Deltas); positionsDirty = false; } @@ -630,16 +793,8 @@ public void ResetPositions() public void ResetUVs() { if (!uvsDirty) return; - vertex_BL.uv = initial.GetUV0(0); - vertex_TL.uv = initial.GetUV0(1); - vertex_TR.uv = initial.GetUV0(2); - vertex_BR.uv = initial.GetUV0(3); - - vertex_BL.uv2 = initial.GetUV2(0); - vertex_TL.uv2 = initial.GetUV2(1); - vertex_TR.uv2 = initial.GetUV2(2); - vertex_BR.uv2 = initial.GetUV2(3); + modifiers.ClearModifiers(TMPMeshModifiers.ModifierFlags.UVs); uvsDirty = false; } } -} +} \ No newline at end of file diff --git a/Package/Runtime/Components/TMPAnimator/AnimationCacher.cs b/Package/Runtime/Components/TMPAnimator/AnimationCacher.cs index ae645d1..78fc0a0 100644 --- a/Package/Runtime/Components/TMPAnimator/AnimationCacher.cs +++ b/Package/Runtime/Components/TMPAnimator/AnimationCacher.cs @@ -15,16 +15,16 @@ internal class AnimationCacher : ITagCacher private readonly IList charData; private readonly AnimatorContext context; private readonly Predicate animates; - private readonly ReadOnlyCharDataState state; + private readonly CharDataModifiers modifiers; private readonly ReadOnlyAnimatorContext roContext; - public AnimationCacher(ITMPEffectDatabase database, ReadOnlyCharDataState state, AnimatorContext context, IList charData, Predicate animates) + public AnimationCacher(ITMPEffectDatabase database, CharDataModifiers modifiers, AnimatorContext context, IList charData, Predicate animates) { this.context = context; this.database = database; this.charData = charData; this.animates = animates; - this.state = state; + this.modifiers = modifiers; roContext = new ReadOnlyAnimatorContext(context); } @@ -36,7 +36,7 @@ public CachedAnimation CacheTag(TMPEffectTag tag, TMPEffectTagIndices indices) animation.SetParameters(customAnimationData, tag.Parameters); SegmentData segmentData = new SegmentData(closedIndices, charData, animates); - AnimationContext animationContext = new AnimationContext(roContext, state, segmentData, customAnimationData); + AnimationContext animationContext = new AnimationContext(roContext, modifiers, segmentData, customAnimationData); CachedAnimation ca = new CachedAnimation( tag, closedIndices, diff --git a/Package/Runtime/Components/TMPAnimator/AnimatorContext.cs b/Package/Runtime/Components/TMPAnimator/AnimatorContext.cs index 7ba8d8a..6e2123a 100644 --- a/Package/Runtime/Components/TMPAnimator/AnimatorContext.cs +++ b/Package/Runtime/Components/TMPAnimator/AnimatorContext.cs @@ -11,6 +11,8 @@ namespace TMPEffects.Components.Animator [System.Serializable] public class AnimatorContext : IAnimatorContext { + public CharDataModifiers Modifiers { get; set; } + /// public bool ScaleAnimations { diff --git a/Package/Runtime/Components/TMPAnimator/IAnimatorContext.cs b/Package/Runtime/Components/TMPAnimator/IAnimatorContext.cs index d4e2073..20f7842 100644 --- a/Package/Runtime/Components/TMPAnimator/IAnimatorContext.cs +++ b/Package/Runtime/Components/TMPAnimator/IAnimatorContext.cs @@ -8,6 +8,11 @@ namespace TMPEffects.Components.Animator /// public interface IAnimatorContext { + /// + /// The current state of the CharData, with the previous animations applied. + /// + public CharDataModifiers Modifiers { get; } + /// /// Whether animations are scaled. /// diff --git a/Package/Runtime/Components/TMPAnimator/ReadOnlyAnimatorContext.cs b/Package/Runtime/Components/TMPAnimator/ReadOnlyAnimatorContext.cs index f4f70fb..a3466a6 100644 --- a/Package/Runtime/Components/TMPAnimator/ReadOnlyAnimatorContext.cs +++ b/Package/Runtime/Components/TMPAnimator/ReadOnlyAnimatorContext.cs @@ -10,6 +10,8 @@ namespace TMPEffects.Components.Animator [System.Serializable] public class ReadOnlyAnimatorContext : IAnimatorContext { + public CharDataModifiers Modifiers => context.Modifiers; + /// public bool ScaleAnimations => context.ScaleAnimations; /// diff --git a/Package/Runtime/Components/TMPAnimator/SegmentData.cs b/Package/Runtime/Components/TMPAnimator/SegmentData.cs index 2c332c4..345e3b2 100644 --- a/Package/Runtime/Components/TMPAnimator/SegmentData.cs +++ b/Package/Runtime/Components/TMPAnimator/SegmentData.cs @@ -11,7 +11,7 @@ namespace TMPEffects.Components.Animator /// To be used with and its animations.
/// Contains data about a given animation segment. /// - public struct SegmentData + public struct SegmentData { /// /// The first index of the segment within the containing text. @@ -60,6 +60,19 @@ public int SegmentIndexOf(CharData cData) return IndexToSegmentIndex(cData.info.index); } + internal SegmentData(int startIndex, int length) + { + this.startIndex = startIndex; + this.length = length; + firstVisibleIndex = startIndex; + lastVisibleIndex = startIndex + length; + firstAnimationIndex = startIndex; + lastAnimationIndex = startIndex + length; + effectiveLength = length; + max = default; + min = default; + } + internal SegmentData(TMPEffectTagIndices indices, IList cData, Predicate animates) { startIndex = indices.StartIndex; diff --git a/Package/Runtime/Components/TMPAnimator/TMPAnimator.cs b/Package/Runtime/Components/TMPAnimator/TMPAnimator.cs index 9f47fb2..d120f21 100644 --- a/Package/Runtime/Components/TMPAnimator/TMPAnimator.cs +++ b/Package/Runtime/Components/TMPAnimator/TMPAnimator.cs @@ -13,13 +13,14 @@ using TMPEffects.Tags; using TMPEffects.CharacterData; using System.Collections.Specialized; +using System.Diagnostics; using TMPEffects.TMPAnimations.ShowAnimations; using TMPEffects.TMPAnimations.HideAnimations; using TMPEffects.TMPSceneAnimations; using TMPEffects.TMPAnimations.Animations; using UnityEditor; using TMPEffects.Extensions; -using TMPEffects.Components.Mediator; +using Debug = UnityEngine.Debug; namespace TMPEffects.Components { @@ -42,12 +43,18 @@ namespace TMPEffects.Components [ExecuteAlways, DisallowMultipleComponent, RequireComponent(typeof(TMP_Text))] public class TMPAnimator : TMPEffectComponent { + // TODO Quick solution for testing + // Should definitely return a readonly context (which should probably be cached by this class as well) + public IAnimatorContext AnimatorContext => context; + /// /// Whether the text is currently being animated.
/// If is set to , this will always evaluate to true. ///
#if UNITY_EDITOR - public bool IsAnimating => isActiveAndEnabled && (updateFrom == UpdateFrom.Script || isAnimating || (!Application.isPlaying && preview)); + public bool IsAnimating => isActiveAndEnabled && + (updateFrom == UpdateFrom.Script || isAnimating || + (!Application.isPlaying && preview)); #else public bool IsAnimating => isActiveAndEnabled && (updateFrom == UpdateFrom.Script || isAnimating); #endif @@ -70,14 +77,17 @@ public class TMPAnimator : TMPEffectComponent /// All tags parsed by the TMPAnimator. ///
public ITagCollection Tags => tags; + /// /// All basic animation tags parsed by the TMPAnimator. /// public ITagCollection BasicTags => tags == null ? null : tags[basicCategory]; + /// /// All show animation tags parsed by the TMPAnimator. /// public ITagCollection ShowTags => tags == null ? null : tags[showCategory]; + /// /// All hide animation tags parsed by the TMPAnimator. /// @@ -86,62 +96,91 @@ public class TMPAnimator : TMPEffectComponent /// /// Whether the TMPAnimator should automatically begin animating on . /// - public bool AnimateOnStart { get => animateOnStart; set => animateOnStart = value; } + public bool AnimateOnStart + { + get => animateOnStart; + set => animateOnStart = value; + } + /// /// Whether animations will override each other by default. /// - public bool AnimationsOverride { get => animationsOverride; set => animationsOverride = value; } + public bool AnimationsOverride + { + get => animationsOverride; + set => animationsOverride = value; + } /// /// The prefix used for basic animation tags. /// public const char ANIMATION_PREFIX = '\0'; + /// /// The prefix used for show animation tags. /// public const char SHOW_ANIMATION_PREFIX = '+'; + /// /// The prefix used for hide animation tags. /// public const char HIDE_ANIMATION_PREFIX = '-'; #region Fields - [Tooltip("The database used for processing animation tags (e.g. , <+fade>)")] - [SerializeField] private TMPAnimationDatabase database = null; + + [Tooltip("The database used for processing animation tags (e.g. , <+fade>)")] [SerializeField] + private TMPAnimationDatabase database = null; + [SerializeField] private AnimatorContext context = new AnimatorContext(); - [Tooltip("Where to update the animations from. If set to Script, you will have to manually update animations from your own script")] - [SerializeField] private UpdateFrom updateFrom = UpdateFrom.Update; - [Tooltip("Whether to automatically start animating when entering playmode. Ignored if UpdateFrom is set to Script")] - [SerializeField] private bool animateOnStart = true; + [Tooltip( + "Where to update the animations from. If set to Script, you will have to manually update animations from your own script")] + [SerializeField] + private UpdateFrom updateFrom = UpdateFrom.Update; + + [Tooltip( + "Whether to automatically start animating when entering playmode. Ignored if UpdateFrom is set to Script")] + [SerializeField] + private bool animateOnStart = true; - [Tooltip("Whether animation tags override each other by default. You can set this individually on a per-tag basis by adding the override=true/false parameter to them")] - [SerializeField] private bool animationsOverride = false; + [Tooltip( + "Whether animation tags override each other by default. You can set this individually on a per-tag basis by adding the override=true/false parameter to them")] + [SerializeField] + private bool animationsOverride = false; [SerializeField] private List defaultAnimationsStrings = new List(); [SerializeField] private List defaultShowAnimationsStrings = new List(); [SerializeField] private List defaultHideAnimationsStrings = new List(); - [Tooltip("Characters that are excluded from basic animations")] - [SerializeField] private string excludedCharacters = ""; - [Tooltip("Characters that are excluded from show animations")] - [SerializeField] private string excludedCharactersShow = ""; - [Tooltip("Characters that are excluded from hide animations")] - [SerializeField] private string excludedCharactersHide = ""; + [Tooltip("Characters that are excluded from basic animations")] [SerializeField] + private string excludedCharacters = ""; - [Tooltip("Whether to exclude punctuation characters from basic animations")] - [SerializeField] private bool excludePunctuation = false; - [Tooltip("Whether to exclude punctuation characters from show animations")] - [SerializeField] private bool excludePunctuationShow = false; - [Tooltip("Whether to exclude punctuation characters from hide animations")] - [SerializeField] private bool excludePunctuationHide = false; + [Tooltip("Characters that are excluded from show animations")] [SerializeField] + private string excludedCharactersShow = ""; + + [Tooltip("Characters that are excluded from hide animations")] [SerializeField] + private string excludedCharactersHide = ""; + + [Tooltip("Whether to exclude punctuation characters from basic animations")] [SerializeField] + private bool excludePunctuation = false; + + [Tooltip("Whether to exclude punctuation characters from show animations")] [SerializeField] + private bool excludePunctuationShow = false; + + [Tooltip("Whether to exclude punctuation characters from hide animations")] [SerializeField] + private bool excludePunctuationHide = false; [SerializeField, SerializedDictionary(keyName: "Name", valueName: "Animation")] - private SerializedObservableDictionary sceneAnimations = new SerializedObservableDictionary(); + private SerializedObservableDictionary sceneAnimations = + new SerializedObservableDictionary(); + [SerializeField, SerializedDictionary(keyName: "Name", valueName: "Show Animation")] - private SerializedObservableDictionary sceneShowAnimations = new SerializedObservableDictionary(); + private SerializedObservableDictionary sceneShowAnimations = + new SerializedObservableDictionary(); + [SerializeField, SerializedDictionary(keyName: "Name", valueName: "Hide Animation")] - private SerializedObservableDictionary sceneHideAnimations = new SerializedObservableDictionary(); + private SerializedObservableDictionary sceneHideAnimations = + new SerializedObservableDictionary(); [System.NonSerialized] private TagProcessorManager processors; [System.NonSerialized] private TagCollectionManager tags; @@ -172,19 +211,24 @@ public class TMPAnimator : TMPEffectComponent [System.NonSerialized] private List stateTimes = new List(); [System.NonSerialized] private object timesIdentifier; - [System.NonSerialized] private CharDataState state = new CharDataState(); + [System.NonSerialized] private CharDataModifiers state = new CharDataModifiers(); - private const string falseUpdateAnimationsCallWarning = "Called UpdateAnimations while TMPAnimator {0} is set to automatically update from {1}; " + + private const string falseUpdateAnimationsCallWarning = + "Called UpdateAnimations while TMPAnimator {0} is set to automatically update from {1}; " + "If you want to manually control the animation updates, set its UpdateFrom property to \"Script\", " + "either through the inspector or through a script using the SetUpdateFrom method."; - private const string falseStartStopAnimatingCallWarning = "Called {0} while TMPAnimator {1} is set to manually update from script; " + + + private const string falseStartStopAnimatingCallWarning = + "Called {0} while TMPAnimator {1} is set to manually update from script; " + "If you want the TMPAnimator to automatically update and to use the Start / StopAnimating methods, set its UpdateFrom property to \"Update\", \"LateUpdate\" or \"FixedUpdate\", " + "either through the inspector or through a script using the SetUpdateFrom method."; + #endregion #region Public methods #region Animation Controlling + /// /// Update the current animations.
/// You should only call this if is set to , @@ -197,9 +241,10 @@ public void UpdateAnimations(float deltaTime) throw new System.InvalidOperationException("Animator is not enabled!"); } - if (updateFrom != UpdateFrom.Script) + if (updateFrom != UpdateFrom.Script) { - throw new System.InvalidOperationException(string.Format(falseUpdateAnimationsCallWarning, name, updateFrom.ToString())); + throw new System.InvalidOperationException(string.Format(falseUpdateAnimationsCallWarning, name, + updateFrom.ToString())); } UpdateAnimations_Impl(deltaTime); @@ -215,7 +260,8 @@ public void StartAnimating() #if UNITY_EDITOR if (!Application.isPlaying) { - throw new System.InvalidOperationException("If you want to animate the TMPAnimator in edit mode, set the UpdateFrom property to Script and call UpdateAnimations manually."); + throw new System.InvalidOperationException( + "If you want to animate the TMPAnimator in edit mode, set the UpdateFrom property to Script and call UpdateAnimations manually."); } #endif @@ -226,7 +272,8 @@ public void StartAnimating() if (updateFrom == UpdateFrom.Script) { - throw new System.InvalidOperationException(string.Format(falseStartStopAnimatingCallWarning, name, updateFrom.ToString())); + throw new System.InvalidOperationException(string.Format(falseStartStopAnimatingCallWarning, name, + updateFrom.ToString())); } isAnimating = true; @@ -242,7 +289,8 @@ public void StopAnimating() #if UNITY_EDITOR if (!Application.isPlaying) { - throw new System.InvalidOperationException("If you want to animate the TMPAnimator in edit mode, set the UpdateFrom property to Script and call UpdateAnimations manually."); + throw new System.InvalidOperationException( + "If you want to animate the TMPAnimator in edit mode, set the UpdateFrom property to Script and call UpdateAnimations manually."); } #endif @@ -253,7 +301,8 @@ public void StopAnimating() if (updateFrom == UpdateFrom.Script) { - throw new System.InvalidOperationException(string.Format(falseStartStopAnimatingCallWarning, name, updateFrom.ToString())); + throw new System.InvalidOperationException(string.Format(falseStartStopAnimatingCallWarning, name, + updateFrom.ToString())); } isAnimating = false; @@ -280,9 +329,11 @@ public void StopAnimating() /// Reset all visible characters to their initial, unanimated state. ///
public void ResetAnimations() => ResetAllVisible(); + #endregion #region Setters + /// /// Set where the animations should be updated from. /// @@ -341,9 +392,15 @@ public void SetExcludedCharacters(TMPAnimationType type, string str, bool? exclu { switch (type) { - case TMPAnimationType.Basic: SetExcludedBasicCharacters(str, excludePunctuation); break; - case TMPAnimationType.Show: SetExcludedShowCharacters(str, excludePunctuation); break; - case TMPAnimationType.Hide: SetExcludedHideCharacters(str, excludePunctuation); break; + case TMPAnimationType.Basic: + SetExcludedBasicCharacters(str, excludePunctuation); + break; + case TMPAnimationType.Show: + SetExcludedShowCharacters(str, excludePunctuation); + break; + case TMPAnimationType.Hide: + SetExcludedHideCharacters(str, excludePunctuation); + break; default: throw new System.ArgumentException(); } } @@ -408,6 +465,7 @@ public void SetExcludedHideCharacters(string str, bool? excludePunctuation = nul QueueCharacterReset(); } } + #endregion /// @@ -427,40 +485,49 @@ public bool IsExcluded(char c, TMPAnimationType type) default: throw new System.ArgumentException(); } } + /// /// Check whether the given character is excluded from basic animations. /// /// The character to check. /// Whether the character is excluded from basic animations. - public bool IsExcludedBasic(char c) => (excludePunctuation && char.IsPunctuation(c)) || excludedCharacters.Contains(c); + public bool IsExcludedBasic(char c) => + (excludePunctuation && char.IsPunctuation(c)) || excludedCharacters.Contains(c); + /// /// Check whether the given character is excluded from show animations. /// /// The character to check. /// Whether the character is excluded from show animations. - public bool IsExcludedShow(char c) => (excludePunctuationShow && char.IsPunctuation(c)) || excludedCharactersShow.Contains(c); + public bool IsExcludedShow(char c) => + (excludePunctuationShow && char.IsPunctuation(c)) || excludedCharactersShow.Contains(c); + /// /// Check whether the given character is excluded from hide animations. /// /// The character to check. /// Whether the character is excluded from hide animations. - public bool IsExcludedHide(char c) => (excludePunctuationHide && char.IsPunctuation(c)) || excludedCharactersHide.Contains(c); + public bool IsExcludedHide(char c) => + (excludePunctuationHide && char.IsPunctuation(c)) || excludedCharactersHide.Contains(c); /// /// Reset the time of the animator. + /// The time value to set the animator to. 0 by default, must be positive. /// - public void ResetTime() + public void ResetTime(float time = 0f) { + if (time < 0) throw new System.ArgumentOutOfRangeException(nameof(time)); if (Mediator == null) return; - context.passed = 0f; + context.passed = time; for (int i = 0; i < stateTimes.Count; i++) { - stateTimes[i] = 0f; + stateTimes[i] = time; } + for (int i = 0; i < visibleTimes.Count; i++) { - visibleTimes[i] = 0f; + visibleTimes[i] = time; } #if UNITY_EDITOR @@ -471,6 +538,7 @@ public void ResetTime() #endregion #region Initialization + private void OnEnable() { UpdateMediator(); @@ -505,7 +573,7 @@ private void Start() private void OnDisable() { - processors.UnregisterFrom(Mediator.Processor); + processors.UnregisterFrom(Mediator.Processor); #if UNITY_EDITOR if (preview && !Application.isPlaying) StopPreviewWithoutSet(); @@ -515,13 +583,13 @@ private void OnDisable() showDatabase?.Dispose(); hideDatabase?.Dispose(); mainDatabaseWrapper?.Dispose(); - + UnsubscribeFromMediator(); #if UNITY_EDITOR // Queue a player loop update to instantly update scene view EditorApplication.delayCall += EditorApplication.QueuePlayerLoopUpdate; -#endif +#endif } private void SubscribeToMediator() @@ -569,10 +637,18 @@ private void PrepareForProcessing() hideDatabase?.Dispose(); mainDatabaseWrapper?.Dispose(); - basicDatabase = new AnimationDatabase(database == null ? null : database.BasicAnimationDatabase == null ? null : database.BasicAnimationDatabase, sceneAnimations); - showDatabase = new AnimationDatabase(database == null ? null : database.ShowAnimationDatabase == null ? null : database.ShowAnimationDatabase, sceneShowAnimations); - hideDatabase = new AnimationDatabase(database == null ? null : database.HideAnimationDatabase == null ? null : database.HideAnimationDatabase, sceneHideAnimations); - mainDatabaseWrapper = new AnimationDatabase(database == null ? null : database, null); + basicDatabase = new AnimationDatabase( + database == null ? null : + database.BasicAnimationDatabase == null ? null : database.BasicAnimationDatabase, sceneAnimations); + showDatabase = new AnimationDatabase( + database == null ? null : + database.ShowAnimationDatabase == null ? null : database.ShowAnimationDatabase, sceneShowAnimations); + hideDatabase = new AnimationDatabase( + database == null ? null : + database.HideAnimationDatabase == null ? null : database.HideAnimationDatabase, sceneHideAnimations); + mainDatabaseWrapper = + new AnimationDatabase(database == null ? null : database, + null); basicDatabase.AddAnimation("sprite", new SpriteAnimation()); @@ -625,14 +701,14 @@ private void SetDefaultAnimations(TMPAnimationType type) List anims; AnimationCacher cacher; - var roCDataState = new ReadOnlyCharDataState(state); + // var roCDataState = new CharDataModifiers(state); switch (type) { case TMPAnimationType.Basic: database = basicDatabase; anims = defaultAnimations; - cacher = new AnimationCacher(database, roCDataState, context, Mediator.CharData, x => !IsExcludedBasic(x)); + cacher = new AnimationCacher(database, state, context, Mediator.CharData, x => !IsExcludedBasic(x)); strings = defaultAnimationsStrings; QueueCharacterReset(); break; @@ -640,14 +716,14 @@ private void SetDefaultAnimations(TMPAnimationType type) case TMPAnimationType.Show: database = showDatabase; anims = defaultShowAnimations; - cacher = new AnimationCacher(database, roCDataState, context, Mediator.CharData, x => !IsExcludedShow(x)); + cacher = new AnimationCacher(database, state, context, Mediator.CharData, x => !IsExcludedShow(x)); strings = defaultShowAnimationsStrings; break; case TMPAnimationType.Hide: database = hideDatabase; anims = defaultHideAnimations; - cacher = new AnimationCacher(database, roCDataState, context, Mediator.CharData, x => !IsExcludedHide(x)); + cacher = new AnimationCacher(database, state, context, Mediator.CharData, x => !IsExcludedHide(x)); strings = defaultHideAnimationsStrings; break; @@ -666,7 +742,8 @@ private void SetDefaultAnimations(TMPAnimationType type) if (string.IsNullOrWhiteSpace(str)) continue; str = (str.Trim()[0] == '<' ? str : "<" + str + ">"); - if (!ParsingUtility.TryParseTag(str, 0, str.Length - 1, ref tagInfo, ParsingUtility.TagType.Open) || !database.ContainsEffect(tagInfo.name)) + if (!ParsingUtility.TryParseTag(str, 0, str.Length - 1, ref tagInfo, ParsingUtility.TagType.Open) || + !database.ContainsEffect(tagInfo.name)) continue; if ((animation = database.GetEffect(tagInfo.name)) == null) @@ -676,7 +753,8 @@ private void SetDefaultAnimations(TMPAnimationType type) if (!animation.ValidateParameters(tagParams)) continue; - anims.Add(cacher.CacheTag(new TMPEffectTag(tagInfo.name, tagInfo.prefix, tagParams), new TMPEffectTagIndices(0, -1, 0))); + anims.Add(cacher.CacheTag(new TMPEffectTag(tagInfo.name, tagInfo.prefix, tagParams), + new TMPEffectTagIndices(0, -1, 0))); } } @@ -703,8 +781,10 @@ private void SetDummyShow() //if (dummyShow != null) return; TMPEffectTag tag = new TMPEffectTag("Dummy Show Animation", ' ', null); - DummyDatabase database = new DummyDatabase("Dummy Show Animation", ScriptableObject.CreateInstance()); - AnimationCacher cacher = new AnimationCacher(database, new ReadOnlyCharDataState(state), context, Mediator.CharData, (x) => !IsExcludedShow(x)); + DummyDatabase database = new DummyDatabase("Dummy Show Animation", + ScriptableObject.CreateInstance()); + AnimationCacher cacher = + new AnimationCacher(database, state, context, Mediator.CharData, (x) => !IsExcludedShow(x)); dummyShow = cacher.CacheTag(tag, new TMPEffectTagIndices(0, -1, 0)); } @@ -713,10 +793,13 @@ private void SetDummyHide() //if (dummyHide != null) return; TMPEffectTag tag = new TMPEffectTag("Dummy Hide Animation", ' ', null); - DummyDatabase database = new DummyDatabase("Dummy Hide Animation", ScriptableObject.CreateInstance()); - AnimationCacher cacher = new AnimationCacher(database, new ReadOnlyCharDataState(state), context, Mediator.CharData, (x) => !IsExcludedHide(x)); + DummyDatabase database = new DummyDatabase("Dummy Hide Animation", + ScriptableObject.CreateInstance()); + AnimationCacher cacher = + new AnimationCacher(database, state, context, Mediator.CharData, (x) => !IsExcludedHide(x)); dummyHide = cacher.CacheTag(tag, new TMPEffectTagIndices(0, -1, 0)); } + #endregion private void RecalculateSegmentData(TMPAnimationType type) @@ -727,30 +810,35 @@ private void RecalculateSegmentData(TMPAnimationType type) { case TMPAnimationType.Basic: foreach (var anim in basic) - anim.context.SegmentData = new SegmentData(anim.Indices, Mediator.CharData, (c) => !IsExcludedBasic(c)); + anim.context.SegmentData = + new SegmentData(anim.Indices, Mediator.CharData, (c) => !IsExcludedBasic(c)); break; case TMPAnimationType.Show: foreach (var anim in show) - anim.context.SegmentData = new SegmentData(anim.Indices, Mediator.CharData, (c) => !IsExcludedShow(c)); + anim.context.SegmentData = + new SegmentData(anim.Indices, Mediator.CharData, (c) => !IsExcludedShow(c)); break; case TMPAnimationType.Hide: foreach (var anim in hide) - anim.context.SegmentData = new SegmentData(anim.Indices, Mediator.CharData, (c) => !IsExcludedHide(c)); + anim.context.SegmentData = + new SegmentData(anim.Indices, Mediator.CharData, (c) => !IsExcludedHide(c)); break; default: throw new System.ArgumentException(); } } - #region Animations + #region Animations + private void Update() { #if UNITY_EDITOR if (!Application.isPlaying) return; #endif - if (updateFrom == UpdateFrom.Update && isAnimating) UpdateAnimations_Impl(context.UseScaledTime ? Time.deltaTime : Time.unscaledDeltaTime); + if (updateFrom == UpdateFrom.Update && isAnimating) + UpdateAnimations_Impl(context.UseScaledTime ? Time.deltaTime : Time.unscaledDeltaTime); } private void LateUpdate() @@ -758,7 +846,8 @@ private void LateUpdate() #if UNITY_EDITOR if (!Application.isPlaying) return; #endif - if (updateFrom == UpdateFrom.LateUpdate && isAnimating) UpdateAnimations_Impl(context.UseScaledTime ? Time.deltaTime : Time.unscaledDeltaTime); + if (updateFrom == UpdateFrom.LateUpdate && isAnimating) + UpdateAnimations_Impl(context.UseScaledTime ? Time.deltaTime : Time.unscaledDeltaTime); } private void FixedUpdate() @@ -766,11 +855,18 @@ private void FixedUpdate() #if UNITY_EDITOR if (!Application.isPlaying) return; #endif - if (updateFrom == UpdateFrom.FixedUpdate && isAnimating) UpdateAnimations_Impl(context.UseScaledTime ? Time.fixedDeltaTime : Time.fixedUnscaledDeltaTime); + if (updateFrom == UpdateFrom.FixedUpdate && isAnimating) + UpdateAnimations_Impl(context.UseScaledTime ? Time.fixedDeltaTime : Time.fixedUnscaledDeltaTime); } + Stopwatch sw = new Stopwatch(); + private int count = 0; + private void UpdateAnimations_Impl(float deltaTime) { + if (sw == null) sw = new Stopwatch(); + sw.Start(); + context.passed += deltaTime; if (characterResetQueued) @@ -788,28 +884,123 @@ private void UpdateAnimations_Impl(float deltaTime) if (Mediator.Text.mesh != null) Mediator.Text.UpdateVertexData(TMP_VertexDataUpdateFlags.All); + + sw.Stop(); + count++; + if (count >= 1000) + { + // Debug.LogWarning("1000 took " + sw.Elapsed.TotalMilliseconds); + sw.Reset(); + count = 0; + } + else if (count % 100 == 0) + { + // Debug.Log(count); + } } - private void UpdateCharacterAnimation(CharData cData, float deltaTime, int index, bool updateVertices = true, bool forced = false) + public delegate void OnCharacterAnimatedEventHandler(CharData cData); + + public event OnCharacterAnimatedEventHandler OnCharacterAnimated; + + private void UpdateCharacterAnimation(CharData cData, float deltaTime, int index, bool updateVertices = true, + bool forced = false) { - if (!cData.info.isVisible || (!forced && !AnimateCharacter(index, cData))) return; + if (!cData.info.isVisible) return; + VisibilityState vState = Mediator.VisibilityStates[index]; + if (vState == VisibilityState.Hidden) return; - context.deltaTime = deltaTime; + if (defaultAnimations.Count != 0 || basic.HasAnyContaining(index) || + vState != VisibilityState.Shown) + { + context.deltaTime = deltaTime; + context.Modifiers = state; + state.Reset(); + UpdateCharacterAnimation_Impl(index); - UpdateCharacterAnimation_Impl(index); + if (OnCharacterAnimated != null) + { + // TODO Issue; this needs to be called before every invoked method + // maybe make list of actions instead + // Actually; not necessarily. Just the cdata modifiers will already be dirty + // meaning some of the api will be a lil different than for normal animations + // which is fine? for example for genericanimations or tmpmeshmodifierbehaviours + // this makes 0 difference + cData.Reset(); + OnCharacterAnimated.Invoke(cData); + state.MeshModifiers.Combine(cData.MeshModifiers); + state.CharacterModifiers.Combine(cData.CharacterModifiers); + } + } + else + { + context.deltaTime = deltaTime; + context.Modifiers = state; + if (OnCharacterAnimated != null) + { + state.Reset(); + // TODO Issue; this needs to be called before every invoked method + // maybe make list of actions instead + // Actually; not necessarily. Just the cdata modifiers will already be dirty + // meaning some of the api will be a lil different than for normal animations + // which is fine? for example for genericanimations or tmpmeshmodifierbehaviours + // this makes 0 difference + cData.Reset(); + OnCharacterAnimated.Invoke(cData); + state.MeshModifiers.Combine(cData.MeshModifiers); + state.CharacterModifiers.Combine(cData.CharacterModifiers); + } + else return; + } + ApplyVertices(); Mediator.ApplyMesh(cData); if (updateVertices && Mediator.Text.mesh != null) Mediator.Text.UpdateVertexData(TMP_VertexDataUpdateFlags.All); + + void ApplyVertices() + { + if (state.CharacterModifiers.Modifier != 0 || + state.MeshModifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.Deltas)) + { + state.CalculateVertexPositions(cData, context); + cData.mesh.SetPosition(0, state.BL_Result); + cData.mesh.SetPosition(1, state.TL_Result); + cData.mesh.SetPosition(2, state.TR_Result); + cData.mesh.SetPosition(3, state.BR_Result); + } + + if (state.MeshModifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.Colors)) + { + cData.mesh.SetColor(0, state.MeshModifiers.BL_Color.GetValue(cData.InitialMesh.GetColor(0))); + cData.mesh.SetColor(1, state.MeshModifiers.TL_Color.GetValue(cData.InitialMesh.GetColor(1))); + cData.mesh.SetColor(2, state.MeshModifiers.TR_Color.GetValue(cData.InitialMesh.GetColor(2))); + cData.mesh.SetColor(3, state.MeshModifiers.BR_Color.GetValue(cData.InitialMesh.GetColor(3))); + } + + if (state.MeshModifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.UVs)) + { + cData.mesh.SetUV0(0, state.MeshModifiers.BL_UV0.GetValue(cData.InitialMesh.GetUV0(0))); + cData.mesh.SetUV0(1, state.MeshModifiers.TL_UV0.GetValue(cData.InitialMesh.GetUV0(1))); + cData.mesh.SetUV0(2, state.MeshModifiers.TR_UV0.GetValue(cData.InitialMesh.GetUV0(2))); + cData.mesh.SetUV0(3, state.MeshModifiers.BR_UV0.GetValue(cData.InitialMesh.GetUV0(3))); + + cData.mesh.SetUV2(0, state.MeshModifiers.BL_UV2.GetValue(cData.InitialMesh.GetUV2(0))); + cData.mesh.SetUV2(1, state.MeshModifiers.TL_UV2.GetValue(cData.InitialMesh.GetUV2(1))); + cData.mesh.SetUV2(2, state.MeshModifiers.TR_UV2.GetValue(cData.InitialMesh.GetUV2(2))); + cData.mesh.SetUV2(3, state.MeshModifiers.BR_UV2.GetValue(cData.InitialMesh.GetUV2(3))); + } + } } private bool AnimateCharacter(int index, CharData cData) { VisibilityState vState = Mediator.VisibilityStates[index]; return cData.info.isVisible && // If not visible, e.g. whitespace, dont animate - vState != VisibilityState.Hidden && // If hidden, dont animate - (defaultAnimations.Count != 0 || basic.HasAnyContaining(index) || vState != VisibilityState.Shown); // If has no animations, dont animate + vState != VisibilityState.Hidden && // If hidden, dont animate + (defaultAnimations.Count != 0 || basic.HasAnyContaining(index) || + vState != VisibilityState.Shown); // If has no animations, dont animate } private void UpdateCharacterAnimation_Impl(int index) @@ -818,8 +1009,6 @@ private void UpdateCharacterAnimation_Impl(int index) VisibilityState vState = Mediator.VisibilityStates[index]; if (!cData.info.isVisible || vState == VisibilityState.Hidden) return; - state.Reset(context, cData); - if (vState == VisibilityState.Showing) { bool prev = ignoreVisibilityChanges; @@ -905,7 +1094,9 @@ private void UpdateCharacterAnimation_Impl(int index) } if (vState != VisibilityState.Shown) - { Debug.LogWarning("This should be unreachable! - BUG"); } + { + Debug.LogWarning("This should be unreachable! - BUG"); + } if (IsExcludedBasic(cData.info.character)) { @@ -926,7 +1117,9 @@ void Animate(CachedAnimation ca, bool late) ca.animation.Animate(cData, ca.roContext); - state.UpdateVertexOffsets(); + state.MeshModifiers.Combine(cData.mesh.modifiers); + state.CharacterModifiers.Combine(cData.CharacterModifiers); + // stateNew.UpdateFromCharDataState(); } void AnimateBasic(bool late) @@ -1165,31 +1358,48 @@ bool AnimateHideList(bool late) void ApplyVertices() { - state.CalculateVertexPositions(); - - cData.SetVertex(0, state.BL_Result); - cData.SetVertex(1, state.TL_Result); - cData.SetVertex(2, state.TR_Result); - cData.SetVertex(3, state.BR_Result); - - cData.mesh.SetColor(0, state.BL_Color); - cData.mesh.SetColor(1, state.TL_Color); - cData.mesh.SetColor(2, state.TR_Color); - cData.mesh.SetColor(3, state.BR_Color); + return; + if (state.CharacterModifiers.Modifier != 0 || + state.MeshModifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.Deltas)) + { + state.CalculateVertexPositions(cData, context); + cData.mesh.SetPosition(0, state.BL_Result); + cData.mesh.SetPosition(1, state.TL_Result); + cData.mesh.SetPosition(2, state.TR_Result); + cData.mesh.SetPosition(3, state.BR_Result); + } - cData.mesh.SetUV0(0, state.BL_UV); - cData.mesh.SetUV0(1, state.TL_UV); - cData.mesh.SetUV0(2, state.TR_UV); - cData.mesh.SetUV0(3, state.BR_UV); + if (state.MeshModifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.Colors)) + { + cData.mesh.SetColor(0, state.MeshModifiers.BL_Color.GetValue(cData.InitialMesh.GetColor(0))); + cData.mesh.SetColor(1, state.MeshModifiers.TL_Color.GetValue(cData.InitialMesh.GetColor(1))); + cData.mesh.SetColor(2, state.MeshModifiers.TR_Color.GetValue(cData.InitialMesh.GetColor(2))); + cData.mesh.SetColor(3, state.MeshModifiers.BR_Color.GetValue(cData.InitialMesh.GetColor(3))); + } - cData.mesh.SetUV2(0, state.BL_UV2); - cData.mesh.SetUV2(1, state.TL_UV2); - cData.mesh.SetUV2(2, state.TR_UV2); - cData.mesh.SetUV2(3, state.BR_UV2); + if (state.MeshModifiers.Modifier.HasFlag(TMPMeshModifiers.ModifierFlags.UVs)) + { + cData.mesh.SetUV0(0, state.MeshModifiers.BL_UV0.GetValue(cData.InitialMesh.GetUV0(0))); + cData.mesh.SetUV0(1, state.MeshModifiers.TL_UV0.GetValue(cData.InitialMesh.GetUV0(1))); + cData.mesh.SetUV0(2, state.MeshModifiers.TR_UV0.GetValue(cData.InitialMesh.GetUV0(2))); + cData.mesh.SetUV0(3, state.MeshModifiers.BR_UV0.GetValue(cData.InitialMesh.GetUV0(3))); + + cData.mesh.SetUV2(0, state.MeshModifiers.BL_UV2.GetValue(cData.InitialMesh.GetUV2(0))); + cData.mesh.SetUV2(1, state.MeshModifiers.TL_UV2.GetValue(cData.InitialMesh.GetUV2(1))); + cData.mesh.SetUV2(2, state.MeshModifiers.TR_UV2.GetValue(cData.InitialMesh.GetUV2(2))); + cData.mesh.SetUV2(3, state.MeshModifiers.BR_UV2.GetValue(cData.InitialMesh.GetUV2(3))); + } } } + #endregion + private Vector3 bl, tl, tr, br; + + private void test() + { + } + #region Event Callbacks private void OnTextChanged_Early(bool textContentChanged, ReadOnlyCollection oldCharData) @@ -1202,7 +1412,8 @@ private void OnTextChanged_Early(bool textContentChanged, ReadOnlyCollection oldCharData, ReadOnlyCollection oldVisibilities) + private void OnTextChanged_Late(bool textContentChanged, ReadOnlyCollection oldCharData, + ReadOnlyCollection oldVisibilities) { QueueCharacterReset(); if (IsAnimating) UpdateAnimations_Impl(0f); @@ -1242,6 +1453,7 @@ private void OnVisibilityStateUpdated(int index, VisibilityState prev) Mediator.SetVisibilityState(index, VisibilityState.Shown); return; } + if (state == VisibilityState.Hiding) { Mediator.SetVisibilityState(index, VisibilityState.Hidden); @@ -1364,7 +1576,7 @@ void SetVerticesToZero() // Set the current mesh's vertices all to the initial mesh values for (int j = 0; j < 4; j++) { - cData.SetVertex(j, cData.InitialPosition);// cData.initialPosition); + cData.mesh.SetPosition(j, cData.InitialPosition); // cData.initialPosition); } } @@ -1373,7 +1585,7 @@ void SetVerticesToDefault() // Set the current mesh's vertices all to the initial mesh values for (int j = 0; j < 4; j++) { - cData.SetVertex(j, cData.mesh.initial.GetPosition(j)); + cData.mesh.SetPosition(j, cData.mesh.initial.GetPosition(j)); } } } @@ -1381,33 +1593,42 @@ void SetVerticesToDefault() private void PostProcessTags() { var roCData = new ReadOnlyCollection(Mediator.CharData); - var roCDataState = new ReadOnlyCharDataState(state); - - var kvpBasic = new KeyValuePair>>(basicCategory, processors.TagProcessors[basicCategory.Prefix][0].ProcessedTags); - var kvpShow = new KeyValuePair>>(showCategory, processors.TagProcessors[showCategory.Prefix][0].ProcessedTags); - var kvpHide = new KeyValuePair>>(hideCategory, processors.TagProcessors[hideCategory.Prefix][0].ProcessedTags); + var roCDataState = state; + + var kvpBasic = + new KeyValuePair>>( + basicCategory, processors.TagProcessors[basicCategory.Prefix][0].ProcessedTags); + var kvpShow = + new KeyValuePair>>( + showCategory, processors.TagProcessors[showCategory.Prefix][0].ProcessedTags); + var kvpHide = + new KeyValuePair>>( + hideCategory, processors.TagProcessors[hideCategory.Prefix][0].ProcessedTags); if (tags != null) tags.CollectionChanged -= OnTagCollectionChanged; tags = new TagCollectionManager(kvpBasic, kvpShow, kvpHide); tags.CollectionChanged += OnTagCollectionChanged; - var basicCacher = new AnimationCacher(basicCategory, roCDataState, context, roCData, (x) => !IsExcludedBasic(x)); - var showCacher = new AnimationCacher(showCategory, roCDataState, context, roCData, (x) => !IsExcludedShow(x)); - var hideCacher = new AnimationCacher(hideCategory, roCDataState, context, roCData, (x) => !IsExcludedHide(x)); + var basicCacher = + new AnimationCacher(basicCategory, roCDataState, context, roCData, (x) => !IsExcludedBasic(x)); + var showCacher = + new AnimationCacher(showCategory, roCDataState, context, roCData, (x) => !IsExcludedShow(x)); + var hideCacher = + new AnimationCacher(hideCategory, roCDataState, context, roCData, (x) => !IsExcludedHide(x)); basic = new CachedCollection(basicCacher, tags[basicCategory]); show = new CachedCollection(showCacher, tags[showCategory]); hide = new CachedCollection(hideCacher, tags[hideCategory]); } + #endregion #region Utility + private void ResetAllVisible() { if (Mediator == null) - { return; - } var info = Mediator.Text.textInfo; @@ -1428,9 +1649,11 @@ private void ResetAllVisible() if (Mediator.Text.mesh != null) Mediator.Text.UpdateVertexData(TMP_VertexDataUpdateFlags.All); } + #endregion #region Editor Only + #if UNITY_EDITOR #pragma warning disable CS0414 [SerializeField, HideInInspector] private bool preview = false; @@ -1442,13 +1665,17 @@ private void ResetAllVisible() #pragma warning restore CS0414 internal delegate void VoidHandler(); + internal event VoidHandler OnResetComponent; internal void StartPreview() { if (Mediator == null) return; - previewUpdater = new AnimationUpdater(UpdateAnimations_Impl, previewUpdatesPerSecond); + if (!preview || previewUpdater?.MaxUpdatesPerSecond != previewUpdatesPerSecond) + { + previewUpdater = new AnimationUpdater(UpdateAnimations_Impl, previewUpdatesPerSecond); + } preview = true; EditorApplication.update -= UpdatePreview; @@ -1516,7 +1743,8 @@ private void Reset() { enabled = false; EditorApplication.delayCall += () => this.enabled = true; - EditorApplication.delayCall += () => EditorApplication.delayCall += EditorApplication.QueuePlayerLoopUpdate; + EditorApplication.delayCall += + () => EditorApplication.delayCall += EditorApplication.QueuePlayerLoopUpdate; } OnResetComponent?.Invoke(); @@ -1528,15 +1756,24 @@ internal string CheckDefaultString(TMPAnimationType type, string str) switch (type) { case TMPAnimationType.Basic: - tempDatabase = new AnimationDatabase(database == null ? null : database.BasicAnimationDatabase == null ? null : database.BasicAnimationDatabase, sceneAnimations); + tempDatabase = new AnimationDatabase( + database == null ? null : + database.BasicAnimationDatabase == null ? null : database.BasicAnimationDatabase, + sceneAnimations); break; case TMPAnimationType.Show: - tempDatabase = new AnimationDatabase(database == null ? null : database.ShowAnimationDatabase == null ? null : database.ShowAnimationDatabase, sceneShowAnimations); + tempDatabase = new AnimationDatabase( + database == null ? null : + database.ShowAnimationDatabase == null ? null : database.ShowAnimationDatabase, + sceneShowAnimations); break; case TMPAnimationType.Hide: - tempDatabase = new AnimationDatabase(database == null ? null : database.HideAnimationDatabase == null ? null : database.HideAnimationDatabase, sceneHideAnimations); + tempDatabase = new AnimationDatabase( + database == null ? null : + database.HideAnimationDatabase == null ? null : database.HideAnimationDatabase, + sceneHideAnimations); break; default: @@ -1551,6 +1788,7 @@ internal string CheckDefaultString(TMPAnimationType type, string str) { return ""; } + str = (str.Trim()[0] == '<' ? str : "<" + str + ">"); if (!ParsingUtility.TryParseTag(str, 0, str.Length - 1, ref tagInfo, ParsingUtility.TagType.Open)) { @@ -1594,12 +1832,14 @@ internal void OnChangedBasicExclusion() RecalculateSegmentData(TMPAnimationType.Basic); QueueCharacterReset(); } + internal void OnChangedShowExclusion() { if (Mediator == null) return; RecalculateSegmentData(TMPAnimationType.Show); QueueCharacterReset(); } + internal void OnChangedHideExclusion() { if (Mediator == null) return; @@ -1613,9 +1853,11 @@ internal void OnChangedDatabase() OnDatabaseChanged(); } #endif + #endregion private bool characterResetQueued = false; + private void QueueCharacterReset() { characterResetQueued = true; diff --git a/Package/Runtime/Components/TMPAnimator/TMPAnimator.cs.meta b/Package/Runtime/Components/TMPAnimator/TMPAnimator.cs.meta index d279617..9b74b98 100644 --- a/Package/Runtime/Components/TMPAnimator/TMPAnimator.cs.meta +++ b/Package/Runtime/Components/TMPAnimator/TMPAnimator.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: cc24ef6e7f375784c9aa2fcb6e62b99f, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Package/Runtime/Components/TMPMediator/TMPMediator.cs b/Package/Runtime/Components/TMPMediator/TMPMediator.cs index 60f2651..7eb1203 100644 --- a/Package/Runtime/Components/TMPMediator/TMPMediator.cs +++ b/Package/Runtime/Components/TMPMediator/TMPMediator.cs @@ -254,7 +254,7 @@ public void ApplyMesh(CharData cData) Color32[] colors = info.meshInfo[mIndex].colors32; Vector3[] verts = info.meshInfo[mIndex].vertices; -#if UNITY_2023_2_OR_NEWER +#if TMPRO_3_2_0_PRE_10_OR_NEWER Vector4[] uvs0 = info.meshInfo[mIndex].uvs0; #else Vector2[] uvs0 = info.meshInfo[mIndex].uvs0; @@ -267,7 +267,7 @@ public void ApplyMesh(CharData cData) verts[vIndex + j] = CharData[index].mesh.GetPosition(j); colors[vIndex + j] = CharData[index].mesh.GetColor(j); -#if UNITY_2023_2_OR_NEWER +#if TMPRO_3_2_0_PRE_10_OR_NEWER Vector4 current = uvs0[vIndex + j]; Vector2 charUV0 = CharData[index].mesh.GetUV0(j); current.x = charUV0.x; @@ -425,7 +425,7 @@ private void Hide(int index) // Set the current mesh's vertices all to the initial mesh values for (int j = 0; j < 4; j++) { - cData.SetVertex(j, Vector3.zero);// cData.initialPosition); + cData.mesh.SetPosition(j, Vector3.zero); } // Apply the new vertices to the vertex array @@ -441,7 +441,7 @@ private void Show(int index) // Set the current mesh's vertices all to the initial mesh values for (int j = 0; j < 4; j++) { - cData.SetVertex(j, cData.mesh.initial.GetPosition(j)); + cData.mesh.SetPosition(j, cData.mesh.initial.GetPosition(j)); } // Apply the new vertices to the vertex array diff --git a/Package/Runtime/Components/TMPMeshModifier.cs b/Package/Runtime/Components/TMPMeshModifier.cs new file mode 100644 index 0000000..fe2714e --- /dev/null +++ b/Package/Runtime/Components/TMPMeshModifier.cs @@ -0,0 +1,44 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.Components; +using UnityEngine; + +// TODO Change name or change tmpmeshmodifiers name +[RequireComponent(typeof(TMPAnimator))] +[ExecuteInEditMode, ExecuteAlways] +public class TMPMeshModifier : MonoBehaviour +{ + [System.NonSerialized] private CharDataModifiers _modifiers; + [System.NonSerialized] private TMPAnimator _animator; + + // private void OnEnable() + // { + // if (_animator == null) + // _animator = GetComponent(); + // + // _modifiers = new CharDataModifiers(); + // _animator.OnCharacterAnimated += OnCharacterAnimated; + // } + // + // private void OnDisable() + // { + // _animator.OnCharacterAnimated -= OnCharacterAnimated; + // } + + private void OnCharacterAnimated(CharData cdata) + { + // Debug.Log("before " + cdata.CharacterModifiers.PositionDelta + " w/ " + _modifiers.CharacterModifiers.PositionDelta); + cdata.MeshModifiers.Combine(_modifiers.MeshModifiers); + cdata.CharacterModifiers.Combine(_modifiers.CharacterModifiers); + // Debug.Log("after " + cdata.CharacterModifiers.PositionDelta); + } + + public void SetModifiers(CharDataModifiers modifiers) + { + _modifiers = modifiers; + } + + +} diff --git a/Package/Runtime/Components/TMPMeshModifier.cs.meta b/Package/Runtime/Components/TMPMeshModifier.cs.meta new file mode 100644 index 0000000..556c8e8 --- /dev/null +++ b/Package/Runtime/Components/TMPMeshModifier.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: bd4a3ddfa860f244fa88642f9ebbf867 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Components/TMPWriter/TMPWriter.cs b/Package/Runtime/Components/TMPWriter/TMPWriter.cs index e65e8da..f150663 100644 --- a/Package/Runtime/Components/TMPWriter/TMPWriter.cs +++ b/Package/Runtime/Components/TMPWriter/TMPWriter.cs @@ -18,6 +18,7 @@ using TMPEffects.Databases.CommandDatabase; using TMPEffects.CharacterData; using TMPEffects.Tags; +using UnityEngine.Playables; namespace TMPEffects.Components { @@ -44,10 +45,12 @@ public class TMPWriter : TMPEffectComponent /// Whether the TMPWriter is currently writing text. /// public bool IsWriting => writing; + /// /// Whether the TMPWriter may skip the current section of text. /// public bool MaySkip => currentMaySkip; + /// /// The text index of the TMPWriter's current character. /// @@ -64,10 +67,12 @@ public class TMPWriter : TMPEffectComponent /// All tags parsed by the TMPWriter. /// public ITagCollection Tags => tags; + /// /// All command tags parsed by the TMPWriter. /// public ITagCollection CommandTags => tags == null ? null : tags[commandCategory]; + /// /// All event tags parsed by the TMPWriter. /// @@ -99,18 +104,22 @@ public bool UseScaledTime /// Raised when the TMPWriter reaches an event tag. /// public TMPEvent OnTextEvent; + /// /// Raised when the TMPWriter shows a new character. /// public UnityEvent OnCharacterShown; + /// /// Raised when the TMPWriter starts / resumes writing. /// public UnityEvent OnStartWriter; + /// /// Raised when the TMPWriter stops writing. /// public UnityEvent OnStopWriter; + /// /// Raised when the TMPWriter starts waiting. /// The float parameter indicates the amount of time the TMPWriter will wait, in seconds. @@ -124,10 +133,12 @@ public bool UseScaledTime /// Raised when the TMPWriter is done writing the current text. /// public UnityEvent OnFinishWriter; + /// /// Raised when the current (section of) text is skipped. /// public UnityEvent OnSkipWriter; + /// /// Raised when the TMPWriter is reset.
/// The integer parameter indicates the text index the TMPWriter was reset to. @@ -138,28 +149,36 @@ public bool UseScaledTime /// The prefix used for command tags. ///
public const char COMMAND_PREFIX = '!'; + /// /// The prefix used for event tags. /// public const char EVENT_PREFIX = '?'; #region Fields + // Settings - [Tooltip("The database used to process command tags (e.g. ")] - [SerializeField] TMPCommandDatabase database; + [Tooltip("The database used to process command tags (e.g. ")] [SerializeField] + TMPCommandDatabase database; //[Tooltip("The delay between new characters shown by the writer, i.e. the inverse of the speed of the writer.")] //[SerializeField] private float delay = 0.075f; - [Tooltip("Whether the text may be skipped by default.")] - [SerializeField] private bool maySkip = true; + [Tooltip("Whether the text may be skipped by default.")] [SerializeField] + private bool maySkip = true; + + [Tooltip( + "If checked, the writer will begin writing when it is first enabled. If not checked, you will have to manually start the writer from your own code.")] + [SerializeField] + private bool writeOnStart = true; - [Tooltip("If checked, the writer will begin writing when it is first enabled. If not checked, you will have to manually start the writer from your own code.")] - [SerializeField] private bool writeOnStart = true; - [Tooltip("If checked, the writer will automatically begin writing when the text on the associated TMP_Text component is modified. If not checked, you will have to manually start the writer from your own code.")] - [SerializeField] private bool writeOnNewText = true; - [Tooltip("Whether the writer should use scaled time to wait for delays and wait commands.")] - [SerializeField] private bool useScaledTime = true; + [Tooltip( + "If checked, the writer will automatically begin writing when the text on the associated TMP_Text component is modified. If not checked, you will have to manually start the writer from your own code.")] + [SerializeField] + private bool writeOnNewText = true; + + [Tooltip("Whether the writer should use scaled time to wait for delays and wait commands.")] [SerializeField] + private bool useScaledTime = true; [SerializeField] private Delays delays = new Delays(); @@ -188,17 +207,19 @@ public bool UseScaledTime [System.NonSerialized] private bool writing = false; [System.NonSerialized] private int currentIndex = -1; + #endregion #region Public methods #region Writer Controlling + /// /// Start (or resume) writing. /// public void StartWriter() { - if (Mediator == null/*!isActiveAndEnabled || !gameObject.activeInHierarchy*/) + if (Mediator == null /*!isActiveAndEnabled || !gameObject.activeInHierarchy*/) { Debug.LogWarning($"The TMPWriter component on {gameObject.name} is not enabled"); return; @@ -217,7 +238,7 @@ public void StartWriter() /// public void StopWriter() { - if (Mediator == null/*!isActiveAndEnabled || !gameObject.activeInHierarchy*/) + if (Mediator == null /*!isActiveAndEnabled || !gameObject.activeInHierarchy*/) { Debug.LogWarning($"The TMPWriter component on {gameObject.name} is not enabled"); return; @@ -228,7 +249,6 @@ public void StopWriter() StopWriterCoroutine(); RaiseStopWriterEvent(); } - } /// @@ -237,7 +257,7 @@ public void StopWriter() /// public void ResetWriter() { - if (Mediator == null/*!isActiveAndEnabled || !gameObject.activeInHierarchy*/) + if (Mediator == null /*!isActiveAndEnabled || !gameObject.activeInHierarchy*/) { Debug.LogWarning($"The TMPWriter component on {gameObject.name} is not enabled"); return; @@ -266,7 +286,7 @@ public void ResetWriter() /// The index to reset the writer to. public void ResetWriter(int index) { - if (Mediator == null/*!isActiveAndEnabled || !gameObject.activeInHierarchy*/) + if (Mediator == null /*!isActiveAndEnabled || !gameObject.activeInHierarchy*/) { Debug.LogWarning($"The TMPWriter component on {gameObject.name} is not enabled"); return; @@ -274,7 +294,8 @@ public void ResetWriter(int index) if (index >= currentIndex) { - Debug.LogWarning($"Can't reset the TMPWriter on {gameObject.name} to index {index}; current index is only {currentIndex}"); + Debug.LogWarning( + $"Can't reset the TMPWriter on {gameObject.name} to index {index}; current index is only {currentIndex}"); return; } @@ -307,7 +328,7 @@ public void ResetWriter(int index) /// public void SkipWriter(bool skipShowAnimation = true) { - if (Mediator == null/*!isActiveAndEnabled || !gameObject.activeInHierarchy*/) + if (Mediator == null /*!isActiveAndEnabled || !gameObject.activeInHierarchy*/) { Debug.LogWarning($"The TMPWriter component on {gameObject.name} is not enabled"); return; @@ -320,7 +341,9 @@ public void SkipWriter(bool skipShowAnimation = true) } int skipTo; - CachedCommand cc = commands.FirstOrDefault(x => x.Indices.StartIndex >= currentIndex && x.Tag.Name == "skippable" && x.Tag.Parameters != null && x.Tag.Parameters[""] == "false"); + CachedCommand cc = commands.FirstOrDefault(x => + x.Indices.StartIndex >= currentIndex && x.Tag.Name == "skippable" && x.Tag.Parameters != null && + x.Tag.Parameters[""] == "false"); if (cc == default) skipTo = Mediator.CharData.Count; else skipTo = cc.Indices.StartIndex; @@ -357,9 +380,11 @@ public void RestartWriter() ResetWriter(); StartWriter(); } + #endregion #region Writer Commands + /// /// Pause the writer for the given amount of seconds. /// @@ -378,12 +403,14 @@ public void Wait(float seconds) return; } + Debug.LogWarning("Setting to " + seconds); shouldWait = true; waitAmount = seconds; } public void ResetWaitPeriod() { + Debug.LogWarning("oops"); shouldWait = false; waitAmount = 0f; } @@ -413,9 +440,11 @@ public void SetSkippable(bool skippable) { currentMaySkip = skippable; } + #endregion #region Setters + /// /// Set the database that will be used to parse command tags. /// @@ -425,12 +454,13 @@ public void SetDatabase(TMPCommandDatabase database) this.database = database; OnDatabaseChanged(); } - #endregion + #endregion #endregion #region Initialization + private void OnEnable() { UpdateMediator(); @@ -545,10 +575,13 @@ private void ReprocessOnDatabaseChange(object sender) PrepareForProcessing(); Mediator.ForceReprocess(); } + #endregion #region Event Callbacks and Wrappers + [System.NonSerialized] private bool tagsChanged = false; + private void OnTextChanged_Early(bool textContentChanged, ReadOnlyCollection oldCharData) { tagsChanged = tags == null; @@ -557,12 +590,16 @@ private void OnTextChanged_Early(bool textContentChanged, ReadOnlyCollection(); - var newTags = processors.TagProcessors[commandCategory.Prefix].SelectMany(processed => processed.ProcessedTags).Select(tag => new TMPEffectTagTuple(tag.Value, tag.Key)); + var newTags = processors.TagProcessors[commandCategory.Prefix] + .SelectMany(processed => processed.ProcessedTags) + .Select(tag => new TMPEffectTagTuple(tag.Value, tag.Key)); if (oldTags.SequenceEqual(newTags)) { oldTags = tags.ContainsKey(eventCategory) ? EventTags : Enumerable.Empty(); - newTags = processors.TagProcessors[eventCategory.Prefix].SelectMany(processed => processed.ProcessedTags).Select(tag => new TMPEffectTagTuple(tag.Value, tag.Key)); + newTags = processors.TagProcessors[eventCategory.Prefix] + .SelectMany(processed => processed.ProcessedTags) + .Select(tag => new TMPEffectTagTuple(tag.Value, tag.Key)); if (oldTags.SequenceEqual(newTags)) { @@ -574,7 +611,8 @@ private void OnTextChanged_Early(bool textContentChanged, ReadOnlyCollection oldCharData, ReadOnlyCollection oldVisibilities) + private void OnTextChanged_Late(bool textContentChanged, ReadOnlyCollection oldCharData, + ReadOnlyCollection oldVisibilities) { if (!textContentChanged && !tagsChanged) { @@ -592,6 +630,7 @@ private void OnTextChanged_Late(bool textContentChanged, ReadOnlyCollection NRE) + for (int i = Mathf.Max(currentIndex, 0); + i < Mediator?.CharData.Count; + i++) // .? and other null checks because coroutines are not instantly cancelled (so disable writer => NRE) { currentIndex = i; cData = Mediator.CharData[i]; @@ -785,10 +829,6 @@ private IEnumerator WriterCoroutine() invokables = GetInvokables(i); foreach (var invokable in invokables) { - waitAmount = 0f; - shouldWait = false; - continueConditions = null; - invokable.Trigger(); // Wait for the given amount of time, and accomodate for excess wait time (frame-timing) @@ -807,6 +847,26 @@ private IEnumerator WriterCoroutine() if (Mediator == null) yield break; } + // Wait for the given amount of time, and accomodate for excess wait time (frame-timing) + FixTimePre(ref waitAmount); + if (shouldWait && waitAmount > 0) + { + yield return useScaledTime + ? new WaitForSeconds(waitAmount) + : new WaitForSecondsRealtime(waitAmount); + } + FixTimePost(waitAmount); + + while (continueConditions != null) + { + yield return HandleWaitConditions(); + if (Mediator == null) yield break; + } + + waitAmount = 0f; + shouldWait = false; + continueConditions = null; + // Calculate and wait for the delay for the current index, and accomodate for excess wait time (frame-timing) float delay = CalculateDelay(i); FixTimePre(ref delay); @@ -815,6 +875,7 @@ private IEnumerator WriterCoroutine() yield return useScaledTime ? new WaitForSeconds(delay) : new WaitForSecondsRealtime(delay); if (Mediator == null) yield break; } + FixTimePost(delay); // Show the current character, if it is not already shown @@ -939,7 +1000,9 @@ private float CalculateDelay(int index) } // If character is punctuation, and not directly followed by another punctuation (to multiple extended delays for e.g. "..." or "?!?" - if (char.IsPunctuation(cData.info.character) && (index == Mediator.CharData.Count - 1 || !char.IsPunctuation(Mediator.CharData[index + 1].info.character))) + if (char.IsPunctuation(cData.info.character) && (index == Mediator.CharData.Count - 1 || + !char.IsPunctuation(Mediator.CharData[index + 1].info + .character))) { return Mathf.Max(currentDelays.CalculatedPunctuationDelay, 0); } @@ -965,7 +1028,6 @@ private IEnumerator HandleWaitConditions() } if (!allMet) yield return null; - } while (!allMet && continueConditions != null); continueConditions = null; @@ -989,10 +1051,14 @@ private IEnumerable GetInvokables(int index, bool skipped = fa if (eventsEnabled) { invokables = invokables.Concat(events); - invokables = invokables.OrderBy(x => x.Indices.StartIndex).ThenBy(x => x.Indices.OrderAtIndex); + invokables = invokables.OrderBy(x => x.Indices.StartIndex) + .ThenBy(x => x.Indices.OrderAtIndex); } } - else { invokables = events; } + else + { + invokables = events; + } invokables = invokables.Where(x => x.Indices.StartIndex >= index && x.ExecuteOnSkip); } @@ -1004,7 +1070,6 @@ private IEnumerable GetInvokables(int index, bool skipped = fa invokables = invokables.Where(x => x.ExecuteInstantly); } else invokables = new List(); - } else { @@ -1014,7 +1079,8 @@ private IEnumerable GetInvokables(int index, bool skipped = fa if (eventsEnabled) { invokables = invokables.Concat(events.GetAt(index)); - invokables = invokables.OrderBy(x => x.Indices.StartIndex).ThenBy(x => x.Indices.OrderAtIndex); + invokables = invokables.OrderBy(x => x.Indices.StartIndex) + .ThenBy(x => x.Indices.OrderAtIndex); } } else invokables = events.GetAt(index); @@ -1032,6 +1098,7 @@ private IEnumerable GetInvokables(int index, bool skipped = fa invokables = invokables.Concat(events); invokables = invokables.OrderBy(x => x.Indices.StartIndex).ThenBy(x => x.Indices.OrderAtIndex); } + invokables = invokables.Where(x => x.Indices.StartIndex >= index && x.ExecuteOnSkip); } else if (index < 0) @@ -1126,24 +1193,32 @@ private void OnStartWriting() { writing = true; } + #endregion #region Editor + #if UNITY_EDITOR #pragma warning disable CS0414 //[System.NonSerialized] bool reprocessFlag = false; [SerializeField, HideInInspector] bool useDefaultDatabase = true; [SerializeField, HideInInspector] bool initDatabase = false; - [Tooltip("Raise text events in preview mode?")] - [SerializeField, HideInInspector] bool eventsEnabled = false; - [Tooltip("Raise commands in preview mode?")] - [SerializeField, HideInInspector] bool commandsEnabled = true; + + [Tooltip("Raise text events in preview mode?")] [SerializeField, HideInInspector] + bool eventsEnabled = false; + + [Tooltip("Raise commands in preview mode?")] [SerializeField, HideInInspector] + bool commandsEnabled = true; #pragma warning restore CS0414 internal delegate void CharDataHandler(TMPWriter writer, CharData cData); + internal delegate void IntHandler(TMPWriter writer, int index); + internal delegate void VoidHandler(TMPWriter writer); + internal delegate void ResetHandler(); + internal event CharDataHandler OnCharacterShownPreview; internal event IntHandler OnResetWriterPreview; internal event IntHandler OnSkipWriterPreview; @@ -1198,7 +1273,8 @@ private void Reset() { enabled = false; EditorApplication.delayCall += () => this.enabled = true; - EditorApplication.delayCall += () => EditorApplication.delayCall += EditorApplication.QueuePlayerLoopUpdate; + EditorApplication.delayCall += + () => EditorApplication.delayCall += EditorApplication.QueuePlayerLoopUpdate; } OnResetComponent?.Invoke(); @@ -1248,6 +1324,7 @@ internal void SetWriter(int index) RaiseResetWriterEvent(index); } #endif + #endregion /// @@ -1269,31 +1346,40 @@ public class Delays /// /// The calculated delay after "showing" a whitespace character, using and . /// - public float CalculatedWhiteSpaceDelay => whitespaceDelayType == DelayType.Raw ? whitespaceDelay : delay * whitespaceDelay; + public float CalculatedWhiteSpaceDelay => + whitespaceDelayType == DelayType.Raw ? whitespaceDelay : delay * whitespaceDelay; + /// /// The calculated delay after showing a punctuation character, using and . /// - public float CalculatedPunctuationDelay => punctuationDelayType == DelayType.Raw ? punctuationDelay : delay * punctuationDelay; + public float CalculatedPunctuationDelay => + punctuationDelayType == DelayType.Raw ? punctuationDelay : delay * punctuationDelay; + /// /// The calculated delay after "showing" an already visible character, using and . /// - public float CalculatedVisibleDelay => visibleDelayType == DelayType.Raw ? visibleDelay : delay * visibleDelay; + public float CalculatedVisibleDelay => + visibleDelayType == DelayType.Raw ? visibleDelay : delay * visibleDelay; + /// /// The calculated delay after "showing" a linebreak character, using and . /// - public float CalculatedLinebreakDelay => linebreakDelayType == DelayType.Raw ? linebreakDelay : delay * linebreakDelay; + public float CalculatedLinebreakDelay => + linebreakDelayType == DelayType.Raw ? linebreakDelay : delay * linebreakDelay; /// /// The delay after showing a character. /// - [Tooltip("The delay between new characters shown by the writer, i.e. the inverse of the speed of the writer.")] + [Tooltip( + "The delay between new characters shown by the writer, i.e. the inverse of the speed of the writer.")] public float delay = 0.035f; - /// - /// The delay after "showing" a whitespace character. - /// + /// + /// The delay after "showing" a whitespace character. + /// [Tooltip("The delay after whitespace characters, either as percentage of the general delay or in seconds")] public float whitespaceDelay; + /// /// The of . /// @@ -1304,6 +1390,7 @@ public class Delays /// [Tooltip("The delay after linebreaks, either as percentage of the general delay or in seconds")] public float linebreakDelay; + /// /// The of . /// @@ -1314,6 +1401,7 @@ public class Delays /// [Tooltip("The delay after punctuation characters, either as percentage of the general delay or in seconds")] public float punctuationDelay; + /// /// The of . /// @@ -1322,8 +1410,10 @@ public class Delays /// /// The delay after "showing" an already visible character. /// - [Tooltip("The delay after already visible characters, either as percentage of the general delay or in seconds")] + [Tooltip( + "The delay after already visible characters, either as percentage of the general delay or in seconds")] public float visibleDelay; + /// /// The of . /// @@ -1386,8 +1476,12 @@ private void HideAllCharacters(bool skipAnimations = false) private void PostProcessTags() { - var kvpCommands = new KeyValuePair>>(commandCategory, processors.TagProcessors[commandCategory.Prefix][0].ProcessedTags); - var kvpEvents = new KeyValuePair>>(eventCategory, processors.TagProcessors[eventCategory.Prefix][0].ProcessedTags); + var kvpCommands = + new KeyValuePair>>( + commandCategory, processors.TagProcessors[commandCategory.Prefix][0].ProcessedTags); + var kvpEvents = + new KeyValuePair>>( + eventCategory, processors.TagProcessors[eventCategory.Prefix][0].ProcessedTags); tags = new TagCollectionManager(kvpCommands, kvpEvents); @@ -1398,4 +1492,4 @@ private void PostProcessTags() events = new CachedCollection(eventCacher, tags[eventCategory]); } } -} +} \ No newline at end of file diff --git a/Package/Runtime/Components/TMPWriter/TMPWriter.cs.meta b/Package/Runtime/Components/TMPWriter/TMPWriter.cs.meta index 7d0b56f..77377ae 100644 --- a/Package/Runtime/Components/TMPWriter/TMPWriter.cs.meta +++ b/Package/Runtime/Components/TMPWriter/TMPWriter.cs.meta @@ -5,7 +5,7 @@ MonoImporter: serializedVersion: 2 defaultReferences: [] executionOrder: 0 - icon: {instanceID: 0} + icon: {fileID: 2800000, guid: b82bc6ac8fb314f429822c8da55947eb, type: 3} userData: assetBundleName: assetBundleVariant: diff --git a/Package/Runtime/CurveHideAnimation.cs b/Package/Runtime/CurveHideAnimation.cs new file mode 100644 index 0000000..3cdd2b8 --- /dev/null +++ b/Package/Runtime/CurveHideAnimation.cs @@ -0,0 +1,52 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.TMPAnimations; +using UnityEngine; + +namespace TMPEffects.TMPAnimations.ShowAnimations +{ + [CreateAssetMenu(fileName = "new CurveHideAnimation", menuName = "TMPEffects/Animations/Hide Animations/Curve")] + public class CurveHideAnimation : TMPHideAnimation + { + public TMPAnimation animation; + public AnimationCurve curve; + public float duration; + + public override void Animate(CharData cData, IAnimationContext context) + { + if (animation == null) return; + + float passed = context.AnimatorContext.PassedTime - context.AnimatorContext.StateTime(cData); + float t = curve.Evaluate(passed / duration); + if (passed > duration) + { + context.FinishAnimation(cData); + return; + } + + animation.Animate(cData, context); + CharDataModifiers.LerpCharacterModifiersUnclamped(cData, cData.CharacterModifiers, t, + cData.CharacterModifiers); + CharDataModifiers.LerpMeshModifiersUnclamped(cData, cData.MeshModifiers, t, cData.MeshModifiers); + } + + public override bool ValidateParameters(IDictionary parameters) + { + if (animation == null) return false; + return animation.ValidateParameters(parameters); + } + + public override void SetParameters(object customData, IDictionary parameters) + { + if (animation == null) return; + animation.SetParameters(customData, parameters); + } + + public override object GetNewCustomData() + { + if (animation == null) return null; + return animation.GetNewCustomData(); + } + } +} \ No newline at end of file diff --git a/Package/Runtime/CurveHideAnimation.cs.meta b/Package/Runtime/CurveHideAnimation.cs.meta new file mode 100644 index 0000000..2a14f84 --- /dev/null +++ b/Package/Runtime/CurveHideAnimation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 3de373a70ce46254783da5aebfdc80e9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/CurveShowAnimation.cs b/Package/Runtime/CurveShowAnimation.cs new file mode 100644 index 0000000..461a47f --- /dev/null +++ b/Package/Runtime/CurveShowAnimation.cs @@ -0,0 +1,52 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.TMPAnimations; +using UnityEngine; + +namespace TMPEffects.TMPAnimations.ShowAnimations +{ + [CreateAssetMenu(fileName = "new CurveShowAnimation", menuName = "TMPEffects/Animations/Show Animations/Curve")] + public class CurveShowAnimation : TMPShowAnimation + { + public TMPAnimation animation; + public AnimationCurve curve; + public float duration; + + public override void Animate(CharData cData, IAnimationContext context) + { + if (animation == null) return; + + float passed = context.AnimatorContext.PassedTime - context.AnimatorContext.StateTime(cData); + float t = curve.Evaluate(passed / duration); + if (passed > duration) + { + context.FinishAnimation(cData); + return; + } + + animation.Animate(cData, context); + CharDataModifiers.LerpCharacterModifiersUnclamped(cData, cData.CharacterModifiers, 1 - t, + cData.CharacterModifiers); + CharDataModifiers.LerpMeshModifiersUnclamped(cData, cData.MeshModifiers, 1 - t, cData.MeshModifiers); + } + + public override bool ValidateParameters(IDictionary parameters) + { + if (animation == null) return false; + return animation.ValidateParameters(parameters); + } + + public override void SetParameters(object customData, IDictionary parameters) + { + if (animation == null) return; + animation.SetParameters(customData, parameters); + } + + public override object GetNewCustomData() + { + if (animation == null) return null; + return animation.GetNewCustomData(); + } + } +} \ No newline at end of file diff --git a/Package/Runtime/CurveShowAnimation.cs.meta b/Package/Runtime/CurveShowAnimation.cs.meta new file mode 100644 index 0000000..326a26b --- /dev/null +++ b/Package/Runtime/CurveShowAnimation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 42505c55b9306ad42801e81ae3e8fd11 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Effects/TMPAnimations/AnimationContext.cs b/Package/Runtime/Effects/TMPAnimations/AnimationContext.cs index dff99af..440423a 100644 --- a/Package/Runtime/Effects/TMPAnimations/AnimationContext.cs +++ b/Package/Runtime/Effects/TMPAnimations/AnimationContext.cs @@ -31,14 +31,14 @@ public SegmentData SegmentData /// public object CustomData { get; } /// - public ICharDataState State { get; } + public CharDataModifiers Modifiers { get; } private SegmentData segmentData; - public AnimationContext(IAnimatorContext animatorContext, ICharDataState state, SegmentData segmentData, object customData) + public AnimationContext(IAnimatorContext animatorContext, CharDataModifiers modifiers, SegmentData segmentData, object customData) { this.CustomData = customData; - this.State = state; + this.Modifiers = modifiers; this.AnimatorContext = animatorContext; this.SegmentData = segmentData; } diff --git a/Package/Runtime/Effects/TMPAnimations/AnimationStep.cs b/Package/Runtime/Effects/TMPAnimations/AnimationStep.cs new file mode 100644 index 0000000..c887c89 --- /dev/null +++ b/Package/Runtime/Effects/TMPAnimations/AnimationStep.cs @@ -0,0 +1,92 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.Components.Animator; +using TMPEffects.Parameters; +using TMPEffects.TMPAnimations; +using UnityEngine; +using UnityEngine.Serialization; + +[Serializable] +public class AnimationStep +{ + public string name; + public bool animate = true; + + public AnimationUtility.FancyAnimationCurve entryCurve; + public float entryDuration; + + public AnimationUtility.FancyAnimationCurve exitCurve; + public float exitDuration; + + public ExtrapolationMode preExtrapolation; + public ExtrapolationMode postExtrapolation; + + // TODO These dont really make much sense anymore right now since itll just overwrite the following steps / clips + // Then: Need to figure out how to do oneshot vs looping animations. Maybe loop per track. or smth idk. + [Tooltip("Whether this animation step should automatically loop over time. " + + "For GenericAnimations, this can be disregarded if the animation itself is set to repeat.")] + public bool loops; + [Tooltip("How many times this animation step should automatically loop over time. " + + "For GenericAnimations, this can be disregarded if the animation itself is set to repeat.")] + public uint repetitions; + + public bool useWave; + public ParameterTypes.WaveOffsetType waveOffsetType; + public AnimationUtility.Wave wave; + + public float startTime; + public float duration; + + // Get end time of this step; if loops forever (repetitions == 0), float.MaxValue + public float EndTime => + !loops + ? startTime + duration + : (repetitions != 0 ? startTime + duration * repetitions : float.MaxValue); + + public bool useInitialModifiers = false; + public EditorFriendlyCharDataModifiers initModifiers; + public EditorFriendlyCharDataModifiers modifiers; + + public AnimationStep() + { + } + + public AnimationStep(AnimationStep original) + { + name = original.name; + animate = original.animate; + + entryCurve = new AnimationUtility.FancyAnimationCurve(original.entryCurve); + entryDuration = original.entryDuration; + exitCurve = new AnimationUtility.FancyAnimationCurve(original.exitCurve); + exitDuration = original.exitDuration; + + preExtrapolation = original.preExtrapolation; + postExtrapolation = original.postExtrapolation; + + loops = original.loops; + repetitions = original.repetitions; + + useWave = original.useWave; + waveOffsetType = original.waveOffsetType; + wave = new AnimationUtility.Wave(original.wave); // TODO Wave is class so need to copy here + + startTime = original.startTime; + duration = original.duration; + + useInitialModifiers = original.useInitialModifiers; + initModifiers = new EditorFriendlyCharDataModifiers(original.initModifiers); + modifiers = new EditorFriendlyCharDataModifiers(original.modifiers); + } + + public enum ExtrapolationMode + { + None, + Hold, + Loop, + PingPong, + Continue + } +} \ No newline at end of file diff --git a/Package/Runtime/Effects/TMPAnimations/AnimationStep.cs.meta b/Package/Runtime/Effects/TMPAnimations/AnimationStep.cs.meta new file mode 100644 index 0000000..f791360 --- /dev/null +++ b/Package/Runtime/Effects/TMPAnimations/AnimationStep.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 649c15b3be9530247a9825557269be35 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Effects/TMPAnimations/AnimationUtility.cs b/Package/Runtime/Effects/TMPAnimations/AnimationUtility.cs index c5a61f6..da92db1 100644 --- a/Package/Runtime/Effects/TMPAnimations/AnimationUtility.cs +++ b/Package/Runtime/Effects/TMPAnimations/AnimationUtility.cs @@ -6,6 +6,8 @@ using TMPro; using TMPEffects.Components; using TMPEffects.Parameters; +using UnityEngine.Serialization; +using UnityEngine.UIElements; namespace TMPEffects.TMPAnimations { @@ -14,16 +16,27 @@ namespace TMPEffects.TMPAnimations /// public static class AnimationUtility { + #region Scaling + /// /// Scale a given value to make it uniform between and components. /// /// /// The value to scale. /// The scaled value. - public static float ScaleTextMesh(TMP_Text text, float value) + public static float ScaleTextMesh(TMP_Text text, float value) => + ScaleTextMesh(text.canvas != null, value); + + public static float ScaleTextMesh(IAnimatorContext ctx, float value) + => ScaleTextMesh(ctx.Animator.TextComponent.canvas != null, value); + + public static float ScaleTextMesh(IAnimationContext ctx, float value) + => ScaleTextMesh(ctx.AnimatorContext.Animator.TextComponent.canvas != null, value); + + public static float ScaleTextMesh(bool isTMProUGUI, float value) { - if (text.canvas == null) return value * 10; - else return value; + if (!isTMProUGUI) return value * 10; + return value; } /// @@ -35,7 +48,11 @@ public static float ScaleTextMesh(TMP_Text text, float value) /// The the vector will applied to. /// The of the animation. /// The scaled vector. - public static Vector3 ScaleVector(Vector3 vector, CharData cData, IAnimationContext context) => ScaleVector(vector, cData, context.AnimatorContext); + public static Vector3 ScaleVector(Vector3 vector, CharData cData, IAnimationContext context) => + ScaleVector(vector, context.AnimatorContext.Animator.TextComponent.canvas != null, + context.AnimatorContext.ScaleAnimations, context.AnimatorContext.ScaleUniformly, + cData.info.pointSize, context.AnimatorContext.Animator.TextComponent.fontSize); + /// /// Scale a vector for an animation.
/// Used by to automatically scale animations. @@ -44,12 +61,38 @@ public static float ScaleTextMesh(TMP_Text text, float value) /// The the vector will applied to. /// The of the animation. /// The scaled vector. - public static Vector3 ScaleVector(Vector3 vector, CharData cData, IAnimatorContext context) + public static Vector3 ScaleVector(Vector3 vector, CharData cData, IAnimatorContext context) => + ScaleVector(vector, context.Animator.TextComponent.canvas != null, context.ScaleAnimations, + context.ScaleUniformly, + cData.info.pointSize, context.Animator.TextComponent.fontSize); + + + public static Vector3 ScaleVector(Vector3 vector, bool isTMProUGUI, bool scaleAnimations, bool scaleUniformly, + float pointSize, float fontSize) + { + vector /= ScaleTextMesh(isTMProUGUI, 1f); + if (!scaleAnimations) return vector; + if (!scaleUniformly) return vector * (pointSize / 36f); + return vector * (fontSize / 36f); + } + + public static Vector3 IgnoreScaling(Vector3 vector, CharData cData, IAnimationContext context) => + IgnoreScaling(vector, context.AnimatorContext.Animator.TextComponent.canvas != null, + context.AnimatorContext.ScaleAnimations, context.AnimatorContext.ScaleUniformly, + cData.info.pointSize, context.AnimatorContext.Animator.TextComponent.fontSize); + + public static Vector3 IgnoreScaling(Vector3 vector, CharData cData, IAnimatorContext context) => + IgnoreScaling(vector, context.Animator.TextComponent.canvas != null, context.ScaleAnimations, + context.ScaleUniformly, + cData.info.pointSize, context.Animator.TextComponent.fontSize); + + public static Vector3 IgnoreScaling(Vector3 vector, bool isTMProUGUI, bool scaleAnimations, bool scaleUniformly, + float pointSize, float fontSize) { - vector /= ScaleTextMesh(context.Animator.TextComponent, 1f); - if (!context.ScaleAnimations) return vector; - if (!context.ScaleUniformly) return vector * (cData.info.pointSize / 36f); - return vector * (context.Animator.TextComponent.fontSize / 36f); + vector *= ScaleTextMesh(isTMProUGUI, 1f); + if (!scaleAnimations) return vector; + if (!scaleUniformly) return vector / (pointSize / 36f); + return vector / (fontSize / 36f); } /// @@ -60,7 +103,9 @@ public static Vector3 ScaleVector(Vector3 vector, CharData cData, IAnimatorConte /// The the vector will be applied to. /// The of the animation. /// The inversely scaled vector. - public static Vector3 InverseScaleVector(Vector3 vector, CharData cData, IAnimationContext context) => InverseScaleVector(vector, cData, context.AnimatorContext); + public static Vector3 InverseScaleVector(Vector3 vector, CharData cData, IAnimationContext context) => + IgnoreScaling(vector, cData, context.AnimatorContext); + /// /// Scale a vector for an animation inversely.
/// automatically scales animations; using this method scales the vector in a way that makes it effectively ignore the 's scaling. @@ -69,16 +114,14 @@ public static Vector3 ScaleVector(Vector3 vector, CharData cData, IAnimatorConte /// The the vector will be applied to. /// The of the animation. /// The inversely scaled vector. - public static Vector3 InverseScaleVector(Vector3 vector, CharData cData, IAnimatorContext context) - { - vector *= ScaleTextMesh(context.Animator.TextComponent, 1f); - if (!context.ScaleAnimations) return vector; - if (!context.ScaleUniformly) return vector / (cData.info.pointSize / 36f); - return vector / (context.Animator.TextComponent.fontSize / 36f); - } + public static Vector3 InverseScaleVector(Vector3 vector, CharData cData, IAnimatorContext context) => + IgnoreScaling(vector, cData, context); + + #endregion #region Raw Positions & Deltas + /// /// Convert an anchor vector to its actual position vector. /// @@ -95,8 +138,8 @@ public static Vector2 AnchorToPosition(Vector2 anchor, CharData cData) Vector2 dist; Vector2 ret = cData.InitialPosition; - Vector2 up = (cData.initialMesh.TL_Position - cData.initialMesh.BL_Position) / 2f; - Vector2 right = (cData.initialMesh.BR_Position - cData.initialMesh.BL_Position) / 2f; + Vector2 up = (cData.InitialMesh.TL_Position - cData.InitialMesh.BL_Position) / 2f; + Vector2 right = (cData.InitialMesh.BR_Position - cData.InitialMesh.BL_Position) / 2f; dist.x = (cData.mesh.initial.BL_Position - cData.mesh.initial.BR_Position).magnitude / 2f; dist.y = (cData.mesh.initial.BL_Position - cData.mesh.initial.TL_Position).magnitude / 2f; @@ -115,7 +158,9 @@ public static Vector2 AnchorToPosition(Vector2 anchor, CharData cData) /// The to act on. /// The of the animation. /// The raw version of the passed in vertex position, i.e. the one that will ignore the 's scaling. - public static Vector3 GetRawVertex(int index, Vector3 position, CharData cData, IAnimationContext ctx) => GetRawVertex(index, position, cData, ctx.AnimatorContext); + public static Vector3 GetRawVertex(int index, Vector3 position, CharData cData, IAnimationContext ctx) => + GetRawVertex(index, position, cData, ctx.AnimatorContext); + /// /// Calculate the raw version of the passed in vertex position, i.e. the one that will ignore the animator's scaling. /// @@ -126,7 +171,7 @@ public static Vector2 AnchorToPosition(Vector2 anchor, CharData cData) /// The raw version of the passed in vertex position, i.e. the one that will ignore the 's scaling. public static Vector3 GetRawVertex(int index, Vector3 position, CharData cData, IAnimatorContext ctx) { - return GetRawPosition(position, cData.initialMesh.GetPosition(index), cData, ctx); + return GetRawPosition(position, cData.InitialMesh.GetPosition(index), cData, ctx); } /// @@ -136,7 +181,9 @@ public static Vector3 GetRawVertex(int index, Vector3 position, CharData cData, /// The to act on. /// The of the animation. /// The raw version of the passed in character position, i.e. the one that will ignore the 's scaling. - public static Vector3 GetRawPosition(Vector3 position, CharData cData, IAnimationContext ctx) => GetRawPosition(position, cData, ctx.AnimatorContext); + public static Vector3 GetRawPosition(Vector3 position, CharData cData, IAnimationContext ctx) => + GetRawPosition(position, cData, ctx.AnimatorContext); + /// /// Calculate the raw version of the passed in character position, i.e. the one that will ignore the animator's scaling. /// @@ -156,7 +203,9 @@ public static Vector3 GetRawPosition(Vector3 position, CharData cData, IAnimator /// The to act on. /// The of the animation. /// The raw version of the passed in pivot position, i.e. the one that will ignore the 's scaling. - public static Vector3 GetRawPivot(Vector3 position, CharData cData, IAnimationContext ctx) => GetRawPivot(position, cData, ctx.AnimatorContext); + public static Vector3 GetRawPivot(Vector3 position, CharData cData, IAnimationContext ctx) => + GetRawPivot(position, cData, ctx.AnimatorContext); + /// /// Calculate the raw version of the passed in pivot position, i.e. the one that will ignore the animator's scaling. /// @@ -176,7 +225,9 @@ public static Vector3 GetRawPivot(Vector3 position, CharData cData, IAnimatorCon /// The to act on. /// The of the animation. /// The raw version of the passed in delta, i.e. the one that will ignore the 's scaling. - public static Vector3 GetRawDelta(Vector3 delta, CharData cData, IAnimationContext ctx) => GetRawDelta(delta, cData, ctx.AnimatorContext); + public static Vector3 GetRawDelta(Vector3 delta, CharData cData, IAnimationContext ctx) => + GetRawDelta(delta, cData, ctx.AnimatorContext); + /// /// Calculate the raw version of the passed in delta, i.e. the one that will ignore the animator's scaling. /// @@ -186,16 +237,16 @@ public static Vector3 GetRawPivot(Vector3 position, CharData cData, IAnimatorCon /// The raw version of the passed in delta, i.e. the one that will ignore the 's scaling. public static Vector3 GetRawDelta(Vector3 delta, CharData cData, IAnimatorContext ctx) { - return InverseScaleVector(delta, cData, ctx); + return IgnoreScaling(delta, cData, ctx); } - internal static Vector3 GetRawPosition(Vector3 position, Vector3 referencePosition, CharData cData, IAnimatorContext ctx) + internal static Vector3 GetRawPosition(Vector3 position, Vector3 referencePosition, CharData cData, + IAnimatorContext ctx) { - return InverseScaleVector(position - referencePosition, cData, ctx) + referencePosition; + return IgnoreScaling(position - referencePosition, cData, ctx) + referencePosition; } - /// /// Set the raw position of the vertex at the given index. This position will ignore the animator's scaling. /// @@ -203,7 +254,9 @@ internal static Vector3 GetRawPosition(Vector3 position, Vector3 referencePositi /// The position to set the vertex to. /// The to act on. /// The of the animation. - public static void SetVertexRaw(int index, Vector3 position, CharData cData, IAnimationContext ctx) => SetVertexRaw(index, position, cData, ctx.AnimatorContext); + public static void SetVertexRaw(int index, Vector3 position, CharData cData, IAnimationContext ctx) => + SetVertexRaw(index, position, cData, ctx.AnimatorContext); + /// /// Set the raw position of the vertex at the given index. This position will ignore the animator's scaling. /// @@ -213,8 +266,8 @@ internal static Vector3 GetRawPosition(Vector3 position, Vector3 referencePositi /// The of the animation. public static void SetVertexRaw(int index, Vector3 position, CharData cData, IAnimatorContext ctx) { - Vector3 ogPos = cData.initialMesh.GetPosition(index); - cData.SetVertex(index, GetRawPosition(position, ogPos, cData, ctx)); + Vector3 ogPos = cData.InitialMesh.GetPosition(index); + cData.mesh.SetPosition(index, GetRawPosition(position, ogPos, cData, ctx)); } /// @@ -223,7 +276,9 @@ public static void SetVertexRaw(int index, Vector3 position, CharData cData, IAn /// The position to set the character to. /// The to act on. /// The of the animation. - public static void SetPositionRaw(Vector3 position, CharData cData, IAnimationContext ctx) => SetPositionRaw(position, cData, ctx.AnimatorContext); + public static void SetPositionRaw(Vector3 position, CharData cData, IAnimationContext ctx) => + SetPositionRaw(position, cData, ctx.AnimatorContext); + /// /// Set the raw position of the character. This position will ignore the animator's scaling. /// @@ -236,82 +291,10 @@ public static void SetPositionRaw(Vector3 position, CharData cData, IAnimatorCon cData.SetPosition(GetRawPosition(position, ogPos, cData, ctx)); } - /// - /// Set the raw pivot of the character. This position will ignore the animator's scaling. - /// - /// The position to set the pivot to. - /// The to act on. - /// The of the animation. - public static void SetPivotRaw(Vector3 pivot, CharData cData, IAnimationContext ctx) => SetPivotRaw(pivot, cData, ctx.AnimatorContext); - /// - /// Set the raw pivot of the character. This position will ignore the animator's scaling. - /// - /// The position to set the pivot to. - /// The to act on. - /// The of the animation. - public static void SetPivotRaw(Vector3 pivot, CharData cData, IAnimatorContext ctx) - { - Vector3 ogPos = cData.InitialPosition; - cData.SetPivot(GetRawPosition(pivot, ogPos, cData, ctx)); - } - - /// - /// Add a raw delta to the vertex at the given index. This delta will ignore the animator's scaling. - /// - /// Index of the vertex. - /// The delta to add to the vertex. - /// The to act on. - /// The of the animation. - public static void AddVertexDeltaRaw(int index, Vector3 delta, CharData cData, IAnimationContext ctx) => AddVertexDeltaRaw(index, delta, cData, ctx.AnimatorContext); - /// - /// Add a raw delta to the vertex at the given index. This delta will ignore the animator's scaling. - /// - /// Index of the vertex. - /// The delta to add to the vertex. - /// The to act on. - /// The of the animation. - public static void AddVertexDeltaRaw(int index, Vector3 delta, CharData cData, IAnimatorContext ctx) - { - cData.AddVertexDelta(index, GetRawDelta(delta, cData, ctx)); - } - - /// - /// Add a raw delta to the position of the character. This delta will ignore the animator's scaling. - /// - /// The delta to add to the position of the character. - /// The to act on. - /// The of the animation. - public static void AddPositionDeltaRaw(Vector3 delta, CharData cData, IAnimationContext ctx) => AddPositionDeltaRaw(delta, cData, ctx.AnimatorContext); - /// - /// Add a raw delta to the position of the character. This delta will ignore the animator's scaling. - /// - /// The delta to add to the position of the character. - /// The to act on. - /// The of the animation. - public static void AddPositionDeltaRaw(Vector3 delta, CharData cData, IAnimatorContext ctx) - { - cData.AddPositionDelta(GetRawDelta(delta, cData, ctx)); - } - /// - /// Add a raw delta to the pivot of the character. This delta will ignore the animator's scaling. - /// - /// The delta to add to the pivot. - /// The to act on. - /// The of the animation. - public static void AddPivotDeltaRaw(Vector3 delta, CharData cData, IAnimationContext ctx) => AddPivotDeltaRaw(delta, cData, ctx.AnimatorContext); - /// - /// Add a raw delta to the pivot of the character. This delta will ignore the animator's scaling. - /// - /// The delta to add to the pivot. - /// The to act on. - /// The of the animation. - public static void AddPivotDeltaRaw(Vector3 delta, CharData cData, IAnimatorContext ctx) - { - cData.AddPivotDelta(GetRawDelta(delta, cData, ctx)); - } #endregion #region General Math + /// /// Get the point on a line closest to the given point. /// @@ -339,9 +322,72 @@ public static Vector3 ClosestPointOnLine(Vector3 lineStart, Vector3 lineEnd, Vec return vClosestPoint; } + #endregion + [System.Serializable] + public class FancyAnimationCurve + { + public AnimationCurve Curve + { + get => curve; + set => curve = value; + } + + public float Uniformity + { + get => uniformity; + set => uniformity = value; + } + + public ParameterTypes.WaveOffsetType OffsetType + { + get => offsetType; + set => offsetType = value; + } + + public TMPWrapMode WrapMode + { + get => wrapMode; + set => wrapMode = value; + } + + [SerializeField] private AnimationCurve curve; + [SerializeField] private float uniformity; + [SerializeField] private ParameterTypes.WaveOffsetType offsetType; + [SerializeField] private TMPWrapMode wrapMode; + + public FancyAnimationCurve() {} + + public FancyAnimationCurve(FancyAnimationCurve original) + { + curve = new AnimationCurve(original.curve.keys); + uniformity = original.uniformity; + offsetType = original.offsetType; + wrapMode = original.wrapMode; + } + + // TODO Quick addition to make evaluation without anim context possible + // TODO If i do split interfaces up further wont be necessary anymore i think + public float Evaluate(CharData cData, IAnimatorContext ctx, float time) + { + float offset = GetWaveOffset(cData, ctx, offsetType); + float t = time - offset * uniformity; + return GetValue(curve, wrapMode, t); + } + + public float Evaluate(CharData cData, IAnimationContext ctx, float time) + { + float offset = GetWaveOffset(cData, ctx, offsetType); + float t = time - offset * uniformity; + // t = Mathf.Abs(t); // TODO ? + return GetValue(curve, wrapMode, t); + } + } + + #region Waves + /// /// Base class for .
/// Allows you to easily create periodic animations. @@ -362,7 +408,9 @@ public float UpPeriod set { if (value < 0f) throw new System.ArgumentException(nameof(UpPeriod) + " may not be negative"); - if (value + downPeriod <= 0) throw new System.ArgumentException("The sum of " + nameof(UpPeriod) + " and " + nameof(DownPeriod) + " must be larger than zero"); + if (value + downPeriod <= 0) + throw new System.ArgumentException("The sum of " + nameof(UpPeriod) + " and " + + nameof(DownPeriod) + " must be larger than zero"); upPeriod = value; period = upPeriod + downPeriod; @@ -393,7 +441,9 @@ public float DownPeriod set { if (value < 0f) throw new System.ArgumentException(nameof(DownPeriod) + " may not be negative"); - if (value + upPeriod <= 0) throw new System.ArgumentException("The sum of " + nameof(UpPeriod) + " and " + nameof(DownPeriod) + " must be larger than zero"); + if (value + upPeriod <= 0) + throw new System.ArgumentException("The sum of " + nameof(UpPeriod) + " and " + + nameof(DownPeriod) + " must be larger than zero"); downPeriod = value; period = upPeriod + downPeriod; @@ -493,7 +543,8 @@ public float Frequency } public WaveBase() : this(1f, 1f, 1f, 1f) - { } + { + } public WaveBase(float upPeriod, float downPeriod, float velocity, float amplitude) { @@ -516,12 +567,19 @@ public WaveBase(float upPeriod, float downPeriod, float velocity, float amplitud Amplitude = amplitude; } - [Tooltip("The time it takes for the wave to travel from trough to crest, or from its lowest to its highest point, in seconds")] - [SerializeField] private float upPeriod; - [Tooltip("The time it takes for the wave to travel from crest to trough, or from its highest to its lowest point, in seconds")] - [SerializeField] private float downPeriod; - [Tooltip("The amplitude of the wave")] - [SerializeField] private float amplitude; + [Tooltip( + "The time it takes for the wave to travel from trough to crest, or from its lowest to its highest point, in seconds")] + [SerializeField] + private float upPeriod; + + [Tooltip( + "The time it takes for the wave to travel from crest to trough, or from its highest to its lowest point, in seconds")] + [SerializeField] + private float downPeriod; + + [Tooltip("The amplitude of the wave")] [SerializeField] + private float amplitude; + [SerializeField, HideInInspector] private float velocity; [System.NonSerialized] private float period; @@ -575,6 +633,7 @@ public AnimationCurve UpwardCurve get => upwardCurve; set => upwardCurve = value; } + /// /// The downward curve of the wave. /// @@ -592,6 +651,7 @@ public float CrestWait get => crestWait; set => crestWait = value; } + /// /// How long to stay at the trough of the wave. /// @@ -613,24 +673,30 @@ public float Uniformity set => uniformity = value; } - public Wave() : this(AnimationCurveUtility.EaseInOutSine(), AnimationCurveUtility.EaseInOutSine(), 1f, 1f, 1f, 0f, 0f, 1f) - { } + public Wave() : this(AnimationCurveUtility.EaseInOutSine(), AnimationCurveUtility.EaseInOutSine(), 1f, 1f, + 1f, 0f, 0f, 1f) + { + } - public Wave(AnimationCurve upwardCurve, AnimationCurve downwardCurve, float upPeriod, float downPeriod, float amplitude, float uniformity = 1f) : base(upPeriod, downPeriod, 1f, amplitude) + public Wave(AnimationCurve upwardCurve, AnimationCurve downwardCurve, float upPeriod, float downPeriod, + float amplitude, float uniformity = 1f) : base(upPeriod, downPeriod, 1f, amplitude) { if (upwardCurve == null) throw new System.ArgumentNullException(nameof(upwardCurve)); if (downwardCurve == null) throw new System.ArgumentNullException(nameof(downwardCurve)); if (upPeriod < 0) throw new System.ArgumentException(nameof(upPeriod) + " may not be negative"); if (downPeriod < 0) throw new System.ArgumentException(nameof(downPeriod) + " may not be negative"); - if ((upPeriod + downPeriod) <= 0) throw new System.ArgumentException("The sum of " + nameof(upPeriod) + " and " + nameof(downPeriod) + " must be larger than zero"); + if ((upPeriod + downPeriod) <= 0) + throw new System.ArgumentException("The sum of " + nameof(upPeriod) + " and " + nameof(downPeriod) + + " must be larger than zero"); this.uniformity = uniformity; UpwardCurve = upwardCurve; DownwardCurve = downwardCurve; } - public Wave(AnimationCurve upwardCurve, AnimationCurve downwardCurve, float upPeriod, float downPeriod, float amplitude, float crestWait, float troughWait, float uniformity = 1f) + public Wave(AnimationCurve upwardCurve, AnimationCurve downwardCurve, float upPeriod, float downPeriod, + float amplitude, float crestWait, float troughWait, float uniformity = 1f) : this(upwardCurve, downwardCurve, upPeriod, downPeriod, amplitude, uniformity) { if (crestWait < 0) throw new System.ArgumentException(nameof(crestWait) + " may not be negative"); @@ -640,6 +706,16 @@ public Wave(AnimationCurve upwardCurve, AnimationCurve downwardCurve, float upPe TroughWait = troughWait; } + public Wave(Wave wave) + { + uniformity = wave.uniformity; + crestWait = wave.crestWait; + troughWait = wave.troughWait; + downwardCurve = new AnimationCurve(wave.downwardCurve.keys); + upwardCurve = new AnimationCurve(wave.upwardCurve.keys); + wavelength = wave.wavelength; + } + /// /// Check whether an extrema was passed between ( - ) and .
/// This will automatically choose the correct way to interpret the wave. @@ -651,7 +727,8 @@ public Wave(AnimationCurve upwardCurve, AnimationCurve downwardCurve, float upPe /// If the wave has a or , this parameter defines whether an extremum is passed once the wait time begins, or once it ends. /// 1 if a maximum was passed, -1 if a minimum was passed, 0 if no extremum was passed. /// - public int PassedExtrema(float time, float deltaTime, float offset, bool realtimeWait = true, PulseExtrema extrema = PulseExtrema.Early) + public int PassedExtrema(float time, float deltaTime, float offset, bool realtimeWait = true, + PulseExtrema extrema = PulseExtrema.Early) { if (CrestWait <= 0) { @@ -720,7 +797,8 @@ public int PassedWaveExtrema(float time, float deltaTime, float offset) /// If the wave has a or , this parameter defines whether an extremum is passed once the wait time begins, or once it ends. /// 1 if a maximum was passed, -1 if a minimum was passed, 0 if no extremum was passed. /// - public int PassedPulseExtrema(float time, float deltaTime, float offset, bool realtimeWait = true, PulseExtrema extrema = PulseExtrema.Early) + public int PassedPulseExtrema(float time, float deltaTime, float offset, bool realtimeWait = true, + PulseExtrema extrema = PulseExtrema.Early) { float interval = (TroughWait) * (realtimeWait ? Velocity : 1f) + EffectivePeriod; float t = CalculatePulseT(time, offset, interval, -1); @@ -774,7 +852,8 @@ public int PassedPulseExtrema(float time, float deltaTime, float offset, bool re /// If the wave has a or , this parameter defines whether an extremum is passed once the wait time begins, or once it ends. /// 1 if a maximum was passed, -1 if a minimum was passed, 0 if no extremum was passed. /// - public int PassedInvertedPulseExtrema(float time, float deltaTime, float offset, bool realtimeWait = true, PulseExtrema extrema = PulseExtrema.Early) + public int PassedInvertedPulseExtrema(float time, float deltaTime, float offset, bool realtimeWait = true, + PulseExtrema extrema = PulseExtrema.Early) { float interval = (CrestWait) * (realtimeWait ? Velocity : 1f) + EffectivePeriod; float t = CalculatePulseT(time, offset, interval, -1); @@ -827,7 +906,8 @@ public int PassedInvertedPulseExtrema(float time, float deltaTime, float offset, /// If the wave has a or , this parameter defines whether an extremum is passed once the wait time begins, or once it ends. /// 1 if a maximum was passed, -1 if a minimum was passed, 0 if no extremum was passed. /// - public int PassedOneDirectionalPulseExtrema(float time, float deltaTime, float offset, bool realtimeWait = true, PulseExtrema extrema = PulseExtrema.Early) + public int PassedOneDirectionalPulseExtrema(float time, float deltaTime, float offset, + bool realtimeWait = true, PulseExtrema extrema = PulseExtrema.Early) { float upInterval = (CrestWait) * (realtimeWait ? Velocity : 1f); float downInterval = (TroughWait) * (realtimeWait ? Velocity : 1f); @@ -986,8 +1066,14 @@ public int PassedOneDirectionalPulseExtrema(float time, float deltaTime, float o t %= interval; if (t <= 0) return (Amplitude * GetValue(UpwardCurve, WrapMode.PingPong, 0f), 1); - if (t <= EffectiveUpPeriod) return (Amplitude * GetValue(UpwardCurve, WrapMode.PingPong, Mathf.Lerp(0f, 1f, t / EffectiveUpPeriod)), 1); - if (t <= (EffectivePeriod)) return (Amplitude * GetValue(DownwardCurve, WrapMode.PingPong, Mathf.Lerp(1f, 2f, (t - EffectiveUpPeriod) / EffectiveDownPeriod)), -1); + if (t <= EffectiveUpPeriod) + return ( + Amplitude * GetValue(UpwardCurve, WrapMode.PingPong, Mathf.Lerp(0f, 1f, t / EffectiveUpPeriod)), + 1); + if (t <= (EffectivePeriod)) + return ( + Amplitude * GetValue(DownwardCurve, WrapMode.PingPong, + Mathf.Lerp(1f, 2f, (t - EffectiveUpPeriod) / EffectiveDownPeriod)), -1); return (Amplitude * GetValue(DownwardCurve, WrapMode.PingPong, 2f), -1); } @@ -1008,8 +1094,14 @@ public int PassedOneDirectionalPulseExtrema(float time, float deltaTime, float o t %= interval; if (t <= 0) return (Amplitude * GetValue(DownwardCurve, WrapMode.PingPong, 1f), -1); - if (t <= EffectiveDownPeriod) return (Amplitude * GetValue(DownwardCurve, WrapMode.PingPong, Mathf.Lerp(1f, 2f, t / EffectiveDownPeriod)), -1); - if (t <= EffectivePeriod) return (Amplitude * GetValue(UpwardCurve, WrapMode.PingPong, Mathf.Lerp(0f, 1f, (t - EffectiveDownPeriod) / EffectiveUpPeriod)), 1); + if (t <= EffectiveDownPeriod) + return ( + Amplitude * GetValue(DownwardCurve, WrapMode.PingPong, + Mathf.Lerp(1f, 2f, t / EffectiveDownPeriod)), -1); + if (t <= EffectivePeriod) + return ( + Amplitude * GetValue(UpwardCurve, WrapMode.PingPong, + Mathf.Lerp(0f, 1f, (t - EffectiveDownPeriod) / EffectiveUpPeriod)), 1); return (Amplitude * GetValue(UpwardCurve, WrapMode.PingPong, 1f), 1); } @@ -1033,7 +1125,9 @@ public int PassedOneDirectionalPulseExtrema(float time, float deltaTime, float o if (t <= EffectiveUpPeriod) { - return (Amplitude * GetValue(UpwardCurve, WrapMode.PingPong, Mathf.Lerp(0f, 1f, t / EffectiveUpPeriod)), 1); + return ( + Amplitude * GetValue(UpwardCurve, WrapMode.PingPong, Mathf.Lerp(0f, 1f, t / EffectiveUpPeriod)), + 1); } t -= EffectiveUpPeriod; @@ -1045,7 +1139,9 @@ public int PassedOneDirectionalPulseExtrema(float time, float deltaTime, float o t -= upInterval; if (t <= EffectiveDownPeriod) { - return (Amplitude * GetValue(DownwardCurve, WrapMode.PingPong, Mathf.Lerp(1f, 2f, t / EffectiveDownPeriod)), -1); + return ( + Amplitude * GetValue(DownwardCurve, WrapMode.PingPong, + Mathf.Lerp(1f, 2f, t / EffectiveDownPeriod)), -1); } t -= EffectiveDownPeriod; @@ -1081,6 +1177,7 @@ private float CalculatePulseT(float time, float offset, float interval, int mult int times = (int)Math.Ceiling(Mathf.Abs(t / interval)); t += times * interval; } + return t; } @@ -1104,8 +1201,10 @@ public override void OnBeforeSerialize() { base.OnBeforeSerialize(); - if (upwardCurve == null || upwardCurve.keys.Length == 0) upwardCurve = AnimationCurveUtility.EaseInOutSine(); - if (downwardCurve == null || downwardCurve.keys.Length == 0) downwardCurve = AnimationCurveUtility.EaseInOutSine(); + if (upwardCurve == null || upwardCurve.keys.Length == 0) + upwardCurve = AnimationCurveUtility.EaseInOutSine(); + if (downwardCurve == null || downwardCurve.keys.Length == 0) + downwardCurve = AnimationCurveUtility.EaseInOutSine(); crestWait = Mathf.Max(crestWait, 0f); troughWait = Mathf.Max(troughWait, 0f); @@ -1115,8 +1214,10 @@ public override void OnAfterDeserialize() { base.OnAfterDeserialize(); - if (upwardCurve == null || upwardCurve.keys.Length == 0) upwardCurve = AnimationCurveUtility.EaseInOutSine(); - if (downwardCurve == null || downwardCurve.keys.Length == 0) downwardCurve = AnimationCurveUtility.EaseInOutSine(); + if (upwardCurve == null || upwardCurve.keys.Length == 0) + upwardCurve = AnimationCurveUtility.EaseInOutSine(); + if (downwardCurve == null || downwardCurve.keys.Length == 0) + downwardCurve = AnimationCurveUtility.EaseInOutSine(); troughWait = Mathf.Max(troughWait, 0f); crestWait = Mathf.Max(crestWait, 0f); @@ -1125,16 +1226,80 @@ public override void OnAfterDeserialize() } - [Tooltip("The \"up\" part of the wave. This is the curve that is used to travel from trough to crest, or from the wave's lowest to its highest point.")] - [SerializeField] private AnimationCurve upwardCurve; - [Tooltip("The \"down\" part of the wave. This is the curve that is used to travel from crest to trough, or from the wave's highest to its lowest point.")] - [SerializeField] private AnimationCurve downwardCurve; + [Tooltip( + "The \"up\" part of the wave. This is the curve that is used to travel from trough to crest, or from the wave's lowest to its highest point.")] + [SerializeField] + private AnimationCurve upwardCurve; + + [Tooltip( + "The \"down\" part of the wave. This is the curve that is used to travel from crest to trough, or from the wave's highest to its lowest point.")] + [SerializeField] + private AnimationCurve downwardCurve; + [Tooltip("The amount of time to remain at the crest before moving down again, in seconds.")] - [SerializeField] private float crestWait; - [Tooltip("The amount of time to remain at the trough before moving up again, in seconds.")] - [SerializeField] private float troughWait; - [Tooltip("The uniformity of the wave. The closer to zero, the more uniform the wave is applied to the effected characters.")] - [SerializeField] private float uniformity; + [SerializeField] + private float crestWait; + + [Tooltip("The amount of time to remain at the trough before moving up again, in seconds.")] [SerializeField] + private float troughWait; + + [Tooltip( + "The uniformity of the wave. The closer to zero, the more uniform the wave is applied to the effected characters.")] + [SerializeField] + private float uniformity; + } + + + // TODO Quick solution for using this from TMPMeshModifier, where no AnimationContext is available + // Could probably mock it instead + public static float GetWaveOffset(CharData cData, IAnimatorContext context, ParameterTypes.WaveOffsetType type, + int segmentIndex = 0, + bool ignoreScaling = false) + { + switch (type) + { + case ParameterTypes.WaveOffsetType.SegmentIndex: return segmentIndex; + case ParameterTypes.WaveOffsetType.Index: return cData.info.index; + + case ParameterTypes.WaveOffsetType.Line: return cData.info.lineNumber; + case ParameterTypes.WaveOffsetType.Baseline: return cData.info.baseLine; + case ParameterTypes.WaveOffsetType.Word: return cData.info.wordNumber; + + case ParameterTypes.WaveOffsetType.WorldXPos: + return ScalePos(context.Animator.transform.TransformPoint(cData.InitialPosition).x); + case ParameterTypes.WaveOffsetType.WorldYPos: + return ScalePos(context.Animator.transform.TransformPoint(cData.InitialPosition).y); + case ParameterTypes.WaveOffsetType.WorldZPos: + return ScalePos(context.Animator.transform.TransformPoint(cData.InitialPosition).z); + case ParameterTypes.WaveOffsetType.XPos: return ScalePos(cData.InitialPosition.x); + case ParameterTypes.WaveOffsetType.YPos: return ScalePos(cData.InitialPosition.y); + } + + throw new System.NotImplementedException(nameof(type)); + + float ScalePos(float pos) + { + if (ignoreScaling) return pos; + + // Rewrote ScaleVector with float here for performance + // Ideally would reuse same code + pos = ScaleTextMesh(context.Animator.TextComponent, pos); + + if (!context.ScaleAnimations) + return pos / 10f; + + if (context.ScaleUniformly) + { + if (context.Animator.TextComponent.fontSize != 0) + pos /= (context.Animator.TextComponent.fontSize / 36f); + return pos / 10f; + } + else + { + if (cData.info.pointSize != 0) pos /= (cData.info.pointSize / 36f); + return pos / 10f; + } + } } /// @@ -1144,30 +1309,42 @@ public override void OnAfterDeserialize() /// The character to get the offset for. /// The context of the animation. /// The type of the offset. + /// Whether to ignore the scaling of the character, if applicable.
+ /// For example, an will return a different offset based on the size of the text, + /// as it directly considers the x position of the character. /// The offset for a wave. - /// - public static float GetWaveOffset(CharData cData, IAnimationContext context, ParameterTypes.WaveOffsetType type) + /// + public static float GetWaveOffset(CharData cData, IAnimationContext context, ParameterTypes.WaveOffsetType type, + bool ignoreScaling = false) { switch (type) { - case ParameterTypes.WaveOffsetType.SegmentIndex: return context.SegmentData.SegmentIndexOf(cData); + case ParameterTypes.WaveOffsetType.SegmentIndex: + return context.SegmentData.SegmentIndexOf(cData); case ParameterTypes.WaveOffsetType.Index: return cData.info.index; case ParameterTypes.WaveOffsetType.Line: return cData.info.lineNumber; case ParameterTypes.WaveOffsetType.Baseline: return cData.info.baseLine; case ParameterTypes.WaveOffsetType.Word: return cData.info.wordNumber; - case ParameterTypes.WaveOffsetType.WorldXPos: return ScalePos(context.AnimatorContext.Animator.transform.TransformPoint(cData.InitialPosition).x); - case ParameterTypes.WaveOffsetType.WorldYPos: return ScalePos(context.AnimatorContext.Animator.transform.TransformPoint(cData.InitialPosition).y); - case ParameterTypes.WaveOffsetType.WorldZPos: return ScalePos(context.AnimatorContext.Animator.transform.TransformPoint(cData.InitialPosition).z); + case ParameterTypes.WaveOffsetType.WorldXPos: + return ScalePos(context.AnimatorContext.Animator.transform.TransformPoint(cData.InitialPosition).x); + case ParameterTypes.WaveOffsetType.WorldYPos: + return ScalePos(context.AnimatorContext.Animator.transform.TransformPoint(cData.InitialPosition).y); + case ParameterTypes.WaveOffsetType.WorldZPos: + return ScalePos(context.AnimatorContext.Animator.transform.TransformPoint(cData.InitialPosition).z); case ParameterTypes.WaveOffsetType.XPos: return ScalePos(cData.InitialPosition.x); case ParameterTypes.WaveOffsetType.YPos: return ScalePos(cData.InitialPosition.y); } - throw new System.ArgumentException(nameof(type)); + throw new System.NotImplementedException(nameof(type)); float ScalePos(float pos) { + if (ignoreScaling) return pos; + + // Rewrote ScaleVector with float here for performance + // Ideally would reuse same code pos = ScaleTextMesh(context.AnimatorContext.Animator.TextComponent, pos); if (!context.AnimatorContext.ScaleAnimations) @@ -1175,7 +1352,8 @@ float ScalePos(float pos) if (context.AnimatorContext.ScaleUniformly) { - if (context.AnimatorContext.Animator.TextComponent.fontSize != 0) pos /= (context.AnimatorContext.Animator.TextComponent.fontSize / 36f); + if (context.AnimatorContext.Animator.TextComponent.fontSize != 0) + pos /= (context.AnimatorContext.Animator.TextComponent.fontSize / 36f); return pos / 10f; } else @@ -1185,6 +1363,7 @@ float ScalePos(float pos) } } } + #endregion /// @@ -1210,32 +1389,33 @@ public static void SetToCharacter(TMP_Character newCharacter, TMP_Character orig float widthDelta = newCharacter.glyph.metrics.width - originalCharacter.glyph.metrics.width; - Vector3 bl = new Vector3(cData.initialMesh.BL_Position.x + horizontalBearingXDelta * spriteScale, - cData.initialMesh.BL_Position.y + (horizontalBearingYDelta - heightDelta) * spriteScale); + Vector3 bl = new Vector3(cData.InitialMesh.BL_Position.x + horizontalBearingXDelta * spriteScale, + cData.InitialMesh.BL_Position.y + (horizontalBearingYDelta - heightDelta) * spriteScale); Vector3 tl = new Vector3(bl.x, - cData.initialMesh.TL_Position.y + horizontalBearingYDelta * spriteScale); + cData.InitialMesh.TL_Position.y + horizontalBearingYDelta * spriteScale); Vector3 tr = new Vector3( - cData.initialMesh.TR_Position.x + (horizontalBearingXDelta + widthDelta) * spriteScale, + cData.InitialMesh.TR_Position.x + (horizontalBearingXDelta + widthDelta) * spriteScale, tl.y); Vector3 br = new Vector3(tr.x, bl.y); var fontAsset = cData.info.fontAsset; - + Rect glyphRectDelta = new Rect( newCharacter.glyph.glyphRect.x - originalCharacter.glyph.glyphRect.x, newCharacter.glyph.glyphRect.y - originalCharacter.glyph.glyphRect.y, - newCharacter.glyph.glyphRect.width- originalCharacter.glyph.glyphRect.width, + newCharacter.glyph.glyphRect.width - originalCharacter.glyph.glyphRect.width, newCharacter.glyph.glyphRect.height - originalCharacter.glyph.glyphRect.height ); - Vector2 uv0 = new Vector2(cData.initialMesh.BL_UV0.x + (glyphRectDelta.x / fontAsset.atlasWidth), - cData.initialMesh.BL_UV0.y + (glyphRectDelta.y / fontAsset.atlasHeight)); + Vector2 uv0 = new Vector2(cData.InitialMesh.BL_UV0.x + (glyphRectDelta.x / fontAsset.atlasWidth), + cData.InitialMesh.BL_UV0.y + (glyphRectDelta.y / fontAsset.atlasHeight)); Vector2 uv1 = new Vector2(uv0.x, - cData.initialMesh.TL_UV0.y + (glyphRectDelta.y + glyphRectDelta.height) / fontAsset.atlasHeight); - Vector2 uv2 = new Vector2(cData.initialMesh.TR_UV0.x + (glyphRectDelta.x + glyphRectDelta.width) / fontAsset.atlasWidth, - uv1.y); + cData.InitialMesh.TL_UV0.y + (glyphRectDelta.y + glyphRectDelta.height) / fontAsset.atlasHeight); + Vector2 uv2 = new Vector2( + cData.InitialMesh.TR_UV0.x + (glyphRectDelta.x + glyphRectDelta.width) / fontAsset.atlasWidth, + uv1.y); Vector2 uv3 = new Vector2(uv2.x, uv0.y); - + SetVertexRaw(0, bl, cData, context); SetVertexRaw(1, tl, cData, context); SetVertexRaw(2, tr, cData, context); @@ -1255,22 +1435,57 @@ public static void SetToCharacter(TMP_Character newCharacter, TMP_Character orig /// The time value. /// The value of the curve at the given time value. /// - public static float GetValue(AnimationCurve curve, WrapMode wrapMode, float time) + public static float GetValue(AnimationCurve curve, WrapMode wrapMode, float time) + { + return GetValue(curve, wrapMode.ToTMPWrapMode(), time); + } + + public static float GetValue(AnimationCurve curve, TMPWrapMode wrapMode, float time) { float t; switch (wrapMode) { - case WrapMode.Loop: + case TMPWrapMode.Loop: t = Mathf.Repeat(time, 1); return curve.Evaluate(t); - case WrapMode.PingPong: + case TMPWrapMode.PingPong: t = Mathf.PingPong(time, 1); return curve.Evaluate(t); - case WrapMode.Once: + case TMPWrapMode.Clamp: return curve.Evaluate(time); - default: throw new System.ArgumentException("WrapMode " + wrapMode.ToString() + " not supported"); + default: throw new System.ArgumentException("TMPWrapMode " + wrapMode.ToString() + " not supported"); + } + } + + internal static TMPWrapMode ToTMPWrapMode(this WrapMode wrapMode) + { + switch (wrapMode) + { + case WrapMode.PingPong: return TMPWrapMode.PingPong; + case WrapMode.Clamp: return TMPWrapMode.Clamp; + case WrapMode.Loop: return TMPWrapMode.Loop; + default: throw new System.NotSupportedException("WrapMode " + wrapMode.ToString() + " can not be converted to TMPWrapMode"); + } + } + + public static WrapMode ToWrapMode(this TMPWrapMode wrapMode) + { + switch (wrapMode) + { + case TMPWrapMode.PingPong: return WrapMode.PingPong; + case TMPWrapMode.Clamp: return WrapMode.Clamp; + case TMPWrapMode.Loop: return WrapMode.Loop; + default: throw new System.NotSupportedException("TMPWrapMode " + wrapMode.ToString() + " can not be converted to WrapMode"); } } + + [Serializable] + public enum TMPWrapMode + { + Clamp, + Loop, + PingPong, + } } } \ No newline at end of file diff --git a/Package/Runtime/Effects/TMPAnimations/Basic Animations/ContPivotAnimation.cs b/Package/Runtime/Effects/TMPAnimations/Basic Animations/ContPivotAnimation.cs index a0e100c..538b7d8 100644 --- a/Package/Runtime/Effects/TMPAnimations/Basic Animations/ContPivotAnimation.cs +++ b/Package/Runtime/Effects/TMPAnimations/Basic Animations/ContPivotAnimation.cs @@ -7,15 +7,18 @@ namespace TMPEffects.TMPAnimations.Animations { - [CreateAssetMenu(fileName = "new ContPivotAnimation", menuName = "TMPEffects/Animations/Basic Animations/Built-in/ContPivot")] + [CreateAssetMenu(fileName = "new ContPivotAnimation", + menuName = "TMPEffects/Animations/Basic Animations/Built-in/ContPivot")] public class ContPivotAnimation : TMPAnimation { - [Tooltip("The speed of the rotation, in rotations per second.\nAliased: speed, sp, s")] - [SerializeField] private float speed; - [Tooltip("The pivot position of the rotation.\nAliases: pivot, pv, p")] - [SerializeField] private TypedVector3 pivot = new TypedVector3(VectorType.Anchor, Vector3.zero); - [Tooltip("The axis to rotate around.\nAliases: rotationaxis, axis, a")] - [SerializeField] private Vector3 rotationAxis = Vector3.right; + [Tooltip("The speed of the rotation, in rotations per second.\nAliased: speed, sp, s")] [SerializeField] + private float speed; + + [Tooltip("The pivot position of the rotation.\nAliases: pivot, pv, p")] [SerializeField] + private TypedVector3 pivot = new TypedVector3(VectorType.Anchor, Vector3.zero); + + [Tooltip("The axis to rotate around.\nAliases: rotationaxis, axis, a")] [SerializeField] + private Vector3 rotationAxis = Vector3.right; public override void Animate(CharData cData, IAnimationContext context) { @@ -29,16 +32,26 @@ private void ContinuousRotation(CharData cData, IAnimationContext context) // Calculate the angle based on the evaluate wave float angle = (context.AnimatorContext.PassedTime * d.speed * 360) % 360; - // Set the rotation using the rotationaxis and current angle - cData.SetRotation(Quaternion.AngleAxis(angle, d.rotationAxis)); + // TODO This should implement the offset version; update to work for position and anchor + cData.AddRotation(Quaternion.AngleAxis(angle, d.rotationAxis).eulerAngles, + cData.InitialPosition + new Vector3(d.pivot.vector.x, d.pivot.vector.y, 0f)); - // Set the pivot depending on its type - switch (d.pivot.type) - { - case VectorType.Position: SetPivotRaw(d.pivot.vector, cData, context); break; - case VectorType.Offset: cData.SetPivot(cData.InitialPosition + new Vector3(d.pivot.vector.x, d.pivot.vector.y, 0f)); break; - case VectorType.Anchor: SetPivotRaw(AnchorToPosition(d.pivot.vector, cData), cData, context); break; - } + // // Set the rotation using the rotationaxis and current angle + // cData.SetRotation(Quaternion.AngleAxis(angle, d.rotationAxis)); + // + // // Set the pivot depending on its type + // switch (d.pivot.type) + // { + // case VectorType.Position: + // SetPivotRaw(d.pivot.vector, cData, context); + // break; + // case VectorType.Offset: + // cData.SetPivot(cData.InitialPosition + new Vector3(d.pivot.vector.x, d.pivot.vector.y, 0f)); + // break; + // case VectorType.Anchor: + // SetPivotRaw(AnchorToPosition(d.pivot.vector, cData), cData, context); + // break; + // } } public override void SetParameters(object customData, IDictionary parameters) @@ -46,7 +59,8 @@ public override void SetParameters(object customData, IDictionary 0; - var delta0 = cData.initialMesh.TL_Position - cData.mesh.initial.BL_Position; - var delta1 = cData.initialMesh.TR_Position - cData.mesh.initial.BR_Position; + var delta0 = cData.InitialMesh.TL_Position - cData.mesh.initial.BL_Position; + var delta1 = cData.InitialMesh.TR_Position - cData.mesh.initial.BR_Position; Vector3 keyframe0_1 = cData.mesh.initial.GetPosition(0); Vector3 keyframe0_2 = cData.mesh.initial.GetPosition(3); @@ -72,8 +72,8 @@ public override void Animate(CharData cData, IAnimationContext context) } } - cData.SetVertex(1, p1); - cData.SetVertex(2, p2); + cData.mesh.SetPosition(1, p1); + cData.mesh.SetPosition(2, p2); } public override void SetParameters(object customData, IDictionary parameters) diff --git a/Package/Runtime/Effects/TMPAnimations/Basic Animations/GenericAnimation.cs b/Package/Runtime/Effects/TMPAnimations/Basic Animations/GenericAnimation.cs new file mode 100644 index 0000000..f4fc422 --- /dev/null +++ b/Package/Runtime/Effects/TMPAnimations/Basic Animations/GenericAnimation.cs @@ -0,0 +1,372 @@ +using System; +using System.Collections.Generic; +using TMPEffects.AutoParameters.Attributes; +using TMPEffects.CharacterData; +using TMPEffects.Components.Animator; +using TMPEffects.Parameters; +using UnityEngine; + +namespace TMPEffects.TMPAnimations +{ + [AutoParameters] + [CreateAssetMenu(fileName = "new GenericAnimation", + menuName = "TMPEffects/Animations/Basic Animations/Generic Animation")] + public sealed partial class GenericAnimation : TMPAnimation + { + // TODO Theres a new weird issue "A previewrenderutility was not cleaned up" + // TODO Potentially might have smth to do with this. Idk why but it started happening around the time i implemented this. + protected override void OnValidate() + { + base.OnValidate(); + EnsureNonOverlappingTimings(); + } + + private void EnsureNonOverlappingTimings() + { + for (int i = 0; i < Tracks.Tracks.Count; i++) + { + var track = Tracks.Tracks[i]; + + // Ensure no negative values + for (int j = 0; j < track.Clips.Count; j++) + { + var step = track.Clips[j]; + if (step == null) continue; + + if (step.duration < 0) + step.duration = 0; + if (step.startTime < 0) + step.startTime = 0; + } + + var copy = new List(track.Clips); + copy.Sort(new StepComparer()); + float lastStartTime = -1, lastDuration = 0; + for (int j = 0; j < copy.Count; j++) + { + var step = copy[j]; + if (step == null || step.duration == 0) continue; + + // If starts while previous step still running + if (step.startTime < lastStartTime + lastDuration) + { + float prev = step.startTime; + step.startTime = lastStartTime + lastDuration; + step.duration = Mathf.Max(0f, step.duration - (step.startTime - prev)); + } + + lastStartTime = step.startTime; + lastDuration = step.duration; + } + + // TODO Uncommenting this will auto force sort clips + // (which makes the reorderable part of them sort of pointless unless same start and 0 duration) + // TODO Maybe make an editor only bool for whether to do this + // Tracks.Tracks[i].Clips = copy; + } + } + + + [Serializable] + public class Track + { + public List Clips + { + get => clips; + set => clips = value; + } + + [SerializeReference] private List clips = new List(); + } + + [Serializable] + public class TrackList + { + public List Tracks = new List(); + + public Track this[int index] + { + get => Tracks[index]; + set => Tracks[index] = value; + } + } + + public TrackList Tracks = new TrackList(); + + public bool Repeat + { + get => repeat; + set => repeat = value; + } + + public float Duration + { + get => duration; + set => duration = value; + } + + [AutoParameter("repeat", "rp"), SerializeField] + private bool repeat; + + [AutoParameter("duration", "dur"), SerializeField] + private float duration; + + private CharDataModifiers modifiersStorage, modifiersStorage2; + private CharDataModifiers accModifier, current; + + public static bool ApplyAnimationStep(AnimationStep step, float timeValue, CharData cData, + IAnimatorContext context, + CharDataModifiers storage, CharDataModifiers storage2, CharDataModifiers result) + { + if (step == null) return false; + if (!step.animate) return false; + + if (timeValue < step.startTime) + { + switch (step.preExtrapolation) + { + case AnimationStep.ExtrapolationMode.Continue: + case AnimationStep.ExtrapolationMode.Hold: + timeValue = step.startTime; + break; + case AnimationStep.ExtrapolationMode.Loop: + float diff = (step.startTime - timeValue) % step.duration; + timeValue = step.EndTime - diff; + break; + case AnimationStep.ExtrapolationMode.PingPong: + diff = (step.startTime - timeValue) % step.duration; + timeValue = step.startTime + diff; + break; + } + } + + if (timeValue > step.EndTime) + { + switch (step.postExtrapolation) + { + case AnimationStep.ExtrapolationMode.Continue: + case AnimationStep.ExtrapolationMode.Hold: + timeValue = step.EndTime; + break; + case AnimationStep.ExtrapolationMode.Loop: + float diff = (timeValue - step.EndTime) % step.duration; + timeValue = step.startTime + diff; + break; + case AnimationStep.ExtrapolationMode.PingPong: + diff = (timeValue - step.EndTime) % step.duration; + timeValue = step.EndTime - diff; + break; + } + } + + // If time before clip starts (after adjusting for extrapolation) + if (step.startTime > timeValue) return false; + + // If time after clip ends (after adjusting for extrapolation) + if (step.EndTime < timeValue) return false; + + float weight = 1; + float entry = timeValue - step.startTime; + if (step.entryDuration > 0 && entry <= step.entryDuration) + { + weight = step.entryCurve.Evaluate(cData, context,entry / step.entryDuration); + } + + float exit = step.EndTime - timeValue; + if (step.exitDuration > 0 && exit <= step.exitDuration) + { + weight *= step.exitCurve.Evaluate(cData, context, exit / step.exitDuration); + } + + if (step.useWave) + { + var offset = AnimationUtility.GetWaveOffset(cData, context, step.waveOffsetType); + weight *= step.wave.Evaluate(timeValue, offset).Value; + } + + result.Reset(); + + if (step.useInitialModifiers) + { + // Reset storage + storage.Reset(); + storage2.Reset(); + + // Set modifiers + step.initModifiers.ToCharDataModifiers(cData, context, storage); + step.modifiers.ToCharDataModifiers(cData, context, storage2); + + // Lerp modifiers and store into current + CharDataModifiers.LerpUnclamped(cData, storage, storage2, weight, result); + } + else + { + // Reset storage + storage.Reset(); + + // Set modifier + step.modifiers.ToCharDataModifiers(cData, context, storage); + + // Lerp modifier and store into current + CharDataModifiers.LerpUnclamped(cData, storage, weight, result); + } + + return true; + } + + public static void ApplyAnimationStepWeighted(AnimationStep step, float weight, CharData cData, + IAnimatorContext context, + CharDataModifiers storage, CharDataModifiers storage2, CharDataModifiers result) + { + result.Reset(); + + + if (step.useInitialModifiers) + { + // Reset storage + storage.Reset(); + storage2.Reset(); + + // Set modifiers + step.initModifiers.ToCharDataModifiers(cData, context, storage); + step.modifiers.ToCharDataModifiers(cData, context, storage2); + + // Lerp modifiers and store into current + Debug.LogWarning("inbetween is now br color " + result.MeshModifiers.BR_Color); + CharDataModifiers.LerpUnclamped(cData, storage, storage2, weight, result); + Debug.LogWarning("inbetween 2 is now br color " + result.MeshModifiers.BR_Color); + } + else + { + // Reset storage + storage.Reset(); + + // Set modifier + step.modifiers.ToCharDataModifiers(cData, context, storage); + + // Lerp modifier and store into current + CharDataModifiers.LerpUnclamped(cData, storage, weight, result); + } + } + + private partial void Animate(CharData cData, AutoParametersData data, IAnimationContext context) + { + if (data.Steps == null) + { + data.Steps = new List>(); + for (int i = 0; i < Tracks.Tracks.Count; i++) + { + var track = Tracks.Tracks[i]; + var copy = new List(track.Clips); + copy.Sort(new StepComparer()); + data.Steps.Add(copy); + } + } + + Animate(cData, data.Steps, context.AnimatorContext, data.repeat, data.duration); + } + + private struct StepComparer : IComparer + { + public int Compare(AnimationStep x, AnimationStep y) + { + if (x == null || y == null) return 0; + if (x.startTime < y.startTime) return -1; + if (x.startTime > y.startTime) return 1; + if (x.EndTime < y.EndTime) return -1; + if (x.EndTime > y.EndTime) return 1; + return 0; + } + } + + public void Animate(CharData cData, List> steps, IAnimatorContext context, bool repeat, + float duration) + { + // Create modifiers if needed + modifiersStorage ??= new CharDataModifiers(); + modifiersStorage2 ??= new CharDataModifiers(); + accModifier ??= new CharDataModifiers(); + current ??= new CharDataModifiers(); + + // Init + + // Calculate timeValue + float timeValue = + repeat ? context.PassedTime % duration : context.PassedTime; + + // Reset accModifier + accModifier.Reset(); + + foreach (var track in steps) + { + var active = FindCurrentlyActive(timeValue, track); + if (active == -1) continue; + + if (ApplyAnimationStep(track[active], timeValue, cData, context, modifiersStorage, + modifiersStorage2, current)) + { + accModifier.MeshModifiers.Combine(current.MeshModifiers); + accModifier.CharacterModifiers.Combine(current.CharacterModifiers); + } + } + + cData.MeshModifiers.Combine(accModifier.MeshModifiers); + cData.CharacterModifiers.Combine(accModifier.CharacterModifiers); + } + + private int FindCurrentlyActive(float timeValue, List steps) + { + if (steps == null || steps.Count == 0) return -1; + + // TODO This asssumes each track is sorted + for (int i = 0; i < steps.Count; i++) + { + var step = steps[i]; + + if (step == null || !step.animate) continue; + + // If on step + if (step.startTime < timeValue && step.EndTime > timeValue) + return i; + + // // If after step + // if (step.EndTime < timeValue) + // { + // if (i == (steps.Count - 1) || step.postExtrapolation != AnimationStep.ExtrapolationMode.None) + // return i; + // if (steps[i + 1].preExtrapolation != AnimationStep.ExtrapolationMode.None) + // return i + 1; + // + // Debug.LogWarning(i + " is after"); + // return -1; + // } + + // If before step + if (step.startTime > timeValue) + { + if (i == 0) + { + if (step.preExtrapolation != AnimationStep.ExtrapolationMode.None) return i; + return -1; + } + + if (steps[i - 1].postExtrapolation != AnimationStep.ExtrapolationMode.None) + return i - 1; + + if (step.preExtrapolation != AnimationStep.ExtrapolationMode.None) + return i; + + return -1; + } + } + + return steps.Count - 1; + } + + [AutoParametersStorage] + private partial class AutoParametersData + { + public List> Steps = null; + } + } +} \ No newline at end of file diff --git a/Package/Runtime/Effects/TMPAnimations/Basic Animations/GenericAnimation.cs.meta b/Package/Runtime/Effects/TMPAnimations/Basic Animations/GenericAnimation.cs.meta new file mode 100644 index 0000000..126abbb --- /dev/null +++ b/Package/Runtime/Effects/TMPAnimations/Basic Animations/GenericAnimation.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7f88d8a32ae6922429db0f721f9bcced +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Effects/TMPAnimations/Basic Animations/PivotAnimation.cs b/Package/Runtime/Effects/TMPAnimations/Basic Animations/PivotAnimation.cs index 220e1b7..5434335 100644 --- a/Package/Runtime/Effects/TMPAnimations/Basic Animations/PivotAnimation.cs +++ b/Package/Runtime/Effects/TMPAnimations/Basic Animations/PivotAnimation.cs @@ -40,16 +40,20 @@ private void LimitedRotation(CharData cData, IAnimationContext context) // Calculate the angle based on the evaluate wave float angle = Mathf.LerpUnclamped(d.minAngleLimit, d.maxAngleLimit, result.Item1); - // Set the rotation using the rotationaxis and current angle - cData.SetRotation(Quaternion.AngleAxis(angle, d.rotationAxis)); - - // Set the pivot depending on its type - switch (d.pivot.type) - { - case VectorType.Position: SetPivotRaw(d.pivot.vector, cData, context); break; - case VectorType.Offset: cData.SetPivot(cData.InitialPosition + new Vector3(d.pivot.vector.x, d.pivot.vector.y, 0f)); break; - case VectorType.Anchor: SetPivotRaw(AnchorToPosition(d.pivot.vector, cData), cData, context); break; - } + // TODO This should implement the offset version; update to work for position and anchor + cData.AddRotation(Quaternion.AngleAxis(angle, d.rotationAxis).eulerAngles, + cData.InitialPosition + new Vector3(d.pivot.vector.x, d.pivot.vector.y, 0f) ); + + // // Set the rotation using the rotationaxis and current angle + // cData.SetRotation(); + // + // // Set the pivot depending on its type + // switch (d.pivot.type) + // { + // case VectorType.Position: SetPivotRaw(d.pivot.vector, cData, context); break; + // case VectorType.Offset: cData.SetPivot(cData.InitialPosition + new Vector3(d.pivot.vector.x, d.pivot.vector.y, 0f)); break; + // case VectorType.Anchor: SetPivotRaw(AnchorToPosition(d.pivot.vector, cData), cData, context); break; + // } } public override void SetParameters(object customData, IDictionary parameters) diff --git a/Package/Runtime/Effects/TMPAnimations/Basic Animations/WaveAnimation.cs b/Package/Runtime/Effects/TMPAnimations/Basic Animations/WaveAnimation.cs index eacf206..be0d88c 100644 --- a/Package/Runtime/Effects/TMPAnimations/Basic Animations/WaveAnimation.cs +++ b/Package/Runtime/Effects/TMPAnimations/Basic Animations/WaveAnimation.cs @@ -11,20 +11,29 @@ namespace TMPEffects.TMPAnimations.Animations [CreateAssetMenu(fileName = "new WaveAnimation", menuName = "TMPEffects/Animations/Basic Animations/Built-in/Wave")] public class WaveAnimation : TMPAnimation { - [Tooltip("The wave that defines the behavior of this animation. No prefix.\nFor more information about Wave, see the section on it in the documentation.")] - [SerializeField] Wave wave = new Wave(AnimationCurveUtility.EaseInOutSine(), AnimationCurveUtility.EaseInOutSine(), 0.5f, 0.5f, 1f, 1f, 0.2f); - [Tooltip("The way the offset for the wave is calculated.\nFor more information about Wave, see the section on it in the documentation.\nAliases: waveoffset, woffset, waveoff, woff")] - [SerializeField] WaveOffsetType waveOffsetType = WaveOffsetType.XPos; + [Tooltip( + "The wave that defines the behavior of this animation. No prefix.\nFor more information about Wave, see the section on it in the documentation.")] + [SerializeField] + Wave wave = new Wave(AnimationCurveUtility.EaseInOutSine(), AnimationCurveUtility.EaseInOutSine(), 0.5f, 0.5f, + 1f, 1f, 0.2f); + [Tooltip( + "The way the offset for the wave is calculated.\nFor more information about Wave, see the section on it in the documentation.\nAliases: waveoffset, woffset, waveoff, woff")] + [SerializeField] + WaveOffsetType waveOffsetType = WaveOffsetType.XPos; + + [SerializeField] private OffsetTypePowerEnum powerEnum; + public override void Animate(CharData cData, IAnimationContext context) { Data data = (Data)context.CustomData; // Evaluate the wave based on time and offset - float eval = data.wave.Evaluate(context.AnimatorContext.PassedTime, GetWaveOffset(cData, context, data.waveOffsetType)).Item1; + float eval = data.wave.Evaluate(context.AnimatorContext.PassedTime, + GetWaveOffset(cData, context, data.waveOffsetType)).Value; // Move the character up based on the wave evaluation - cData.SetPosition(cData.InitialPosition + Vector3.up * eval); + cData.PositionDelta = Vector3.up * eval; } public override void SetParameters(object customData, IDictionary parameters) @@ -32,7 +41,8 @@ public override void SetParameters(object customData, IDictionary parameters) diff --git a/Package/Runtime/Effects/TMPAnimations/IAnimationContext.cs b/Package/Runtime/Effects/TMPAnimations/IAnimationContext.cs index 8e69842..9feb386 100644 --- a/Package/Runtime/Effects/TMPAnimations/IAnimationContext.cs +++ b/Package/Runtime/Effects/TMPAnimations/IAnimationContext.cs @@ -13,6 +13,7 @@ public interface IAnimationContext /// The context of the animating TMPAnimator. /// public IAnimatorContext AnimatorContext { get; } + /// /// Data about the animation segment. /// @@ -22,12 +23,7 @@ public interface IAnimationContext /// The custom data object. ///
public object CustomData { get; } - - /// - /// The current state of the CharData, with the previous animations applied. - /// - public ICharDataState State { get; } - + /// /// Check if the animation is considered finished for the character at the given index. /// diff --git a/Package/Runtime/Effects/TMPAnimations/ReadOnlyAnimationContext.cs b/Package/Runtime/Effects/TMPAnimations/ReadOnlyAnimationContext.cs index 027c2e9..f4b0e54 100644 --- a/Package/Runtime/Effects/TMPAnimations/ReadOnlyAnimationContext.cs +++ b/Package/Runtime/Effects/TMPAnimations/ReadOnlyAnimationContext.cs @@ -15,15 +15,13 @@ public class ReadOnlyAnimationContext : IAnimationContext public SegmentData SegmentData => context.SegmentData; /// public object CustomData => context.CustomData; - /// - public ICharDataState State => context.State; public ReadOnlyAnimationContext(IAnimationContext context) { this.context = context; } - public ReadOnlyAnimationContext(IAnimatorContext animatorContext, ICharDataState state, SegmentData segmentData, object customData) + public ReadOnlyAnimationContext(IAnimatorContext animatorContext, CharDataModifiers state, SegmentData segmentData, object customData) : this(new AnimationContext(animatorContext, state, segmentData, customData)) { } diff --git a/Package/Runtime/Effects/TMPAnimations/Show Animations/PivotShowAnimation.cs b/Package/Runtime/Effects/TMPAnimations/Show Animations/PivotShowAnimation.cs index 3db8405..81cf451 100644 --- a/Package/Runtime/Effects/TMPAnimations/Show Animations/PivotShowAnimation.cs +++ b/Package/Runtime/Effects/TMPAnimations/Show Animations/PivotShowAnimation.cs @@ -36,22 +36,26 @@ public override void Animate(CharData cData, IAnimationContext context) float t2 = d.curve.Evaluate(t); Vector3 angle = Vector3.LerpUnclamped(d.startAngle, d.targetAngle, t2); - cData.SetRotation(Quaternion.Euler(angle)); - switch (d.pivot.type) - { - case VectorType.Position: - cData.SetPivot(d.pivot.vector); - break; - case VectorType.Offset: - cData.SetPivot(cData.InitialPosition + (Vector3)d.pivot.vector); - break; - case VectorType.Anchor: - Vector3 position = AnchorToPosition(d.pivot.vector, cData); - position.z = 0; - SetPivotRaw(position, cData, context); - break; - } + // TODO This should implement the offset version; update to work for position and anchor + cData.AddRotation(angle, cData.InitialPosition + (Vector3)d.pivot.vector); + + // cData.SetRotation(Quaternion.Euler(angle)); + // + // switch (d.pivot.type) + // { + // case VectorType.Position: + // cData.SetPivot(d.pivot.vector); + // break; + // case VectorType.Offset: + // cData.SetPivot(cData.InitialPosition + (Vector3)d.pivot.vector); + // break; + // case VectorType.Anchor: + // Vector3 position = AnchorToPosition(d.pivot.vector, cData); + // position.z = 0; + // SetPivotRaw(position, cData, context); + // break; + // } } public override void SetParameters(object customData, IDictionary parameters) diff --git a/Package/Runtime/Effects/TMPAnimations/Stack/AnimationStack.cs b/Package/Runtime/Effects/TMPAnimations/Stack/AnimationStack.cs index 09b43c5..5e1ee5c 100644 --- a/Package/Runtime/Effects/TMPAnimations/Stack/AnimationStack.cs +++ b/Package/Runtime/Effects/TMPAnimations/Stack/AnimationStack.cs @@ -172,8 +172,6 @@ public class AnimContext : IAnimationContext public object CustomData => customData; - public ICharDataState State => context.State; - public AnimContext(IAnimationContext context, object customData) { this.context = context; diff --git a/Package/Runtime/Parameters/ParameterTypes.cs b/Package/Runtime/Parameters/ParameterTypes.cs index 67c048c..479d014 100644 --- a/Package/Runtime/Parameters/ParameterTypes.cs +++ b/Package/Runtime/Parameters/ParameterTypes.cs @@ -1,5 +1,8 @@ using System.Collections; using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.Components.Animator; +using TMPEffects.TMPAnimations; using UnityEngine; namespace TMPEffects.Parameters @@ -24,7 +27,7 @@ public enum WaveOffsetType Line = 40, Baseline = 45 } - + /// /// The different types of vectors. /// @@ -34,10 +37,12 @@ public enum VectorType /// Pure position (normal vector). ///
Position, + /// - /// Offset vector from the original position + /// Offset vector from the original position. /// Offset, + /// /// Anchor vector, in "character space"; (0,0) is the center, (1,1) top-right, (-1,0) center-left etc. /// @@ -58,6 +63,89 @@ public TypedVector2(VectorType type, Vector2 vector) this.type = type; this.vector = vector; } + + public static implicit operator TypedVector2(TypedVector3 v) + { + return new TypedVector2() { vector = v.vector, type = v.type }; + } + + public static TypedVector2 operator +(TypedVector2 a, Vector2 b) + { + a.vector += b; + return a; + } + + public static TypedVector2 operator -(TypedVector2 a, Vector2 b) + { + a.vector -= b; + return a; + } + + public TypedVector2 IgnoreScaling(CharData cData, IAnimationContext context) + => IgnoreScaling(cData, context.AnimatorContext); + + public TypedVector2 IgnoreScaling(CharData cData, IAnimatorContext context) + { + return type switch + { + VectorType.Position => new TypedVector2(type, + AnimationUtility.GetRawPosition(vector, cData, context)), + VectorType.Anchor => + // TODO Dont have to do anything i think. Since based on anchors of character, + // inherently ignores scaling + // vector = AnimationUtility.GetRawPosition(AnimationUtility.AnchorToPosition(vector, cData), + // cData, context); + new TypedVector2(type, vector), + VectorType.Offset => new TypedVector2(type, AnimationUtility.GetRawDelta(vector, cData, context)), + _ => throw new System.NotImplementedException(nameof(type)) + }; + } + + public Vector2 ToPosition(CharData cData) + { + return type switch + { + VectorType.Position => vector, + VectorType.Anchor => AnimationUtility.AnchorToPosition(vector, cData), + VectorType.Offset => (Vector3)vector + cData.InitialPosition, + _ => throw new System.NotImplementedException() + }; + } + + public Vector2 ToDelta(CharData cData) + { + return type switch + { + VectorType.Position => vector - (Vector2)cData.InitialPosition, + VectorType.Anchor => AnimationUtility.AnchorToPosition(vector, cData) - + (Vector2)cData.InitialPosition, + VectorType.Offset => vector, + _ => throw new System.NotImplementedException(nameof(type)) + }; + } + + public Vector2 ToPosition(CharData cData, Vector2 referencePos) + { + return type switch + { + VectorType.Position => vector, + VectorType.Anchor => AnimationUtility.AnchorToPosition(vector, cData), + VectorType.Offset => vector + referencePos, + _ => throw new System.NotImplementedException(nameof(type)) + }; + } + + + public Vector2 ToDelta(CharData cData, Vector2 referencePos) + { + return type switch + { + VectorType.Position => vector - referencePos, + VectorType.Anchor => AnimationUtility.AnchorToPosition(vector, cData) - referencePos, + VectorType.Offset => vector, + _ => throw new System.NotImplementedException(nameof(type)) + }; + } } /// @@ -74,6 +162,93 @@ public TypedVector3(VectorType type, Vector3 vector) this.type = type; this.vector = vector; } + + public bool Equals(TypedVector3 other) + { + return vector == other.vector && type == other.type; + } + + public static implicit operator TypedVector3(TypedVector2 v) + { + return new TypedVector3() { vector = v.vector, type = v.type }; + } + + public static TypedVector3 operator +(TypedVector3 a, Vector3 b) + { + a.vector += b; + return a; + } + + public static TypedVector3 operator -(TypedVector3 a, Vector3 b) + { + a.vector -= b; + return a; + } + + public TypedVector3 IgnoreScaling(CharData cData, IAnimationContext context) + => IgnoreScaling(cData, context.AnimatorContext); + + public TypedVector3 IgnoreScaling(CharData cData, IAnimatorContext context) + { + return type switch + { + VectorType.Position => new TypedVector3(type, + AnimationUtility.GetRawPosition(vector, cData, context)), + VectorType.Anchor => + // TODO Dont have to do anything i think. Since based on anchors of character, + // inherently ignores scaling + // vector = AnimationUtility.GetRawPosition(AnimationUtility.AnchorToPosition(vector, cData), + // cData, context); + new TypedVector3(type, AnimationUtility.GetRawDelta(vector, cData, context)), + VectorType.Offset => new TypedVector3(type, AnimationUtility.GetRawDelta(vector, cData, context)), + _ => throw new System.NotImplementedException(nameof(type)) + }; + } + + public Vector3 ToPosition(CharData cData) + { + return type switch + { + VectorType.Position => vector, + VectorType.Anchor => AnimationUtility.AnchorToPosition(vector, cData), + VectorType.Offset => vector + cData.InitialPosition, + _ => throw new System.NotImplementedException(nameof(type)) + }; + } + + public Vector3 ToDelta(CharData cData) + { + return type switch + { + VectorType.Position => vector - cData.InitialPosition, + VectorType.Anchor => AnimationUtility.AnchorToPosition(vector, cData) - + (Vector2)cData.InitialPosition, + VectorType.Offset => vector, + _ => throw new System.NotImplementedException(nameof(type)) + }; + } + + public Vector3 ToPosition(CharData cData, Vector3 referencePos) + { + return type switch + { + VectorType.Position => vector, + VectorType.Anchor => AnimationUtility.AnchorToPosition(vector, cData), + VectorType.Offset => vector + referencePos, + _ => throw new System.NotImplementedException(nameof(type)) + }; + } + + public Vector3 ToDelta(CharData cData, Vector3 referencePos) + { + return type switch + { + VectorType.Position => vector - referencePos, + VectorType.Anchor => (Vector3)AnimationUtility.AnchorToPosition(vector, cData) - referencePos, + VectorType.Offset => vector, + _ => throw new System.NotImplementedException(nameof(type)) + }; + } } } } \ No newline at end of file diff --git a/Package/Runtime/PowerEnum.meta b/Package/Runtime/PowerEnum.meta new file mode 100644 index 0000000..fb51923 --- /dev/null +++ b/Package/Runtime/PowerEnum.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: b65c40b6e29a302428503b27ec6d9098 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/PowerEnum/ExampleOffsetType.cs b/Package/Runtime/PowerEnum/ExampleOffsetType.cs new file mode 100644 index 0000000..53bbdbc --- /dev/null +++ b/Package/Runtime/PowerEnum/ExampleOffsetType.cs @@ -0,0 +1,14 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.TMPAnimations; +using UnityEngine; + +public class ExampleOffsetType : TMPOffsetType +{ + public override float GetOffset(CharData cData, IAnimationContext context) + { + if (cData.info.character == 'A') return 0.5f; + return 0f; + } +} \ No newline at end of file diff --git a/Package/Runtime/PowerEnum/ExampleOffsetType.cs.meta b/Package/Runtime/PowerEnum/ExampleOffsetType.cs.meta new file mode 100644 index 0000000..255b431 --- /dev/null +++ b/Package/Runtime/PowerEnum/ExampleOffsetType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 70737ce0dfe1bda47b79fe94b60ab531 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/PowerEnum/OffsetTypePowerEnum.cs b/Package/Runtime/PowerEnum/OffsetTypePowerEnum.cs new file mode 100644 index 0000000..6af5009 --- /dev/null +++ b/Package/Runtime/PowerEnum/OffsetTypePowerEnum.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.Parameters; +using TMPEffects.TMPAnimations; +using UnityEngine; + +[Serializable] +public class OffsetTypePowerEnum : PowerEnum +{ + public float GetOffset(CharData cData, IAnimationContext context) + { + if (!useCustom) return AnimationUtility.GetWaveOffset(cData, context, EnumValue); + + if (Value == null) return 0; + return Value.GetOffset(cData, context); + } +} \ No newline at end of file diff --git a/Package/Runtime/PowerEnum/OffsetTypePowerEnum.cs.meta b/Package/Runtime/PowerEnum/OffsetTypePowerEnum.cs.meta new file mode 100644 index 0000000..946576c --- /dev/null +++ b/Package/Runtime/PowerEnum/OffsetTypePowerEnum.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c291c3c22db57f0458970822b0e8ba18 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/PowerEnum/PowerEnum.cs b/Package/Runtime/PowerEnum/PowerEnum.cs new file mode 100644 index 0000000..a10a541 --- /dev/null +++ b/Package/Runtime/PowerEnum/PowerEnum.cs @@ -0,0 +1,13 @@ +using System; +using UnityEngine; + +[Serializable] +public abstract class PowerEnum where TEnum : Enum +{ + public TCustom Value => customValue; + public TEnum EnumValue => enumValue; + + [SerializeField] private TEnum enumValue; + [SerializeField] private TCustom customValue; + [SerializeField] protected bool useCustom; +} \ No newline at end of file diff --git a/Package/Runtime/PowerEnum/PowerEnum.cs.meta b/Package/Runtime/PowerEnum/PowerEnum.cs.meta new file mode 100644 index 0000000..1161850 --- /dev/null +++ b/Package/Runtime/PowerEnum/PowerEnum.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4328ca0ecad6752468a4e62833042bad +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/PowerEnum/TMPOffsetType.cs b/Package/Runtime/PowerEnum/TMPOffsetType.cs new file mode 100644 index 0000000..708e364 --- /dev/null +++ b/Package/Runtime/PowerEnum/TMPOffsetType.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.TMPAnimations; +using UnityEngine; + +public abstract class TMPOffsetType : MonoBehaviour +{ + // TODO What other params might make sense? + public abstract float GetOffset(CharData cData, IAnimationContext context); +} + diff --git a/Package/Runtime/PowerEnum/TMPOffsetType.cs.meta b/Package/Runtime/PowerEnum/TMPOffsetType.cs.meta new file mode 100644 index 0000000..c6baa5d --- /dev/null +++ b/Package/Runtime/PowerEnum/TMPOffsetType.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 27027e5aa6a41714f860bfc6e7fc8b34 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/TMPEffects.asmdef b/Package/Runtime/TMPEffects.asmdef index fb887d8..5f11888 100644 --- a/Package/Runtime/TMPEffects.asmdef +++ b/Package/Runtime/TMPEffects.asmdef @@ -13,6 +13,12 @@ "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], - "versionDefines": [], + "versionDefines": [ + { + "name": "com.unity.textmeshpro", + "expression": "3.2.0-pre.10", + "define": "TMPRO_3_2_0_PRE_10_OR_NEWER" + } + ], "noEngineReferences": false } \ No newline at end of file diff --git a/Package/Runtime/TextProcessing/TMPTextProcessor.cs b/Package/Runtime/TextProcessing/TMPTextProcessor.cs index 1de5155..a1663ec 100644 --- a/Package/Runtime/TextProcessing/TMPTextProcessor.cs +++ b/Package/Runtime/TextProcessing/TMPTextProcessor.cs @@ -258,14 +258,15 @@ public string PreprocessText(string text) sb.Append(text.AsSpan(searchIndex, text.Length - searchIndex)); string parsed; + // Add a space at the end of the text; + // Quick fix to issues with texts that are empty either after this + // preprocess or after the native tag processing + if (sb.Length == 0) sb.Append(" "); parsed = sb.ToString(); FinishPreProcess?.Invoke(parsed); - // Add a space at the end of the text; - // Quick fix to issues with texts that are empty either after this - // preprocess or after the native tag processing - return parsed + " "; + return parsed; } /// diff --git a/Package/Runtime/Timeline.meta b/Package/Runtime/Timeline.meta new file mode 100644 index 0000000..91acf2a --- /dev/null +++ b/Package/Runtime/Timeline.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 399273b04edd55d4da7a1a51b04c00bc +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Behaviors.meta b/Package/Runtime/Timeline/Behaviors.meta new file mode 100644 index 0000000..362da87 --- /dev/null +++ b/Package/Runtime/Timeline/Behaviors.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: c2970e94a2909f14c85bcf334a1bf0e4 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Behaviors/TMPAnimationBehaviour.cs b/Package/Runtime/Timeline/Behaviors/TMPAnimationBehaviour.cs new file mode 100644 index 0000000..326f811 --- /dev/null +++ b/Package/Runtime/Timeline/Behaviors/TMPAnimationBehaviour.cs @@ -0,0 +1,14 @@ +using System; +using TMPEffects.CharacterData; +using TMPEffects.Components; +using TMPEffects.Components.Animator; +using TMPEffects.TMPAnimations; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +public class TMPAnimationBehaviour : PlayableBehaviour +{ + public GenericAnimation animation; + [NonSerialized] public TimelineClip Clip = null; +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Behaviors/TMPAnimationBehaviour.cs.meta b/Package/Runtime/Timeline/Behaviors/TMPAnimationBehaviour.cs.meta new file mode 100644 index 0000000..5dbaf4c --- /dev/null +++ b/Package/Runtime/Timeline/Behaviors/TMPAnimationBehaviour.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 028485f98e425444a877fdf2b680a187 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Behaviors/TMPMeshModifierBehaviour.cs b/Package/Runtime/Timeline/Behaviors/TMPMeshModifierBehaviour.cs new file mode 100644 index 0000000..9a130a1 --- /dev/null +++ b/Package/Runtime/Timeline/Behaviors/TMPMeshModifierBehaviour.cs @@ -0,0 +1,19 @@ +using System; +using TMPEffects.CharacterData; +using TMPEffects.Components; +using TMPEffects.Components.Animator; +using TMPEffects.TMPAnimations; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +public class TMPMeshModifierBehaviour : PlayableBehaviour +{ + public TimelineAnimationStep Step; + [NonSerialized] public TimelineClip Clip; + + private CharDataModifiers modifiersStorage; + private TMPAnimator animator; + private float weight; + private PlayableDirector director; +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Behaviors/TMPMeshModifierBehaviour.cs.meta b/Package/Runtime/Timeline/Behaviors/TMPMeshModifierBehaviour.cs.meta new file mode 100644 index 0000000..436baa2 --- /dev/null +++ b/Package/Runtime/Timeline/Behaviors/TMPMeshModifierBehaviour.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 87566cb35bd84b34ba27c31fdf46766a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Behaviors/WriterBehaviour.cs b/Package/Runtime/Timeline/Behaviors/WriterBehaviour.cs new file mode 100644 index 0000000..9002f3c --- /dev/null +++ b/Package/Runtime/Timeline/Behaviors/WriterBehaviour.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.Components; +using UnityEngine; +using UnityEngine.Playables; + +public class WriterBehaviour : PlayableBehaviour +{ + private TMPWriter writer; + + public override void OnBehaviourPlay(Playable playable, FrameData info) + { + writer = info.output.GetUserData() as TMPWriter; + + } + + public override void OnBehaviourPause(Playable playable, FrameData info) + { + + } +} diff --git a/Package/Runtime/Timeline/Behaviors/WriterBehaviour.cs.meta b/Package/Runtime/Timeline/Behaviors/WriterBehaviour.cs.meta new file mode 100644 index 0000000..21ff55b --- /dev/null +++ b/Package/Runtime/Timeline/Behaviors/WriterBehaviour.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f5f356073fc28f44cbee2fdd896cdcb2 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Clips.meta b/Package/Runtime/Timeline/Clips.meta new file mode 100644 index 0000000..9dc2201 --- /dev/null +++ b/Package/Runtime/Timeline/Clips.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 90bf38294f24f0a4cbe01e86a9bfe01e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Clips/AnimateClip.cs b/Package/Runtime/Timeline/Clips/AnimateClip.cs new file mode 100644 index 0000000..f389298 --- /dev/null +++ b/Package/Runtime/Timeline/Clips/AnimateClip.cs @@ -0,0 +1,36 @@ +// #if TIMELINE_INSTALLED +// using System.Collections; +// using System.Collections.Generic; +// using TMPEffects.Components.Animator; +// using UnityEngine; +// using UnityEngine.Playables; +// +// public class AnimateClip : TMPAnimatorClip +// { +// public enum Method +// { +// StartAnimating, +// StopAnimating, +// AnimateManually +// } +// +// public Method methodToCallOnPlay; +// public UpdateFrom updateFromOnPlay; +// +// public Method methodToCallOnPause; +// public UpdateFrom updateFromOnPause; +// +// public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) +// { +// var playable = ScriptPlayable.Create(graph); +// +// AnimateBehaviour ab = playable.GetBehaviour(); +// ab.methodToCallOnPlay = methodToCallOnPlay; +// ab.updateFromOnPlay = updateFromOnPlay; +// ab.methodToCallOnPause = methodToCallOnPause; +// ab.updateFromOnPause = updateFromOnPause; +// +// return playable; +// } +// } +// #endif diff --git a/Package/Runtime/Timeline/Clips/AnimateClip.cs.meta b/Package/Runtime/Timeline/Clips/AnimateClip.cs.meta new file mode 100644 index 0000000..e9e7db5 --- /dev/null +++ b/Package/Runtime/Timeline/Clips/AnimateClip.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 1763c3e92fbfe6b4589b5f538b146eae +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Clips/TMPAnimationClip.cs b/Package/Runtime/Timeline/Clips/TMPAnimationClip.cs new file mode 100644 index 0000000..fd1edc5 --- /dev/null +++ b/Package/Runtime/Timeline/Clips/TMPAnimationClip.cs @@ -0,0 +1,26 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using TMPEffects.TMPAnimations; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +[DisplayName("TMPEffects Clip/TMPAnimation Clip")] +public class TMPAnimationClip : TMPEffectsClip, ITimelineClipAsset +{ + public GenericAnimation animation; + [NonSerialized] public TimelineClip Clip = null; + + public ClipCaps clipCaps => ClipCaps.Extrapolation; + + public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) + { + var playable = ScriptPlayable.Create(graph); + var behaviour = playable.GetBehaviour(); + behaviour.Clip = Clip; + behaviour.animation = animation; + return playable; + } +} diff --git a/Package/Runtime/Timeline/Clips/TMPAnimationClip.cs.meta b/Package/Runtime/Timeline/Clips/TMPAnimationClip.cs.meta new file mode 100644 index 0000000..e39ded5 --- /dev/null +++ b/Package/Runtime/Timeline/Clips/TMPAnimationClip.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dd98e6c9d6d2b4c4ab6eebbc5bdcad7b +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Clips/TMPMeshModifierClip.cs b/Package/Runtime/Timeline/Clips/TMPMeshModifierClip.cs new file mode 100644 index 0000000..ad4e11d --- /dev/null +++ b/Package/Runtime/Timeline/Clips/TMPMeshModifierClip.cs @@ -0,0 +1,40 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using TMPEffects.TMPAnimations; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +[DisplayName("TMPEffects Clip/TMPMeshModifier Clip")] +public class TMPMeshModifierClip : TMPEffectsClip, ITimelineClipAsset +{ + [NonSerialized] public TimelineClip Clip = null; + + public ClipCaps clipCaps + { + get { return ClipCaps.Extrapolation; } + } + + private ExposedReference director; + [SerializeField] private TimelineAnimationStep step; + + public TimelineAnimationStep Step => step; + + public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) + { + var playable = ScriptPlayable.Create(graph); + var behaviour = playable.GetBehaviour(); + playable.GetDuration(); + behaviour.Step = step; + behaviour.Clip = Clip; + + PlayableDirector director = (PlayableDirector)graph.GetResolver(); + playable.GetGraph().GetResolver().SetReferenceValue(this.director.exposedName, director); + // behaviour.Initialize(this.director.Resolve(graph.GetResolver())); + + return playable; + } + +} diff --git a/Package/Runtime/Timeline/Clips/TMPMeshModifierClip.cs.meta b/Package/Runtime/Timeline/Clips/TMPMeshModifierClip.cs.meta new file mode 100644 index 0000000..9710759 --- /dev/null +++ b/Package/Runtime/Timeline/Clips/TMPMeshModifierClip.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 73fa5eac7a691b04692db83c6d3e95f3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Clips/TMPWriterClip.cs b/Package/Runtime/Timeline/Clips/TMPWriterClip.cs new file mode 100644 index 0000000..ea44252 --- /dev/null +++ b/Package/Runtime/Timeline/Clips/TMPWriterClip.cs @@ -0,0 +1,8 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Playables; + +public abstract class TMPWriterClip : PlayableAsset +{ +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Clips/TMPWriterClip.cs.meta b/Package/Runtime/Timeline/Clips/TMPWriterClip.cs.meta new file mode 100644 index 0000000..0cac6eb --- /dev/null +++ b/Package/Runtime/Timeline/Clips/TMPWriterClip.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a244f63f1ac015c4b9f30b593f7b930f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Extensions.cs b/Package/Runtime/Timeline/Extensions.cs new file mode 100644 index 0000000..6dc7591 --- /dev/null +++ b/Package/Runtime/Timeline/Extensions.cs @@ -0,0 +1,33 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Timeline; + +internal static class Extensions +{ + public static TimelineClip.ClipExtrapolation ConvertExtrapolation(this AnimationStep.ExtrapolationMode mode) + { + return mode switch + { + AnimationStep.ExtrapolationMode.None => TimelineClip.ClipExtrapolation.None, + AnimationStep.ExtrapolationMode.PingPong => TimelineClip.ClipExtrapolation.PingPong, + AnimationStep.ExtrapolationMode.Continue => TimelineClip.ClipExtrapolation.Continue, + AnimationStep.ExtrapolationMode.Loop => TimelineClip.ClipExtrapolation.Loop, + AnimationStep.ExtrapolationMode.Hold => TimelineClip.ClipExtrapolation.Hold, + _ => throw new System.ArgumentException("Invalid ExtrapolationMode") + }; + } + + public static AnimationStep.ExtrapolationMode ConvertExtrapolation(this TimelineClip.ClipExtrapolation mode) + { + return mode switch + { + TimelineClip.ClipExtrapolation.None => AnimationStep.ExtrapolationMode.None, + TimelineClip.ClipExtrapolation.PingPong => AnimationStep.ExtrapolationMode.PingPong, + TimelineClip.ClipExtrapolation.Continue => AnimationStep.ExtrapolationMode.Continue, + TimelineClip.ClipExtrapolation.Loop => AnimationStep.ExtrapolationMode.Loop, + TimelineClip.ClipExtrapolation.Hold => AnimationStep.ExtrapolationMode.Hold, + _ => throw new System.ArgumentException("Invalid ClipExtrapolation") + }; + } +} diff --git a/Package/Runtime/Timeline/Extensions.cs.meta b/Package/Runtime/Timeline/Extensions.cs.meta new file mode 100644 index 0000000..8060ae1 --- /dev/null +++ b/Package/Runtime/Timeline/Extensions.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: ef4ca017f5afd444ebc782cc917f1176 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Internals.cs b/Package/Runtime/Timeline/Internals.cs new file mode 100644 index 0000000..73e9b60 --- /dev/null +++ b/Package/Runtime/Timeline/Internals.cs @@ -0,0 +1,3 @@ +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("TMPEffects.Timeline.Editor", AllInternalsVisible = true)] \ No newline at end of file diff --git a/Package/Runtime/Timeline/Internals.cs.meta b/Package/Runtime/Timeline/Internals.cs.meta new file mode 100644 index 0000000..0385fec --- /dev/null +++ b/Package/Runtime/Timeline/Internals.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4eee73eb31e691444971c2dd25b1c7cd +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers.meta b/Package/Runtime/Timeline/Markers.meta new file mode 100644 index 0000000..f0940d5 --- /dev/null +++ b/Package/Runtime/Timeline/Markers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: fe25af0a7cc18c841b7075da5da6afa3 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks.meta b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks.meta new file mode 100644 index 0000000..60d08d0 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 7611655d9326ade4f87939911fe9617e +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAddTagMarker.cs b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAddTagMarker.cs new file mode 100644 index 0000000..fa3a004 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAddTagMarker.cs @@ -0,0 +1,23 @@ +// using System.ComponentModel; +// using TMPEffects.Tags; +// using UnityEngine; +// using UnityEngine.Timeline; +// +// [CustomStyle("TMPResetAnimationsMarkerStyle")] +// [TrackBindingType(typeof(TMPAnimatorTrack))] +// [DisplayName("TMPEffects Marker/TMPAnimator/Add Tag")] +// public class TMPAddTagMarker : TMPEffectsMarker +// { +// public override PropertyName id => new PropertyName(); +// +// public override NotificationFlags flags => +// (retroactive ? NotificationFlags.Retroactive : default) | +// (triggerOnce ? NotificationFlags.TriggerOnce : default) | +// (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); +// +// [SerializeField] private TMPEffectTag tag; +// [SerializeField] private TMPEffectTagIndices indices; +// +// public TMPEffectTag Tag => tag; +// public TMPEffectTagIndices Indices => indices; +// } \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAddTagMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAddTagMarker.cs.meta new file mode 100644 index 0000000..a3415bf --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAddTagMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 847f711ac4b67dd469a1374a7c3f40db +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAnimatorMarkReceiver.cs b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAnimatorMarkReceiver.cs new file mode 100644 index 0000000..952267e --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAnimatorMarkReceiver.cs @@ -0,0 +1,47 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.Components; +using UnityEngine; +using UnityEngine.Playables; + +[RequireComponent(typeof(TMPAnimator))] +public class TMPAnimatorMarkReceiver : MonoBehaviour, INotificationReceiver +{ + private TMPAnimator animator; + + public void OnNotify(Playable origin, INotification notification, object context) + { + if (animator == null) + { + animator = GetComponent(); + if (animator == null) return; + } + + switch (notification) + { + case TMPStartAnimatingMarker: + animator.StartAnimating(); + break; + + case TMPStopAnimatingMarker: + animator.StopAnimating(); + break; + + case TMPUpdateAnimationsMarker uam: + animator.UpdateAnimations(uam.DeltaTime); + break; + + case TMPSetUpdateFromMarker sufm: + animator.SetUpdateFrom(sufm.UpdateFrom); + break; + + case TMPResetAnimationsMarker: + animator.ResetAnimations(); + break; + + case TMPResetTimeMarker rtm: + animator.ResetTime(rtm.Time); + break; + } + } +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAnimatorMarkReceiver.cs.meta b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAnimatorMarkReceiver.cs.meta new file mode 100644 index 0000000..dc423b1 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPAnimatorMarkReceiver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 15c3d0cf35622e44886c9d62d9766c50 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetAnimationsMarker.cs b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetAnimationsMarker.cs new file mode 100644 index 0000000..544ceb7 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetAnimationsMarker.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPResetAnimationsMarkerStyle")] +[TrackBindingType(typeof(TMPAnimatorTrack))] +[DisplayName("TMPEffects Marker/TMPAnimator/ResetAnimations")] +public class TMPResetAnimationsMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetAnimationsMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetAnimationsMarker.cs.meta new file mode 100644 index 0000000..0a3792d --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetAnimationsMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7e56f425e6af1c741b7a78d99790a979 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetTimeMarker.cs b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetTimeMarker.cs new file mode 100644 index 0000000..6a360b9 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetTimeMarker.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPResetTimeMarkerStyle")] +[TrackBindingType(typeof(TMPAnimatorTrack))] +[DisplayName("TMPEffects Marker/TMPAnimator/ResetTime")] +public class TMPResetTimeMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); + + [Space] [Tooltip("The time value to reset the TMPAnimator to.")] + [SerializeField] private new float time; + + public float Time => time; + + private void OnValidate() + { + if (time < 0) time = 0; + } +} diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetTimeMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetTimeMarker.cs.meta new file mode 100644 index 0000000..6f02105 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPResetTimeMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 9d1576421adbf314691b25c98e115f0f +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPSetUpdateFromMarker.cs b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPSetUpdateFromMarker.cs new file mode 100644 index 0000000..0b42c48 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPSetUpdateFromMarker.cs @@ -0,0 +1,24 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using TMPEffects.Components.Animator; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPSettingsMarkerStyle")] +[TrackBindingType(typeof(TMPAnimatorTrack))] +[DisplayName("TMPEffects Marker/TMPAnimator/SetUpdateFrom")] +public class TMPSetUpdateFromMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); + + [Space] [Tooltip("Where the TMPAnimator should be updated from.")] + [SerializeField] private UpdateFrom updateFrom; + + public UpdateFrom UpdateFrom => updateFrom; +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPSetUpdateFromMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPSetUpdateFromMarker.cs.meta new file mode 100644 index 0000000..5cc57ad --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPSetUpdateFromMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d0d2f95109a5b754d972290b46b28307 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStartAnimatingMarker.cs b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStartAnimatingMarker.cs new file mode 100644 index 0000000..eb8fa54 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStartAnimatingMarker.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPStartAnimatingMarkerStyle")] +[TrackBindingType(typeof(TMPAnimatorTrack))] +[DisplayName("TMPEffects Marker/TMPAnimator/StartAnimating")] +public class TMPStartAnimatingMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStartAnimatingMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStartAnimatingMarker.cs.meta new file mode 100644 index 0000000..f232984 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStartAnimatingMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e9a2b6138e421674ab63be04d6e651bf +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStopAnimatingMarker.cs b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStopAnimatingMarker.cs new file mode 100644 index 0000000..e44718b --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStopAnimatingMarker.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPStopAnimatingMarkerStyle")] +[TrackBindingType(typeof(TMPAnimatorTrack))] +[DisplayName("TMPEffects Marker/TMPAnimator/StopAnimating")] +public class TMPStopAnimatingMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStopAnimatingMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStopAnimatingMarker.cs.meta new file mode 100644 index 0000000..f967a06 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPStopAnimatingMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: c7242dec46b72434dac4b691c11257c9 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPUpdateAnimationsMarker.cs b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPUpdateAnimationsMarker.cs new file mode 100644 index 0000000..1ff1a40 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPUpdateAnimationsMarker.cs @@ -0,0 +1,23 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPUpdateAnimationsMarkerStyle")] +[TrackBindingType(typeof(TMPAnimatorTrack))] +[DisplayName("TMPEffects Marker/TMPAnimator/UpdateAnimations")] +public class TMPUpdateAnimationsMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); + + [Space] [Tooltip("The delta time value to update the animations with.")] + [SerializeField] private float deltaTime; + + public float DeltaTime => deltaTime; +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPUpdateAnimationsMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPUpdateAnimationsMarker.cs.meta new file mode 100644 index 0000000..fcd5700 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPAnimatorMarks/TMPUpdateAnimationsMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 57e4595dc637e234faa32e507023e1f7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPEffectsMark.cs b/Package/Runtime/Timeline/Markers/TMPEffectsMark.cs new file mode 100644 index 0000000..e06d773 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPEffectsMark.cs @@ -0,0 +1,15 @@ +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +public abstract class TMPEffectsMarker : Marker, INotification, INotificationOptionProvider +{ + [Header("Marker Settings")] + [SerializeField] protected bool retroactive = false; + [SerializeField] protected bool triggerOnce = false; + [SerializeField] protected bool triggerInEditMode = false; + + public abstract PropertyName id { get; } + public abstract NotificationFlags flags { get; } +} + \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPEffectsMark.cs.meta b/Package/Runtime/Timeline/Markers/TMPEffectsMark.cs.meta new file mode 100644 index 0000000..17ab17c --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPEffectsMark.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7c999d02c933b6d40b13e3ad9a93d1d3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks.meta b/Package/Runtime/Timeline/Markers/TMPWriterMarks.meta new file mode 100644 index 0000000..00fb170 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: bac805cac49a1fc40918ed404309e770 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPResetWriterMarker.cs b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPResetWriterMarker.cs new file mode 100644 index 0000000..2afe092 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPResetWriterMarker.cs @@ -0,0 +1,29 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPResetWriterMarkerStyle")] +[TrackBindingType(typeof(TMPWriterTrack))] +[DisplayName("TMPEffects Marker/TMPWriter/Reset writer")] +public class TMPResetWriterMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); + + [Space] [Tooltip("What text index to reset the TMPWriter to.")] + [SerializeField] private int textIndex; + + public int TextIndex => textIndex; + + private void OnValidate() + { + if (textIndex < 0) textIndex = 0; + } +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPResetWriterMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPResetWriterMarker.cs.meta new file mode 100644 index 0000000..05b3a20 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPResetWriterMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 2d819aa84d5f77e469689926b014d74c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPRestartWriterMarker.cs b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPRestartWriterMarker.cs new file mode 100644 index 0000000..77e6108 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPRestartWriterMarker.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPRestartWriterMarkerStyle")] +[TrackBindingType(typeof(TMPWriterTrack))] +[DisplayName("TMPEffects Marker/TMPWriter/Restart writer")] +public class TMPRestartWriterMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPRestartWriterMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPRestartWriterMarker.cs.meta new file mode 100644 index 0000000..c8883e7 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPRestartWriterMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 70b2561a3e63c6f4286d08344f7e1240 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPSkipWriterMarker.cs b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPSkipWriterMarker.cs new file mode 100644 index 0000000..f1b69db --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPSkipWriterMarker.cs @@ -0,0 +1,23 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPSkipWriterMarkerStyle")] +[TrackBindingType(typeof(TMPWriterTrack))] +[DisplayName("TMPEffects Marker/TMPWriter/Skip writer")] +public class TMPSkipWriterMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); + + [Space] [Tooltip("Whether to skip the show animations (if any) when skipping the current text.")] + [SerializeField] private bool skipShowAnimation = false; + + public bool SkipShowAnimation => skipShowAnimation; +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPSkipWriterMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPSkipWriterMarker.cs.meta new file mode 100644 index 0000000..a725ff3 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPSkipWriterMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: dafa5418cc90b004d9390012df8d2183 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStartWriterMarker.cs b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStartWriterMarker.cs new file mode 100644 index 0000000..380b067 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStartWriterMarker.cs @@ -0,0 +1,15 @@ +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPStartWriterMarkerStyle")] +[TrackBindingType(typeof(TMPWriterTrack))] +[DisplayName("TMPEffects Marker/TMPWriter/Start writer")] +public class TMPStartWriterMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStartWriterMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStartWriterMarker.cs.meta new file mode 100644 index 0000000..c2ad393 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStartWriterMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 0a38d115d4136f645a0d67a27170cf90 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStopWriterMarker.cs b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStopWriterMarker.cs new file mode 100644 index 0000000..d3889d3 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStopWriterMarker.cs @@ -0,0 +1,18 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPStopWriterMarkerStyle")] +[TrackBindingType(typeof(TMPWriterTrack))] +[DisplayName("TMPEffects Marker/TMPWriter/Stop writer")] +public class TMPStopWriterMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStopWriterMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStopWriterMarker.cs.meta new file mode 100644 index 0000000..58c07af --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPStopWriterMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5696a91fc457d9c418f972cc135cf94c +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterReceiver.cs b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterReceiver.cs new file mode 100644 index 0000000..ea90855 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterReceiver.cs @@ -0,0 +1,50 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.Components; +using UnityEngine; +using UnityEngine.Playables; + +[RequireComponent(typeof(TMPWriter))] +public class TMPWriterReceiver : MonoBehaviour, INotificationReceiver +{ + private TMPWriter writer; + + public void OnNotify(Playable origin, INotification notification, object context) + { + if (writer == null) + { + writer = GetComponent(); + if (writer == null) return; + } + + switch (notification) + { + case TMPStartWriterMarker: + writer.StartWriter(); + break; + case TMPStopWriterMarker: + writer.StopWriter(); + break; + case TMPResetWriterMarker rwm: + writer.ResetWriter(rwm.TextIndex); + break; + case TMPSkipWriterMarker swm: + writer.SkipWriter(swm.SkipShowAnimation); + break; + case TMPRestartWriterMarker: + writer.RestartWriter(); + break; + + + case TMPWriterWaitMarker wwm: + writer.Wait(wwm.WaitTime); + break; + case TMPWriterSetSkippableMarker wss: + writer.SetSkippable(wss.Skippable); + break; + case TMPWriterResetWaitMarker: + writer.ResetWaitPeriod(); + break; + } + } +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterReceiver.cs.meta b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterReceiver.cs.meta new file mode 100644 index 0000000..dad6a8a --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterReceiver.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 672d2a0430ac40d4985f992b9e6135fb +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterResetWaitMarker.cs b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterResetWaitMarker.cs new file mode 100644 index 0000000..405abb6 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterResetWaitMarker.cs @@ -0,0 +1,21 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + + +[CustomStyle("TMPWriterWaitMarkerStyle")] +[TrackBindingType(typeof(TMPWriterTrack))] +[DisplayName("TMPEffects Marker/TMPWriter/ResetWait")] +public class TMPWriterResetWaitMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); +} + + \ No newline at end of file diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterResetWaitMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterResetWaitMarker.cs.meta new file mode 100644 index 0000000..2d37366 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterResetWaitMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 919cb683dc0a9cb4898a29a6e2c530e4 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterSetSkippableMarker.cs b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterSetSkippableMarker.cs new file mode 100644 index 0000000..e8b04ea --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterSetSkippableMarker.cs @@ -0,0 +1,23 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Timeline; + +[CustomStyle("TMPSetSkippableMarkerStyle")] +[TrackBindingType(typeof(TMPWriterTrack))] +[DisplayName("TMPEffects Marker/TMPWriter/SetSkippable")] +public class TMPWriterSetSkippableMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); + + [Space] [Tooltip("Whether the current text should be skippable.")] + [SerializeField] private bool skippable = false; + + public bool Skippable => skippable; +} diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterSetSkippableMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterSetSkippableMarker.cs.meta new file mode 100644 index 0000000..54a5446 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterSetSkippableMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7f098c82fbf13f54f974039fb01961de +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterWaitMarker.cs b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterWaitMarker.cs new file mode 100644 index 0000000..5398f89 --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterWaitMarker.cs @@ -0,0 +1,39 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using UnityEngine; +using UnityEngine.Events; +using UnityEngine.Timeline; + +[CustomStyle("TMPWriterWaitMarkerStyle")] +[TrackBindingType(typeof(TMPWriterTrack))] +[DisplayName("TMPEffects Marker/TMPWriter/Wait")] +public class TMPWriterWaitMarker : TMPEffectsMarker +{ + public override PropertyName id => new PropertyName(); + + public override NotificationFlags flags => + (retroactive ? NotificationFlags.Retroactive : default) | + (triggerOnce ? NotificationFlags.TriggerOnce : default) | + (triggerInEditMode ? NotificationFlags.TriggerInEditMode : default); + + [Space] [Tooltip("The amount of time the TMPWriter should wait before continuing to write.")] + [SerializeField] private float waitTime = 0.5f; + public float WaitTime => waitTime; + + private void OnValidate() + { + if (waitTime < 0) waitTime = 0; + } + + // TODO Maybe supply some default class for implementing conditional waits + // eg just some ConditionalClass { public bool Evaluate() { } } + // [SerializeField] private WaitType waitType = WaitType.Period; + // [SerializeField] private UnityEvent waitAction; + // public enum WaitType + // { + // Condition, + // Period + // } +} diff --git a/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterWaitMarker.cs.meta b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterWaitMarker.cs.meta new file mode 100644 index 0000000..6bcc57c --- /dev/null +++ b/Package/Runtime/Timeline/Markers/TMPWriterMarks/TMPWriterWaitMarker.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: cea1ccd6e8a070c4eb6b57c82983376a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/TMPEffects.Timeline.asmdef b/Package/Runtime/Timeline/TMPEffects.Timeline.asmdef new file mode 100644 index 0000000..514c60e --- /dev/null +++ b/Package/Runtime/Timeline/TMPEffects.Timeline.asmdef @@ -0,0 +1,26 @@ +{ + "name": "TMPEffects.Timeline", + "rootNamespace": "", + "references": [ + "GUID:96c64e576ede81e46ad482a315c680f9", + "GUID:f06555f75b070af458a003d92f9efb00", + "GUID:6055be8ebefd69e48b49212b09b47b2f" + ], + "includePlatforms": [], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": false, + "precompiledReferences": [], + "autoReferenced": true, + "defineConstraints": [ + "TIMELINE_INSTALLED" + ], + "versionDefines": [ + { + "name": "com.unity.timeline", + "expression": "1.4.8", + "define": "TIMELINE_INSTALLED" + } + ], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/TMPEffects.Timeline.asmdef.meta b/Package/Runtime/Timeline/TMPEffects.Timeline.asmdef.meta new file mode 100644 index 0000000..cefe37a --- /dev/null +++ b/Package/Runtime/Timeline/TMPEffects.Timeline.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: a86700a2afb0a6d4f8916928522caee6 +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/TMPEffectsClip.cs b/Package/Runtime/Timeline/TMPEffectsClip.cs new file mode 100644 index 0000000..0e6b909 --- /dev/null +++ b/Package/Runtime/Timeline/TMPEffectsClip.cs @@ -0,0 +1,9 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +public abstract class TMPEffectsClip : PlayableAsset +{ +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/TMPEffectsClip.cs.meta b/Package/Runtime/Timeline/TMPEffectsClip.cs.meta new file mode 100644 index 0000000..66f39f7 --- /dev/null +++ b/Package/Runtime/Timeline/TMPEffectsClip.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 8a35d9a33c002144391ca090b3b0c66a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/TMPEffectsTrack.cs b/Package/Runtime/Timeline/TMPEffectsTrack.cs new file mode 100644 index 0000000..391b496 --- /dev/null +++ b/Package/Runtime/Timeline/TMPEffectsTrack.cs @@ -0,0 +1,4 @@ +using UnityEngine.Timeline; + +public abstract class TMPEffectsTrack : TrackAsset +{ } diff --git a/Package/Runtime/Timeline/TMPEffectsTrack.cs.meta b/Package/Runtime/Timeline/TMPEffectsTrack.cs.meta new file mode 100644 index 0000000..324247e --- /dev/null +++ b/Package/Runtime/Timeline/TMPEffectsTrack.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 4bcd93e158c6ea641a381d49c488711d +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/TimelineAnimationStep.cs b/Package/Runtime/Timeline/TimelineAnimationStep.cs new file mode 100644 index 0000000..17406f8 --- /dev/null +++ b/Package/Runtime/Timeline/TimelineAnimationStep.cs @@ -0,0 +1,14 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; + +// Empty sub-class to make custom editor for animation steps used in the timeline +// (couldnt work into normal editor because of reliance on timeline package) +[System.Serializable] +public class TimelineAnimationStep +{ + public AnimationStep Step; +#if UNITY_EDITOR + public int lastMovedEntry = 0; +#endif +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/TimelineAnimationStep.cs.meta b/Package/Runtime/Timeline/TimelineAnimationStep.cs.meta new file mode 100644 index 0000000..619c6b0 --- /dev/null +++ b/Package/Runtime/Timeline/TimelineAnimationStep.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 5d8c2f16504d31b48945d8e7b81527b8 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/TrackMixers.meta b/Package/Runtime/Timeline/TrackMixers.meta new file mode 100644 index 0000000..ecfc50d --- /dev/null +++ b/Package/Runtime/Timeline/TrackMixers.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 00f24b7fc533cc94cada5d1d12632165 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/TrackMixers/TMPAnimatorTrackMixer.cs b/Package/Runtime/Timeline/TrackMixers/TMPAnimatorTrackMixer.cs new file mode 100644 index 0000000..d3b3640 --- /dev/null +++ b/Package/Runtime/Timeline/TrackMixers/TMPAnimatorTrackMixer.cs @@ -0,0 +1,12 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.Components; +using TMPEffects.Components.Animator; +using UnityEngine; +using UnityEngine.Playables; + +public class TMPAnimatorTrackMixer : PlayableBehaviour +{ + +} diff --git a/Package/Runtime/Timeline/TrackMixers/TMPAnimatorTrackMixer.cs.meta b/Package/Runtime/Timeline/TrackMixers/TMPAnimatorTrackMixer.cs.meta new file mode 100644 index 0000000..f62efda --- /dev/null +++ b/Package/Runtime/Timeline/TrackMixers/TMPAnimatorTrackMixer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: d35981633694b9846b37f84450b5f19e +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/TrackMixers/TMPMeshModifierTrackMixer.cs b/Package/Runtime/Timeline/TrackMixers/TMPMeshModifierTrackMixer.cs new file mode 100644 index 0000000..3c343b5 --- /dev/null +++ b/Package/Runtime/Timeline/TrackMixers/TMPMeshModifierTrackMixer.cs @@ -0,0 +1,104 @@ +using System.Collections; +using System.Collections.Generic; +using TMPEffects.CharacterData; +using TMPEffects.Components; +using TMPEffects.Components.Animator; +using TMPEffects.TMPAnimations; +using UnityEngine; +using UnityEngine.Playables; + +public class TMPMeshModifierTrackMixer : PlayableBehaviour +{ + private ExposedReference director; + private List> active; + private TMPAnimator animator; + private float time; + + public override void ProcessFrame(Playable playable, FrameData info, object playerData) + { + animator = playerData as TMPAnimator; + + if (animator == null) return; + + PlayableDirector director = (PlayableDirector)playable.GetGraph().GetResolver(); + + active ??= new List>(); + active.Clear(); + + animator.OnCharacterAnimated -= OnAnimatedCallback; + + time = (float)director.time; + + int inputCount = playable.GetInputCount(); + for (int i = 0; i < inputCount; i++) + { + float weight = playable.GetInputWeight(i); + if (weight <= 0) continue; + + ScriptPlayable behaviour = + (ScriptPlayable)playable.GetInput(i); + + active.Add(behaviour); + } + + if (active.Count > 0) animator.OnCharacterAnimated += OnAnimatedCallback; + + if (animator.UpdateFrom == UpdateFrom.Script) + animator.UpdateAnimations(0f); + } + + private void OnAnimatedCallback(CharData cdata) + { + modifiersStorage ??= new CharDataModifiers(); + modifiersStorage2 ??= new CharDataModifiers(); + accModifier ??= new CharDataModifiers(); + current ??= new CharDataModifiers(); + + for (int i = 0; i < active.Count; i++) + { + if (!active[i].IsValid()) continue; + var behaviour = active[i].GetBehaviour(); + if (behaviour == null) continue; + float currTime = (float)active[i].GetTime(); + float duration = (float)behaviour.Clip.duration; + // float dur2 = (float)behaviour.Clip.duration; + float weight = 1; + + + if (behaviour.Step.Step.entryDuration > 0 && currTime <= behaviour.Step.Step.entryDuration) + { + weight = behaviour.Step.Step.entryCurve.Evaluate(cdata, animator.AnimatorContext, currTime / behaviour.Step.Step.entryDuration); + } + + else if (behaviour.Step.Step.exitDuration > 0 && currTime >= duration - behaviour.Step.Step.exitDuration) + { + float preTime = duration - behaviour.Step.Step.exitDuration; + weight = behaviour.Step.Step.exitCurve.Evaluate(cdata, animator.AnimatorContext, 1f - (currTime - preTime) / + behaviour.Step.Step.exitDuration); + } + + if (behaviour.Step.Step.useWave) + { + var offset = AnimationUtility.GetWaveOffset(cdata, animator.AnimatorContext, + behaviour.Step.Step.waveOffsetType); + weight *= behaviour.Step.Step.wave.Evaluate(currTime, offset).Value; + } + + current.Reset(); + CharDataModifiers.ctx = animator.AnimatorContext; + GenericAnimation.ApplyAnimationStepWeighted(behaviour.Step.Step, weight, cdata, animator.AnimatorContext, + modifiersStorage, modifiersStorage2, current); + + // var result = Calc(animator, behaviour.Step, cdata, weight, time); + cdata.CharacterModifierss.Combine(current.CharacterModifiers); + cdata.MeshModifiers.Combine(current.MeshModifiers); + } + } + + + // TODO + // Calc and genericanimation should use some shared implementation + // Probably generated animations as well? + private CharDataModifiers modifiersStorage, modifiersStorage2; + private CharDataModifiers accModifier, current; +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/TrackMixers/TMPMeshModifierTrackMixer.cs.meta b/Package/Runtime/Timeline/TrackMixers/TMPMeshModifierTrackMixer.cs.meta new file mode 100644 index 0000000..bb2462d --- /dev/null +++ b/Package/Runtime/Timeline/TrackMixers/TMPMeshModifierTrackMixer.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: b285073f55acdde4491aed883be56806 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Tracks.meta b/Package/Runtime/Timeline/Tracks.meta new file mode 100644 index 0000000..e0e0ace --- /dev/null +++ b/Package/Runtime/Timeline/Tracks.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 5f0a59a04ba9f7a469626e333e1e9f97 +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Tracks/TMPAnimatorTrack.cs b/Package/Runtime/Timeline/Tracks/TMPAnimatorTrack.cs new file mode 100644 index 0000000..29f52b6 --- /dev/null +++ b/Package/Runtime/Timeline/Tracks/TMPAnimatorTrack.cs @@ -0,0 +1,25 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using TMPEffects.Components; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +[TrackBindingType(typeof(TMPAnimator))] +[TrackClipType(typeof(TMPAnimationClip))] +[DisplayName("TMPEffects/TMPAnimatorTrack")] +public class TMPAnimatorTrack : TrackAsset +{ + public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) + { + var clips = GetClips(); + foreach (var clip in clips) + { + var currClip = clip.asset as TMPAnimationClip; + currClip.Clip = clip; + } + + return ScriptPlayable.Create(graph, inputCount); + } +} diff --git a/Package/Runtime/Timeline/Tracks/TMPAnimatorTrack.cs.meta b/Package/Runtime/Timeline/Tracks/TMPAnimatorTrack.cs.meta new file mode 100644 index 0000000..db9a908 --- /dev/null +++ b/Package/Runtime/Timeline/Tracks/TMPAnimatorTrack.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 16049b9e5ea2f4b4a91ba13fbfd74924 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Tracks/TMPMeshModifierTrack.cs b/Package/Runtime/Timeline/Tracks/TMPMeshModifierTrack.cs new file mode 100644 index 0000000..69137fa --- /dev/null +++ b/Package/Runtime/Timeline/Tracks/TMPMeshModifierTrack.cs @@ -0,0 +1,26 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using TMPEffects.CharacterData; +using TMPEffects.Components; +using UnityEngine; +using UnityEngine.Playables; +using UnityEngine.Timeline; + +[TrackBindingType(typeof(TMPAnimator))] +[TrackClipType(typeof(TMPMeshModifierClip))] +[DisplayName("TMPEffects/TMPMeshModifier Track")] +public class TMPMeshModifierTrack : TMPEffectsTrack +{ + public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount) + { + var clips = GetClips(); + foreach (var clip in clips) + { + var currClip = clip.asset as TMPMeshModifierClip; + currClip.Clip = clip; + } + + return ScriptPlayable.Create(graph, inputCount); + } +} \ No newline at end of file diff --git a/Package/Runtime/Timeline/Tracks/TMPMeshModifierTrack.cs.meta b/Package/Runtime/Timeline/Tracks/TMPMeshModifierTrack.cs.meta new file mode 100644 index 0000000..0b20a38 --- /dev/null +++ b/Package/Runtime/Timeline/Tracks/TMPMeshModifierTrack.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 904f8d22bfe6f2147af0c2edc5912739 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/Timeline/Tracks/TMPWriterTrack.cs b/Package/Runtime/Timeline/Tracks/TMPWriterTrack.cs new file mode 100644 index 0000000..8c6fbdf --- /dev/null +++ b/Package/Runtime/Timeline/Tracks/TMPWriterTrack.cs @@ -0,0 +1,13 @@ +using System.Collections; +using System.Collections.Generic; +using System.ComponentModel; +using TMPEffects.Components; +using UnityEngine; +using UnityEngine.Timeline; + +[TrackBindingType(typeof(TMPWriterReceiver))] +// [TrackClipType(typeof(TMPWriterClip))] +[DisplayName("TMPEffects/TMPWriter Track")] +public class TMPWriterTrack : TrackAsset +{ +} diff --git a/Package/Runtime/Timeline/Tracks/TMPWriterTrack.cs.meta b/Package/Runtime/Timeline/Tracks/TMPWriterTrack.cs.meta new file mode 100644 index 0000000..4f0916d --- /dev/null +++ b/Package/Runtime/Timeline/Tracks/TMPWriterTrack.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: f2aaa17a584ecef42890010bc9af25c7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Runtime/UnityNullable.cs b/Package/Runtime/UnityNullable.cs new file mode 100644 index 0000000..a6525bd --- /dev/null +++ b/Package/Runtime/UnityNullable.cs @@ -0,0 +1,67 @@ +using System; +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +// +// [Serializable] +// public struct ColorNullable : UnityNullable {} + +[Serializable] +public class UnityNullable : IEquatable> +{ + public bool HasValue + { + get => hasValue; + set + { + hasValue = value; + if (!value) this.value = default(T); + } + } + + public T Value + { + get + { + if (!hasValue) return default(T); + return value; + } + + set + { + hasValue = true; + this.value = value; + } + } + + [SerializeField] private T value; + [SerializeField] private bool hasValue; + + public UnityNullable() + { + value = default; + hasValue = false; + } + + public UnityNullable(T value) + { + this.value = value; + hasValue = true; + } + + public bool Equals(UnityNullable other) + { + if (other == null) return false; + return EqualityComparer.Default.Equals(value, other.value) && hasValue == other.hasValue; + } + + public override bool Equals(object obj) + { + return obj is UnityNullable other && Equals(other); + } + + public override int GetHashCode() + { + return HashCode.Combine(value, hasValue); + } +} diff --git a/Package/Runtime/UnityNullable.cs.meta b/Package/Runtime/UnityNullable.cs.meta new file mode 100644 index 0000000..2a35f25 --- /dev/null +++ b/Package/Runtime/UnityNullable.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: a463d09b4f5eb59449a693d4ef7541e3 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Tests/CharDataTests.cs b/Package/Tests/CharDataTests.cs new file mode 100644 index 0000000..32c6055 --- /dev/null +++ b/Package/Tests/CharDataTests.cs @@ -0,0 +1,245 @@ +using System.Collections; +using NUnit.Framework; +using TMPEffects.CharacterData; +using UnityEngine; +using UnityEngine.TestTools; +using TMPro; +using TMPEffects.Components; +using UnityEditor.SceneManagement; +using UnityEngine.SceneManagement; +using TMPEffects.TextProcessing; +using TMPEffects.EffectCategories; + +public class CharDataTests +{ + private TMP_CharacterInfo characterInfo = new TMP_CharacterInfo() + { + ascender = 12, + color = Color.red, + index = 23, + character = 'D', + baseLine = 3, + vertex_BL = new TMP_Vertex() + { color = Color.black, position = Vector3.one * 10, uv = Vector3.one, uv2 = Vector3.one * 2.5f }, + vertex_TL = new TMP_Vertex() + { color = Color.red, position = Vector3.one * 10, uv = Vector3.one, uv2 = Vector3.one * 2.5f }, + vertex_TR = new TMP_Vertex() + { color = Color.green, position = Vector3.one * 5, uv = Vector3.one * 0.4f, uv2 = Vector3.one * 22.5f }, + vertex_BR = new TMP_Vertex() + { color = Color.blue, position = Vector3.one * 2, uv = Vector3.one * 0.8f, uv2 = Vector3.one * 24.5f }, + }; + + [Test] + public void CreationTests() + { + CharData cData = new CharData(34, characterInfo, 2); + + Assert.AreEqual(12, cData.info.ascender); + Assert.AreEqual((Color32)Color.red, cData.info.color); + Assert.AreEqual(34, cData.info.index); + Assert.AreEqual('D', cData.info.character); + Assert.AreEqual(3, cData.info.baseLine); + + Assert.AreEqual(characterInfo.vertex_BL.position, cData.InitialMesh.BL_Position); + Assert.AreEqual(characterInfo.vertex_BL.uv, (Vector2)cData.InitialMesh.BL_UV0); + Assert.AreEqual(characterInfo.vertex_BL.uv2, (Vector2)cData.InitialMesh.BL_UV2); + Assert.AreEqual(characterInfo.vertex_BL.color, cData.InitialMesh.BL_Color); + + Assert.AreEqual(characterInfo.vertex_BL.position, cData.mesh.BL_Position); + Assert.AreEqual(characterInfo.vertex_BL.uv, (Vector2)cData.mesh.BL_UV0); + Assert.AreEqual(characterInfo.vertex_BL.uv2, (Vector2)cData.mesh.BL_UV2); + Assert.AreEqual(characterInfo.vertex_BL.color, cData.mesh.BL_Color); + + Assert.AreEqual(characterInfo.vertex_TL.position, cData.InitialMesh.TL_Position); + Assert.AreEqual(characterInfo.vertex_TL.uv, (Vector2)cData.InitialMesh.TL_UV0); + Assert.AreEqual(characterInfo.vertex_TL.uv2, (Vector2)cData.InitialMesh.TL_UV2); + Assert.AreEqual(characterInfo.vertex_TL.color, cData.InitialMesh.TL_Color); + + Assert.AreEqual(characterInfo.vertex_TL.position, cData.mesh.TL_Position); + Assert.AreEqual(characterInfo.vertex_TL.uv, (Vector2)cData.mesh.TL_UV0); + Assert.AreEqual(characterInfo.vertex_TL.uv2, (Vector2)cData.mesh.TL_UV2); + Assert.AreEqual(characterInfo.vertex_TL.color, cData.mesh.TL_Color); + + Assert.AreEqual(characterInfo.vertex_TR.position, cData.InitialMesh.TR_Position); + Assert.AreEqual(characterInfo.vertex_TR.uv, (Vector2)cData.InitialMesh.TR_UV0); + Assert.AreEqual(characterInfo.vertex_TR.uv2, (Vector2)cData.InitialMesh.TR_UV2); + Assert.AreEqual(characterInfo.vertex_TR.color, cData.InitialMesh.TR_Color); + + Assert.AreEqual(characterInfo.vertex_TR.position, cData.mesh.TR_Position); + Assert.AreEqual(characterInfo.vertex_TR.uv, (Vector2)cData.mesh.TR_UV0); + Assert.AreEqual(characterInfo.vertex_TR.uv2, (Vector2)cData.mesh.TR_UV2); + Assert.AreEqual(characterInfo.vertex_TR.color, cData.mesh.TR_Color); + + Assert.AreEqual(characterInfo.vertex_BR.position, cData.InitialMesh.BR_Position); + Assert.AreEqual(characterInfo.vertex_BR.uv, (Vector2)cData.InitialMesh.BR_UV0); + Assert.AreEqual(characterInfo.vertex_BR.uv2, (Vector2)cData.InitialMesh.BR_UV2); + Assert.AreEqual(characterInfo.vertex_BR.color, cData.InitialMesh.BR_Color); + + Assert.AreEqual(characterInfo.vertex_BR.position, cData.mesh.BR_Position); + Assert.AreEqual(characterInfo.vertex_BR.uv, (Vector2)cData.mesh.BR_UV0); + Assert.AreEqual(characterInfo.vertex_BR.uv2, (Vector2)cData.mesh.BR_UV2); + Assert.AreEqual(characterInfo.vertex_BR.color, cData.mesh.BR_Color); + + Vector3 center = Vector3.zero; + center += (cData.mesh.BL_Position + cData.mesh.TL_Position + cData.mesh.TR_Position + cData.mesh.BR_Position); + center /= 4f; + + Assert.AreEqual(Quaternion.identity, cData.InitialRotation); + Assert.AreEqual(Vector3.one, cData.InitialScale); + Assert.IsTrue(Vector3.Magnitude(center - cData.InitialPosition) < 0.001f); + + + cData = new CharData(0, characterInfo, 2, new TMP_WordInfo()); + + Assert.AreEqual(12, cData.info.ascender); + Assert.AreEqual((Color32)Color.red, cData.info.color); + Assert.AreEqual(0, cData.info.index); + Assert.AreEqual('D', cData.info.character); + Assert.AreEqual(3, cData.info.baseLine); + + Assert.AreEqual(characterInfo.vertex_BL.position, cData.InitialMesh.BL_Position); + Assert.AreEqual(characterInfo.vertex_BL.uv, (Vector2)cData.InitialMesh.BL_UV0); + Assert.AreEqual(characterInfo.vertex_BL.uv2, (Vector2)cData.InitialMesh.BL_UV2); + Assert.AreEqual(characterInfo.vertex_BL.color, cData.InitialMesh.BL_Color); + + Assert.AreEqual(characterInfo.vertex_BL.position, cData.mesh.BL_Position); + Assert.AreEqual(characterInfo.vertex_BL.uv, (Vector2)cData.mesh.BL_UV0); + Assert.AreEqual(characterInfo.vertex_BL.uv2, (Vector2)cData.mesh.BL_UV2); + Assert.AreEqual(characterInfo.vertex_BL.color, cData.mesh.BL_Color); + + Assert.AreEqual(characterInfo.vertex_TL.position, cData.InitialMesh.TL_Position); + Assert.AreEqual(characterInfo.vertex_TL.uv, (Vector2)cData.InitialMesh.TL_UV0); + Assert.AreEqual(characterInfo.vertex_TL.uv2, (Vector2)cData.InitialMesh.TL_UV2); + Assert.AreEqual(characterInfo.vertex_TL.color, cData.InitialMesh.TL_Color); + + Assert.AreEqual(characterInfo.vertex_TL.position, cData.mesh.TL_Position); + Assert.AreEqual(characterInfo.vertex_TL.uv, (Vector2)cData.mesh.TL_UV0); + Assert.AreEqual(characterInfo.vertex_TL.uv2, (Vector2)cData.mesh.TL_UV2); + Assert.AreEqual(characterInfo.vertex_TL.color, cData.mesh.TL_Color); + + Assert.AreEqual(characterInfo.vertex_TR.position, cData.InitialMesh.TR_Position); + Assert.AreEqual(characterInfo.vertex_TR.uv, (Vector2)cData.InitialMesh.TR_UV0); + Assert.AreEqual(characterInfo.vertex_TR.uv2, (Vector2)cData.InitialMesh.TR_UV2); + Assert.AreEqual(characterInfo.vertex_TR.color, cData.InitialMesh.TR_Color); + + Assert.AreEqual(characterInfo.vertex_TR.position, cData.mesh.TR_Position); + Assert.AreEqual(characterInfo.vertex_TR.uv, (Vector2)cData.mesh.TR_UV0); + Assert.AreEqual(characterInfo.vertex_TR.uv2, (Vector2)cData.mesh.TR_UV2); + Assert.AreEqual(characterInfo.vertex_TR.color, cData.mesh.TR_Color); + + Assert.AreEqual(characterInfo.vertex_BR.position, cData.InitialMesh.BR_Position); + Assert.AreEqual(characterInfo.vertex_BR.uv, (Vector2)cData.InitialMesh.BR_UV0); + Assert.AreEqual(characterInfo.vertex_BR.uv2, (Vector2)cData.InitialMesh.BR_UV2); + Assert.AreEqual(characterInfo.vertex_BR.color, cData.InitialMesh.BR_Color); + + Assert.AreEqual(characterInfo.vertex_BR.position, cData.mesh.BR_Position); + Assert.AreEqual(characterInfo.vertex_BR.uv, (Vector2)cData.mesh.BR_UV0); + Assert.AreEqual(characterInfo.vertex_BR.uv2, (Vector2)cData.mesh.BR_UV2); + Assert.AreEqual(characterInfo.vertex_BR.color, cData.mesh.BR_Color); + + center = Vector3.zero; + center += (cData.mesh.BL_Position + cData.mesh.TL_Position + cData.mesh.TR_Position + cData.mesh.BR_Position); + center /= 4f; + + Assert.AreEqual(Quaternion.identity, cData.InitialRotation); + Assert.AreEqual(Vector3.one, cData.InitialScale); + Assert.IsTrue(Vector3.Magnitude(center - cData.InitialPosition) < 0.001f); + } + + [Test] + public void PropertyTests() + { + CharData cData = new CharData(0, characterInfo, 2); + + cData.Position = new Vector3(8, 9, 10); + cData.Scale = new Vector3(1, 2, 3); + cData.AddRotation(new Vector3(90, 60, 90), new Vector3(4, 5, 6)); + + Assert.AreEqual(new Vector3(8, 9, 10), cData.Position); + Assert.AreEqual(new Vector3(8, 9, 10) - cData.InitialPosition, cData.PositionDelta); + Assert.AreEqual(new Vector3(1, 2, 3), cData.Scale); + Assert.AreEqual(1, cData.Rotations.Count); + Assert.AreEqual(new Rotation(new Vector3(90, 60, 90), new Vector3(4, 5, 6)), + cData.Rotations[0]); + + cData.Position += Vector3.one; + cData.Scale += Vector3.one; + cData.AddRotation(new Vector3(90, 60, 90) * 0.5f, new Vector3(4, 5, 6) * 9f); + + Assert.AreEqual(new Vector3(9, 10, 11), cData.Position); + Assert.AreEqual(new Vector3(9, 10, 11) - cData.InitialPosition, cData.PositionDelta); + Assert.AreEqual(new Vector3(2, 3, 4), cData.Scale); + Assert.AreEqual(2, cData.Rotations.Count); + Assert.AreEqual(new Rotation(new Vector3(90, 60, 90) * 0.5f, new Vector3(4, 5, 6) * 9f), + cData.Rotations[1]); + + cData.PositionDelta = Vector3.one * 3; + Assert.AreEqual(Vector3.one * 3, cData.PositionDelta); + Assert.AreEqual(cData.InitialPosition + Vector3.one * 3, cData.Position); + + cData.ClearPosition(); + cData.ClearRotations(); + cData.ClearScale(); + + Assert.AreEqual(Vector3.zero, cData.PositionDelta); + Assert.AreEqual(cData.InitialPosition, cData.Position); + Assert.AreEqual(cData.InitialScale, cData.Scale); + Assert.AreEqual(0, cData.Rotations.Count); + } + + [Test] + public void MeshPropertyTests() + { + CharData cData = new CharData(0, characterInfo, 2); + + cData.mesh.BL_Position = Vector3.one; + cData.mesh.TL_Position = Vector3.one * 2; + cData.mesh.TR_Position = Vector3.one * 3; + cData.mesh.BR_Position = Vector3.one * 4; + + Assert.AreEqual(Vector3.one, cData.mesh.BL_Position); + Assert.AreEqual(Vector3.one * 2, cData.mesh.TL_Position); + Assert.AreEqual(Vector3.one * 3, cData.mesh.TR_Position); + Assert.AreEqual(Vector3.one * 4, cData.mesh.BR_Position); + + cData.mesh.BL_Color = Color.red; + cData.mesh.TL_Color = Color.black; + cData.mesh.TR_Color = Color.green; + cData.mesh.BR_Color = Color.magenta; + + Assert.AreEqual((Color32)Color.red, cData.mesh.BL_Color); + Assert.AreEqual((Color32)Color.black, cData.mesh.TL_Color); + Assert.AreEqual((Color32)Color.green, cData.mesh.TR_Color); + Assert.AreEqual((Color32)Color.magenta, cData.mesh.BR_Color); + + cData.mesh.BL_Alpha = 5; + cData.mesh.TL_Alpha = 15; + cData.mesh.TR_Alpha = 115; + cData.mesh.BR_Alpha = byte.MaxValue; + + Assert.AreEqual(5, cData.mesh.BL_Color.a); + Assert.AreEqual(15, cData.mesh.TL_Color.a); + Assert.AreEqual(115, cData.mesh.TR_Color.a); + Assert.AreEqual(byte.MaxValue, cData.mesh.BR_Color.a); + + cData.mesh.BL_UV0 = new Vector2(0, 0); + cData.mesh.TL_UV0 = new Vector2(0, 0); + cData.mesh.TR_UV0 = new Vector2(0, 0); + cData.mesh.BR_UV0 = new Vector2(0, 0); + + Assert.AreEqual(Vector3.zero, cData.mesh.BL_UV0); + Assert.AreEqual(Vector3.zero, cData.mesh.TL_UV0); + Assert.AreEqual(Vector3.zero, cData.mesh.TR_UV0); + Assert.AreEqual(Vector3.zero, cData.mesh.BR_UV0); + + cData.mesh.BL_UV2 = new Vector2(0, 0); + cData.mesh.TL_UV2 = new Vector2(0, 0); + cData.mesh.TR_UV2 = new Vector2(0, 0); + cData.mesh.BR_UV2 = new Vector2(0, 0); + + Assert.AreEqual(Vector3.zero, cData.mesh.BL_UV2); + Assert.AreEqual(Vector3.zero, cData.mesh.TL_UV2); + Assert.AreEqual(Vector3.zero, cData.mesh.TR_UV2); + Assert.AreEqual(Vector3.zero, cData.mesh.BR_UV2); + } +} \ No newline at end of file diff --git a/Package/Tests/CharDataTests.cs.meta b/Package/Tests/CharDataTests.cs.meta new file mode 100644 index 0000000..f0cf767 --- /dev/null +++ b/Package/Tests/CharDataTests.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: 7d59180f8e663b94e9046e46dfa8919a +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Tests/Timeline Tests.meta b/Package/Tests/Timeline Tests.meta new file mode 100644 index 0000000..1719f9d --- /dev/null +++ b/Package/Tests/Timeline Tests.meta @@ -0,0 +1,8 @@ +fileFormatVersion: 2 +guid: 071ea556b6db5c9468203247f12e462a +folderAsset: yes +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Tests/Timeline Tests/New Scene.unity b/Package/Tests/Timeline Tests/New Scene.unity new file mode 100644 index 0000000..60498f9 --- /dev/null +++ b/Package/Tests/Timeline Tests/New Scene.unity @@ -0,0 +1,691 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!29 &1 +OcclusionCullingSettings: + m_ObjectHideFlags: 0 + serializedVersion: 2 + m_OcclusionBakeSettings: + smallestOccluder: 5 + smallestHole: 0.25 + backfaceThreshold: 100 + m_SceneGUID: 00000000000000000000000000000000 + m_OcclusionCullingData: {fileID: 0} +--- !u!104 &2 +RenderSettings: + m_ObjectHideFlags: 0 + serializedVersion: 9 + m_Fog: 0 + m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1} + m_FogMode: 3 + m_FogDensity: 0.01 + m_LinearFogStart: 0 + m_LinearFogEnd: 300 + m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1} + m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1} + m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1} + m_AmbientIntensity: 1 + m_AmbientMode: 0 + m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1} + m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0} + m_HaloStrength: 0.5 + m_FlareStrength: 1 + m_FlareFadeSpeed: 3 + m_HaloTexture: {fileID: 0} + m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0} + m_DefaultReflectionMode: 0 + m_DefaultReflectionResolution: 128 + m_ReflectionBounces: 1 + m_ReflectionIntensity: 1 + m_CustomReflection: {fileID: 0} + m_Sun: {fileID: 0} + m_IndirectSpecularColor: {r: 0.44657898, g: 0.4964133, b: 0.5748178, a: 1} + m_UseRadianceAmbientProbe: 0 +--- !u!157 &3 +LightmapSettings: + m_ObjectHideFlags: 0 + serializedVersion: 12 + m_GIWorkflowMode: 1 + m_GISettings: + serializedVersion: 2 + m_BounceScale: 1 + m_IndirectOutputScale: 1 + m_AlbedoBoost: 1 + m_EnvironmentLightingMode: 0 + m_EnableBakedLightmaps: 1 + m_EnableRealtimeLightmaps: 0 + m_LightmapEditorSettings: + serializedVersion: 12 + m_Resolution: 2 + m_BakeResolution: 40 + m_AtlasSize: 1024 + m_AO: 0 + m_AOMaxDistance: 1 + m_CompAOExponent: 1 + m_CompAOExponentDirect: 0 + m_ExtractAmbientOcclusion: 0 + m_Padding: 2 + m_LightmapParameters: {fileID: 0} + m_LightmapsBakeMode: 1 + m_TextureCompression: 1 + m_FinalGather: 0 + m_FinalGatherFiltering: 1 + m_FinalGatherRayCount: 256 + m_ReflectionCompression: 2 + m_MixedBakeMode: 2 + m_BakeBackend: 1 + m_PVRSampling: 1 + m_PVRDirectSampleCount: 32 + m_PVRSampleCount: 512 + m_PVRBounces: 2 + m_PVREnvironmentSampleCount: 256 + m_PVREnvironmentReferencePointCount: 2048 + m_PVRFilteringMode: 1 + m_PVRDenoiserTypeDirect: 1 + m_PVRDenoiserTypeIndirect: 1 + m_PVRDenoiserTypeAO: 1 + m_PVRFilterTypeDirect: 0 + m_PVRFilterTypeIndirect: 0 + m_PVRFilterTypeAO: 0 + m_PVREnvironmentMIS: 1 + m_PVRCulling: 1 + m_PVRFilteringGaussRadiusDirect: 1 + m_PVRFilteringGaussRadiusIndirect: 5 + m_PVRFilteringGaussRadiusAO: 2 + m_PVRFilteringAtrousPositionSigmaDirect: 0.5 + m_PVRFilteringAtrousPositionSigmaIndirect: 2 + m_PVRFilteringAtrousPositionSigmaAO: 1 + m_ExportTrainingData: 0 + m_TrainingDataDestination: TrainingData + m_LightProbeSampleCountMultiplier: 4 + m_LightingDataAsset: {fileID: 0} + m_LightingSettings: {fileID: 0} +--- !u!196 &4 +NavMeshSettings: + serializedVersion: 2 + m_ObjectHideFlags: 0 + m_BuildSettings: + serializedVersion: 3 + agentTypeID: 0 + agentRadius: 0.5 + agentHeight: 2 + agentSlope: 45 + agentClimb: 0.4 + ledgeDropHeight: 0 + maxJumpAcrossDistance: 0 + minRegionArea: 2 + manualCellSize: 0 + cellSize: 0.16666667 + manualTileSize: 0 + tileSize: 256 + buildHeightMesh: 0 + maxJobWorkers: 0 + preserveTilesOutsideBounds: 0 + debug: + m_Flags: 0 + m_NavMeshData: {fileID: 0} +--- !u!1 &369384856 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 369384858} + - component: {fileID: 369384857} + m_Layer: 0 + m_Name: Directional Light + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!108 &369384857 +Light: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 369384856} + m_Enabled: 1 + serializedVersion: 10 + m_Type: 1 + m_Shape: 0 + m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1} + m_Intensity: 1 + m_Range: 10 + m_SpotAngle: 30 + m_InnerSpotAngle: 21.80208 + m_CookieSize: 10 + m_Shadows: + m_Type: 2 + m_Resolution: -1 + m_CustomResolution: -1 + m_Strength: 1 + m_Bias: 0.05 + m_NormalBias: 0.4 + m_NearPlane: 0.2 + m_CullingMatrixOverride: + e00: 1 + e01: 0 + e02: 0 + e03: 0 + e10: 0 + e11: 1 + e12: 0 + e13: 0 + e20: 0 + e21: 0 + e22: 1 + e23: 0 + e30: 0 + e31: 0 + e32: 0 + e33: 1 + m_UseCullingMatrixOverride: 0 + m_Cookie: {fileID: 0} + m_DrawHalo: 0 + m_Flare: {fileID: 0} + m_RenderMode: 0 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingLayerMask: 1 + m_Lightmapping: 4 + m_LightShadowCasterMode: 0 + m_AreaSize: {x: 1, y: 1} + m_BounceIntensity: 1 + m_ColorTemperature: 6570 + m_UseColorTemperature: 0 + m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0} + m_UseBoundingSphereOverride: 0 + m_UseViewFrustumForShadowCasterCull: 1 + m_ShadowRadius: 0 + m_ShadowAngle: 0 +--- !u!4 &369384858 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 369384856} + serializedVersion: 2 + m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261} + m_LocalPosition: {x: 0, y: 3, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0} +--- !u!1 &409867534 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 409867535} + - component: {fileID: 409867538} + - component: {fileID: 409867537} + - component: {fileID: 409867536} + - component: {fileID: 409867539} + m_Layer: 5 + m_Name: Text (TMP) + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!224 &409867535 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409867534} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 1994222726} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 1, y: 1} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0.5, y: 0.5} +--- !u!114 &409867536 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409867534} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 64cc8a40f9848a54c94bf232155b0b4f, type: 3} + m_Name: + m_EditorClassIdentifier: + database: {fileID: 11400000, guid: f0a33761ff6919d4a9979ee36980a29d, type: 2} + context: + scaleAnimations: 1 + scaleUniformly: 1 + useScaledTime: 1 + tmpAnimator: {fileID: 409867536} + updateFrom: 0 + animateOnStart: 1 + animationsOverride: 0 + defaultAnimationsStrings: [] + defaultShowAnimationsStrings: [] + defaultHideAnimationsStrings: [] + excludedCharacters: + excludedCharactersShow: + excludedCharactersHide: + excludePunctuation: 0 + excludePunctuationShow: 0 + excludePunctuationHide: 0 + sceneAnimations: + _serializedList: [] + sceneShowAnimations: + _serializedList: [] + sceneHideAnimations: + _serializedList: [] + preview: 1 + useDefaultDatabase: 1 + initDatabase: 1 + previewUpdatesPerSecond: 60 +--- !u!114 &409867537 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409867534} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: f4688fdb7df04437aeb418b961361dc5, type: 3} + m_Name: + m_EditorClassIdentifier: + m_Material: {fileID: 0} + m_Color: {r: 1, g: 1, b: 1, a: 1} + m_RaycastTarget: 1 + m_RaycastPadding: {x: 0, y: 0, z: 0, w: 0} + m_Maskable: 1 + m_OnCullStateChanged: + m_PersistentCalls: + m_Calls: [] + m_text: Lorem ipsum dolor sit amet. + m_isRightToLeft: 0 + m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2} + m_fontSharedMaterials: [] + m_fontMaterial: {fileID: 0} + m_fontMaterials: [] + m_fontColor32: + serializedVersion: 2 + rgba: 4278190080 + m_fontColor: {r: 0, g: 0, b: 0, a: 1} + m_enableVertexGradient: 0 + m_colorMode: 3 + m_fontColorGradient: + topLeft: {r: 1, g: 1, b: 1, a: 1} + topRight: {r: 1, g: 1, b: 1, a: 1} + bottomLeft: {r: 1, g: 1, b: 1, a: 1} + bottomRight: {r: 1, g: 1, b: 1, a: 1} + m_fontColorGradientPreset: {fileID: 0} + m_spriteAsset: {fileID: 0} + m_tintAllSprites: 0 + m_StyleSheet: {fileID: 0} + m_TextStyleHashCode: -1183493901 + m_overrideHtmlColors: 0 + m_faceColor: + serializedVersion: 2 + rgba: 4294967295 + m_fontSize: 36 + m_fontSizeBase: 36 + m_fontWeight: 400 + m_enableAutoSizing: 0 + m_fontSizeMin: 18 + m_fontSizeMax: 72 + m_fontStyle: 0 + m_HorizontalAlignment: 2 + m_VerticalAlignment: 512 + m_textAlignment: 65535 + m_characterSpacing: 0 + m_wordSpacing: 0 + m_lineSpacing: 0 + m_lineSpacingMax: 0 + m_paragraphSpacing: 0 + m_charWidthMaxAdj: 0 + m_enableWordWrapping: 1 + m_wordWrappingRatios: 0.4 + m_overflowMode: 0 + m_linkedTextComponent: {fileID: 0} + parentLinkedComponent: {fileID: 0} + m_enableKerning: 1 + m_enableExtraPadding: 0 + checkPaddingRequired: 0 + m_isRichText: 1 + m_parseCtrlCharacters: 1 + m_isOrthographic: 1 + m_isCullingEnabled: 0 + m_horizontalMapping: 0 + m_verticalMapping: 0 + m_uvLineOffset: 0 + m_geometrySortingOrder: 0 + m_IsTextObjectScaleStatic: 0 + m_VertexBufferAutoSizeReduction: 0 + m_useMaxVisibleDescender: 1 + m_pageToDisplay: 1 + m_margin: {x: 0, y: 0, z: 0, w: 0} + m_isUsingLegacyAnimationComponent: 0 + m_isVolumetricText: 0 + m_hasFontAssetChanged: 0 + m_baseMaterial: {fileID: 0} + m_maskOffset: {x: 0, y: 0, z: 0, w: 0} +--- !u!222 &409867538 +CanvasRenderer: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409867534} + m_CullTransparentMesh: 1 +--- !u!320 &409867539 +PlayableDirector: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 409867534} + m_Enabled: 1 + serializedVersion: 3 + m_PlayableAsset: {fileID: 11400000, guid: 382de03df39e3e24bbf6adca2f12364a, type: 2} + m_InitialState: 1 + m_WrapMode: 2 + m_DirectorUpdateMode: 1 + m_InitialTime: 0 + m_SceneBindings: + - key: {fileID: 0} + value: {fileID: 409867536} + - key: {fileID: 0} + value: {fileID: 409867536} + - key: {fileID: 0} + value: {fileID: 409867536} + - key: {fileID: 0} + value: {fileID: 409867536} + m_ExposedReferences: + m_References: + - : {fileID: 409867539} +--- !u!1 &874370643 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 874370646} + - component: {fileID: 874370645} + - component: {fileID: 874370644} + m_Layer: 0 + m_Name: EventSystem + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &874370644 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 874370643} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 4f231c4fb786f3946a6b90b886c48677, type: 3} + m_Name: + m_EditorClassIdentifier: + m_SendPointerHoverToParent: 1 + m_HorizontalAxis: Horizontal + m_VerticalAxis: Vertical + m_SubmitButton: Submit + m_CancelButton: Cancel + m_InputActionsPerSecond: 10 + m_RepeatDelay: 0.5 + m_ForceModuleActive: 0 +--- !u!114 &874370645 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 874370643} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 76c392e42b5098c458856cdf6ecaaaa1, type: 3} + m_Name: + m_EditorClassIdentifier: + m_FirstSelected: {fileID: 0} + m_sendNavigationEvents: 1 + m_DragThreshold: 10 +--- !u!4 &874370646 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 874370643} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1617959750 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1617959753} + - component: {fileID: 1617959752} + - component: {fileID: 1617959751} + m_Layer: 0 + m_Name: Main Camera + m_TagString: MainCamera + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!81 &1617959751 +AudioListener: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1617959750} + m_Enabled: 1 +--- !u!20 &1617959752 +Camera: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1617959750} + m_Enabled: 1 + serializedVersion: 2 + m_ClearFlags: 1 + m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0} + m_projectionMatrixMode: 1 + m_GateFitMode: 2 + m_FOVAxisMode: 0 + m_Iso: 200 + m_ShutterSpeed: 0.005 + m_Aperture: 16 + m_FocusDistance: 10 + m_FocalLength: 50 + m_BladeCount: 5 + m_Curvature: {x: 2, y: 11} + m_BarrelClipping: 0.25 + m_Anamorphism: 0 + m_SensorSize: {x: 36, y: 24} + m_LensShift: {x: 0, y: 0} + m_NormalizedViewPortRect: + serializedVersion: 2 + x: 0 + y: 0 + width: 1 + height: 1 + near clip plane: 0.3 + far clip plane: 1000 + field of view: 60 + orthographic: 0 + orthographic size: 5 + m_Depth: -1 + m_CullingMask: + serializedVersion: 2 + m_Bits: 4294967295 + m_RenderingPath: -1 + m_TargetTexture: {fileID: 0} + m_TargetDisplay: 0 + m_TargetEye: 3 + m_HDR: 1 + m_AllowMSAA: 1 + m_AllowDynamicResolution: 0 + m_ForceIntoRT: 0 + m_OcclusionCulling: 1 + m_StereoConvergence: 10 + m_StereoSeparation: 0.022 +--- !u!4 &1617959753 +Transform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1617959750} + serializedVersion: 2 + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 1, z: -10} + m_LocalScale: {x: 1, y: 1, z: 1} + m_ConstrainProportionsScale: 0 + m_Children: [] + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} +--- !u!1 &1994222722 +GameObject: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + serializedVersion: 6 + m_Component: + - component: {fileID: 1994222726} + - component: {fileID: 1994222725} + - component: {fileID: 1994222724} + - component: {fileID: 1994222723} + m_Layer: 5 + m_Name: Canvas + m_TagString: Untagged + m_Icon: {fileID: 0} + m_NavMeshLayer: 0 + m_StaticEditorFlags: 0 + m_IsActive: 1 +--- !u!114 &1994222723 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1994222722} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dc42784cf147c0c48a680349fa168899, type: 3} + m_Name: + m_EditorClassIdentifier: + m_IgnoreReversedGraphics: 1 + m_BlockingObjects: 0 + m_BlockingMask: + serializedVersion: 2 + m_Bits: 4294967295 +--- !u!114 &1994222724 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1994222722} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 0cd44c1031e13a943bb63640046fad76, type: 3} + m_Name: + m_EditorClassIdentifier: + m_UiScaleMode: 0 + m_ReferencePixelsPerUnit: 100 + m_ScaleFactor: 1 + m_ReferenceResolution: {x: 800, y: 600} + m_ScreenMatchMode: 0 + m_MatchWidthOrHeight: 0 + m_PhysicalUnit: 3 + m_FallbackScreenDPI: 96 + m_DefaultSpriteDPI: 96 + m_DynamicPixelsPerUnit: 1 + m_PresetInfoIsWorld: 0 +--- !u!223 &1994222725 +Canvas: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1994222722} + m_Enabled: 1 + serializedVersion: 3 + m_RenderMode: 0 + m_Camera: {fileID: 0} + m_PlaneDistance: 100 + m_PixelPerfect: 0 + m_ReceivesEvents: 1 + m_OverrideSorting: 0 + m_OverridePixelPerfect: 0 + m_SortingBucketNormalizedSize: 0 + m_VertexColorAlwaysGammaSpace: 0 + m_AdditionalShaderChannelsFlag: 25 + m_UpdateRectTransformForStandalone: 0 + m_SortingLayerID: 0 + m_SortingOrder: 0 + m_TargetDisplay: 0 +--- !u!224 &1994222726 +RectTransform: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 1994222722} + m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} + m_LocalPosition: {x: 0, y: 0, z: 0} + m_LocalScale: {x: 0, y: 0, z: 0} + m_ConstrainProportionsScale: 0 + m_Children: + - {fileID: 409867535} + m_Father: {fileID: 0} + m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0} + m_AnchorMin: {x: 0, y: 0} + m_AnchorMax: {x: 0, y: 0} + m_AnchoredPosition: {x: 0, y: 0} + m_SizeDelta: {x: 0, y: 0} + m_Pivot: {x: 0, y: 0} +--- !u!1660057539 &9223372036854775807 +SceneRoots: + m_ObjectHideFlags: 0 + m_Roots: + - {fileID: 1617959753} + - {fileID: 369384858} + - {fileID: 1994222726} + - {fileID: 874370646} diff --git a/Package/Tests/Timeline Tests/New Scene.unity.meta b/Package/Tests/Timeline Tests/New Scene.unity.meta new file mode 100644 index 0000000..f248883 --- /dev/null +++ b/Package/Tests/Timeline Tests/New Scene.unity.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: cdc87dc742e9a3644819514456ca33d9 +DefaultImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Tests/Timeline Tests/TMPEffects.Timeline.Tests.asmdef b/Package/Tests/Timeline Tests/TMPEffects.Timeline.Tests.asmdef new file mode 100644 index 0000000..41c4391 --- /dev/null +++ b/Package/Tests/Timeline Tests/TMPEffects.Timeline.Tests.asmdef @@ -0,0 +1,39 @@ +{ + "name": "TMPEffects.Timeline.Tests", + "rootNamespace": "", + "references": [ + "UnityEngine.TestRunner", + "UnityEditor.TestRunner", + "Unity.PerformanceTesting", + "Unity.PerformanceTesting.Editor", + "TMPEffects", + "Unity.TextMeshPro", + "TMPEffects.Editor", + "TMPEffects.NotifyObjectChanged", + "TMPEffects.Timeline", + "TMPEffects.Timeline.Editor", + "Unity.Timeline" + ], + "includePlatforms": [ + "Editor" + ], + "excludePlatforms": [], + "allowUnsafeCode": false, + "overrideReferences": true, + "precompiledReferences": [ + "nunit.framework.dll" + ], + "autoReferenced": false, + "defineConstraints": [ + "UNITY_INCLUDE_TESTS", + "TIMELINE_INSTALLED" + ], + "versionDefines": [ + { + "name": "com.unity.timeline", + "expression": "1.4.8", + "define": "TIMELINE_INSTALLED" + } + ], + "noEngineReferences": false +} \ No newline at end of file diff --git a/Package/Tests/Timeline Tests/TMPEffects.Timeline.Tests.asmdef.meta b/Package/Tests/Timeline Tests/TMPEffects.Timeline.Tests.asmdef.meta new file mode 100644 index 0000000..af98454 --- /dev/null +++ b/Package/Tests/Timeline Tests/TMPEffects.Timeline.Tests.asmdef.meta @@ -0,0 +1,7 @@ +fileFormatVersion: 2 +guid: ce0da319be027e443840e7cdc82850bd +AssemblyDefinitionImporter: + externalObjects: {} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Package/Tests/Timeline Tests/TestTes.cs b/Package/Tests/Timeline Tests/TestTes.cs new file mode 100644 index 0000000..6c9a1f7 --- /dev/null +++ b/Package/Tests/Timeline Tests/TestTes.cs @@ -0,0 +1,20 @@ +using System.Collections; +using NUnit.Framework; +using TMPEffects.CharacterData; +using UnityEngine; +using UnityEngine.TestTools; +using TMPro; +using TMPEffects.Components; +using UnityEditor.SceneManagement; +using UnityEngine.SceneManagement; +using TMPEffects.TextProcessing; +using TMPEffects.EffectCategories; + +public class TestTes +{ + [Test] + public void DoesThisRun() + { + Assert.IsTrue(true); + } +} \ No newline at end of file diff --git a/Package/Tests/Timeline Tests/TestTes.cs.meta b/Package/Tests/Timeline Tests/TestTes.cs.meta new file mode 100644 index 0000000..f966273 --- /dev/null +++ b/Package/Tests/Timeline Tests/TestTes.cs.meta @@ -0,0 +1,11 @@ +fileFormatVersion: 2 +guid: e75f649f4fa7aac4b93d2c418247a2b7 +MonoImporter: + externalObjects: {} + serializedVersion: 2 + defaultReferences: [] + executionOrder: 0 + icon: {instanceID: 0} + userData: + assetBundleName: + assetBundleVariant: diff --git a/Text (TMP)Timeline.playable b/Text (TMP)Timeline.playable new file mode 100644 index 0000000..b9d2c89 --- /dev/null +++ b/Text (TMP)Timeline.playable @@ -0,0 +1,1796 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &-8086330850660377698 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73fa5eac7a691b04692db83c6d3e95f3, type: 3} + m_Name: TMPMeshModifierClip + m_EditorClassIdentifier: + step: + Step: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333333 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 2.0000029 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333302 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 2 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 2 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 10, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + lastMovedEntry: 0 +--- !u!114 &-7196443449792522250 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73fa5eac7a691b04692db83c6d3e95f3, type: 3} + m_Name: TMPMeshModifierClip + m_EditorClassIdentifier: + step: + Step: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333334 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 2.9999938 + outSlope: 2.9999943 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333403 + outWeight: 0.33333397 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333397 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 1 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 2 + duration: 2.23 + useInitialModifiers: 1 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: + - eulerAngles: {x: 0, y: 0, z: 45} + pivot: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: + - eulerAngles: {x: 0, y: 0, z: 90} + pivot: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + lastMovedEntry: 0 +--- !u!114 &-6792738596265628115 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 904f8d22bfe6f2147af0c2edc5912739, type: 3} + m_Name: GenericExpors_Track0 + m_EditorClassIdentifier: + m_Version: 3 + m_AnimClip: {fileID: 0} + m_Locked: 0 + m_Muted: 0 + m_CustomPlayableFullTypename: + m_Curves: {fileID: 0} + m_Parent: {fileID: 3291300111273522079} + m_Children: [] + m_Clips: + - m_Version: 1 + m_Start: 0 + m_ClipIn: 0 + m_Asset: {fileID: -3550005046343328607} + m_Duration: 2 + m_TimeScale: 1 + m_ParentTrack: {fileID: -6792738596265628115} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0 + m_BlendOutDuration: 0 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: 0 + m_PreExtrapolationTime: 0 + m_DisplayName: TMPMeshModifierClip + - m_Version: 1 + m_Start: 2 + m_ClipIn: 0 + m_Asset: {fileID: -7196443449792522250} + m_Duration: 2.2300000190734863 + m_TimeScale: 1 + m_ParentTrack: {fileID: -6792738596265628115} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0 + m_BlendOutDuration: 0 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: Infinity + m_PreExtrapolationTime: 0 + m_DisplayName: TMPMeshModifierClip + m_Markers: + m_Objects: [] +--- !u!114 &-5486875541559576162 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73fa5eac7a691b04692db83c6d3e95f3, type: 3} + m_Name: TMPMeshModifierClip + m_EditorClassIdentifier: + step: + Step: + name: color + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333333 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 2.0000029 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333302 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 2 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 4.23 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 1 + Color: + serializedVersion: 2 + rgba: 144 + TL_Color: + Override: 1 + Color: + serializedVersion: 2 + rgba: 128 + TR_Color: + Override: 1 + Color: + serializedVersion: 2 + rgba: 128 + BR_Color: + Override: 1 + Color: + serializedVersion: 2 + rgba: 142 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + lastMovedEntry: 0 +--- !u!114 &-3550005046343328607 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73fa5eac7a691b04692db83c6d3e95f3, type: 3} + m_Name: TMPMeshModifierClip + m_EditorClassIdentifier: + step: + Step: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.013942428 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.434788 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 3.9858418 + outSlope: 3.985834 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.26909798 + outWeight: 0.26909804 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.013942499 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.434788 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 1 + exitCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.013942428 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.434788 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 3.9858418 + outSlope: 3.985834 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.26909798 + outWeight: 0.26909804 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.013942499 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.434788 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 2 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: + - eulerAngles: {x: 0, y: 0, z: 45} + pivot: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + lastMovedEntry: 0 +--- !u!114 &-1735686229069779642 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: dd98e6c9d6d2b4c4ab6eebbc5bdcad7b, type: 3} + m_Name: TMPAnimationClip + m_EditorClassIdentifier: + animation: {fileID: 11400000, guid: 506cb39d14ae32846b9f60dfd21d4bc0, type: 2} +--- !u!114 &-18508318200583952 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 73fa5eac7a691b04692db83c6d3e95f3, type: 3} + m_Name: TMPMeshModifierClip + m_EditorClassIdentifier: + step: + Step: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.333333 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 3.0000029 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.33333302 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 2.23 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 2 + duration: 2.23 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 10, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 10, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + lastMovedEntry: 0 +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: bfda56da833e2384a9677cd3c976a436, type: 3} + m_Name: Text (TMP)Timeline + m_EditorClassIdentifier: + m_Version: 0 + m_Tracks: + - {fileID: 4125820161617895964} + - {fileID: 3291300111273522079} + m_FixedDuration: 0 + m_EditorSettings: + m_Framerate: 60 + m_ScenePreview: 1 + m_DurationMode: 0 + m_MarkerTrack: {fileID: 0} +--- !u!114 &1415575920826977158 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 904f8d22bfe6f2147af0c2edc5912739, type: 3} + m_Name: GenericExpors_Track1 + m_EditorClassIdentifier: + m_Version: 3 + m_AnimClip: {fileID: 0} + m_Locked: 0 + m_Muted: 0 + m_CustomPlayableFullTypename: + m_Curves: {fileID: 0} + m_Parent: {fileID: 3291300111273522079} + m_Children: [] + m_Clips: + - m_Version: 1 + m_Start: 0 + m_ClipIn: 0 + m_Asset: {fileID: -5486875541559576162} + m_Duration: 4.230000019073486 + m_TimeScale: 1 + m_ParentTrack: {fileID: 1415575920826977158} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0 + m_BlendOutDuration: 0 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: Infinity + m_PreExtrapolationTime: 0 + m_DisplayName: TMPMeshModifierClip + m_Markers: + m_Objects: [] +--- !u!114 &3291300111273522079 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: d0fc6f5187a81dc47999eefade6f0935, type: 3} + m_Name: GenericExpors + m_EditorClassIdentifier: + m_Version: 3 + m_AnimClip: {fileID: 0} + m_Locked: 0 + m_Muted: 0 + m_CustomPlayableFullTypename: + m_Curves: {fileID: 0} + m_Parent: {fileID: 11400000} + m_Children: + - {fileID: -6792738596265628115} + - {fileID: 1415575920826977158} + - {fileID: 5417730059831875644} + m_Clips: [] + m_Markers: + m_Objects: [] +--- !u!114 &4125820161617895964 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 16049b9e5ea2f4b4a91ba13fbfd74924, type: 3} + m_Name: TMP Animator Track + m_EditorClassIdentifier: + m_Version: 3 + m_AnimClip: {fileID: 0} + m_Locked: 0 + m_Muted: 1 + m_CustomPlayableFullTypename: + m_Curves: {fileID: 0} + m_Parent: {fileID: 11400000} + m_Children: [] + m_Clips: + - m_Version: 1 + m_Start: 4.316666666666666 + m_ClipIn: 0 + m_Asset: {fileID: -1735686229069779642} + m_Duration: 5 + m_TimeScale: 1 + m_ParentTrack: {fileID: 4125820161617895964} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0 + m_BlendOutDuration: 0 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: Infinity + m_PreExtrapolationTime: 4.316666666666666 + m_DisplayName: GenericExpors + m_Markers: + m_Objects: [] +--- !u!114 &5417730059831875644 +MonoBehaviour: + m_ObjectHideFlags: 1 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 904f8d22bfe6f2147af0c2edc5912739, type: 3} + m_Name: GenericExpors_Track2 + m_EditorClassIdentifier: + m_Version: 3 + m_AnimClip: {fileID: 0} + m_Locked: 0 + m_Muted: 0 + m_CustomPlayableFullTypename: + m_Curves: {fileID: 0} + m_Parent: {fileID: 3291300111273522079} + m_Children: [] + m_Clips: + - m_Version: 1 + m_Start: 0 + m_ClipIn: 0 + m_Asset: {fileID: -8086330850660377698} + m_Duration: 2 + m_TimeScale: 1 + m_ParentTrack: {fileID: 5417730059831875644} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0 + m_BlendOutDuration: 0 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: 0 + m_PreExtrapolationTime: 0 + m_DisplayName: TMPMeshModifierClip + - m_Version: 1 + m_Start: 2 + m_ClipIn: 0 + m_Asset: {fileID: -18508318200583952} + m_Duration: 2.2300000190734863 + m_TimeScale: 1 + m_ParentTrack: {fileID: 5417730059831875644} + m_EaseInDuration: 0 + m_EaseOutDuration: 0 + m_BlendInDuration: 0 + m_BlendOutDuration: 0 + m_MixInCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_MixOutCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 1 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + - serializedVersion: 3 + time: 1 + value: 0 + inSlope: 0 + outSlope: 0 + tangentMode: 0 + weightedMode: 0 + inWeight: 0 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + m_BlendInCurveMode: 0 + m_BlendOutCurveMode: 0 + m_ExposedParameterNames: [] + m_AnimationCurves: {fileID: 0} + m_Recordable: 0 + m_PostExtrapolationMode: 0 + m_PreExtrapolationMode: 0 + m_PostExtrapolationTime: Infinity + m_PreExtrapolationTime: 0 + m_DisplayName: TMPMeshModifierClip + m_Markers: + m_Objects: [] diff --git a/new CurveShowAnimation.asset b/new CurveShowAnimation.asset new file mode 100644 index 0000000..238377b --- /dev/null +++ b/new CurveShowAnimation.asset @@ -0,0 +1,49 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 42505c55b9306ad42801e81ae3e8fd11, type: 3} + m_Name: new CurveShowAnimation + m_EditorClassIdentifier: + animation: {fileID: 11400000, guid: c9bdffa471e19f74d8eecca2e98ff7a5, type: 2} + curve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: 0.024120038 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.519568 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 4.951789 + outSlope: 4.9532685 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.22596401 + outWeight: 0.22596395 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: 0.02415099 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.51890194 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + duration: 2 diff --git a/new GenericAnimation 1.asset b/new GenericAnimation 1.asset new file mode 100644 index 0000000..f3ae730 --- /dev/null +++ b/new GenericAnimation 1.asset @@ -0,0 +1,642 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7f88d8a32ae6922429db0f721f9bcced, type: 3} + m_Name: new GenericAnimation 1 + m_EditorClassIdentifier: + MyTrack: + Clips: [] + Tracks: + Tracks: + - Clips: + - rid: 3184737065292005534 + - Clips: [] + animationSteps: + - rid: 3184737065292005527 + animationSteps2: + - rid: 3184737065292005528 + repeat: 0 + duration: 0 + references: + version: 2 + RefIds: + - rid: 3184737065292005527 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005528 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005534 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 diff --git a/new GenericAnimation 2.asset b/new GenericAnimation 2.asset new file mode 100644 index 0000000..c2d6cbc --- /dev/null +++ b/new GenericAnimation 2.asset @@ -0,0 +1,1052 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7f88d8a32ae6922429db0f721f9bcced, type: 3} + m_Name: new GenericAnimation 2 + m_EditorClassIdentifier: + MyTrack: + Clips: [] + Tracks: + Tracks: + - Clips: + - rid: 3184737065292005540 + - rid: 3184737065292005539 + - rid: 3184737065292005541 + - Clips: [] + animationSteps: + - rid: 3184737065292005537 + animationSteps2: + - rid: 3184737065292005538 + repeat: 0 + duration: 0 + references: + version: 2 + RefIds: + - rid: 3184737065292005537 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005538 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005539 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: sfdf + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005540 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: dss + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005541 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: dddd + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 diff --git a/new GenericAnimation 3.asset b/new GenericAnimation 3.asset new file mode 100644 index 0000000..a526a79 --- /dev/null +++ b/new GenericAnimation 3.asset @@ -0,0 +1,433 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7f88d8a32ae6922429db0f721f9bcced, type: 3} + m_Name: new GenericAnimation 3 + m_EditorClassIdentifier: + Tracks: + Tracks: + - Clips: + - rid: 3184737065292005568 + animationSteps: + - rid: 3184737065292005544 + repeat: 1 + duration: 1 + references: + version: 2 + RefIds: + - rid: 3184737065292005544 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005568 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: Okaythen + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 1 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 diff --git a/new GenericAnimation.asset b/new GenericAnimation.asset new file mode 100644 index 0000000..2baef34 --- /dev/null +++ b/new GenericAnimation.asset @@ -0,0 +1,1677 @@ +%YAML 1.1 +%TAG !u! tag:unity3d.com,2011: +--- !u!114 &11400000 +MonoBehaviour: + m_ObjectHideFlags: 0 + m_CorrespondingSourceObject: {fileID: 0} + m_PrefabInstance: {fileID: 0} + m_PrefabAsset: {fileID: 0} + m_GameObject: {fileID: 0} + m_Enabled: 1 + m_EditorHideFlags: 0 + m_Script: {fileID: 11500000, guid: 7f88d8a32ae6922429db0f721f9bcced, type: 3} + m_Name: new GenericAnimation + m_EditorClassIdentifier: + MyTrack: + Clips: [] + Tracks: + Tracks: + - Clips: + - rid: 3184737065292005518 + - rid: 3184737065292005519 + - rid: 3184737065292005522 + - Clips: + - rid: 3184737065292005521 + - Clips: + - rid: 3184737065292005521 + - rid: 3184737065292005523 + - rid: 3184737065292005524 + - Clips: + - rid: 3184737065292005521 + - rid: 3184737065292005523 + - rid: 3184737065292005524 + - Clips: + - rid: 3184737065292005521 + - rid: 3184737065292005523 + - rid: 3184737065292005524 + animationSteps: + - rid: 3184737065292005516 + animationSteps2: + - rid: 3184737065292005517 + repeat: 0 + duration: 0 + references: + version: 2 + RefIds: + - rid: 3184737065292005516 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005517 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005518 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005519 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005521 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005522 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005523 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + - rid: 3184737065292005524 + type: {class: AnimationStep, ns: , asm: TMPEffects} + data: + name: + animate: 1 + entryCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + entryDuration: 0 + exitCurve: + serializedVersion: 2 + m_Curve: [] + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + exitDuration: 0 + extrapolateFrom: 0 + preExtrapolation: 0 + extrapolateUntil: 0 + postExtrapolation: 0 + loops: 0 + repetitions: 0 + useWave: 0 + waveOffsetType: 0 + wave: + upPeriod: 1 + downPeriod: 1 + amplitude: 1 + velocity: 1 + upwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + downwardCurve: + serializedVersion: 2 + m_Curve: + - serializedVersion: 3 + time: 0 + value: 0 + inSlope: 0 + outSlope: -0.0012029491 + tangentMode: 0 + weightedMode: 3 + inWeight: 0 + outWeight: 0.36078 + - serializedVersion: 3 + time: 0.5 + value: 0.5 + inSlope: 1.5725082 + outSlope: 1.5733721 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.326514 + outWeight: 0.33093 + - serializedVersion: 3 + time: 1 + value: 1 + inSlope: -0.0009312395 + outSlope: 0 + tangentMode: 0 + weightedMode: 3 + inWeight: 0.358688 + outWeight: 0 + m_PreInfinity: 2 + m_PostInfinity: 2 + m_RotationOrder: 4 + crestWait: 0 + troughWait: 0 + uniformity: 1 + startTime: 0 + duration: 0 + useInitialModifiers: 0 + initModifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + modifiers: + Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + Scale: {x: 1, y: 1, z: 1} + Rotations: [] + BL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_Position: + vector: {x: 0, y: 0, z: 0} + type: 1 + BL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TL_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + TR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BR_Color: + Override: 0 + Color: + serializedVersion: 2 + rgba: 0 + BL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TL_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + TR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1 + BR_UV0: + vector: {x: 0, y: 0, z: 0} + type: 1