|
@@ -1,1901 +1,1901 @@
|
|
-using System;
|
|
+using System;
|
|
-using System.IO;
|
|
+using System.IO;
|
|
-using System.Collections.Generic;
|
|
+using System.Collections.Generic;
|
|
-using System.Linq;
|
|
+using System.Linq;
|
|
-using System.CodeDom.Compiler;
|
|
+using System.CodeDom.Compiler;
|
|
-using System.Reflection;
|
|
+using System.Reflection;
|
|
-using UnityEditor;
|
|
+using UnityEditor;
|
|
-using UnityEngine;
|
|
+using UnityEngine;
|
|
-using UnityEngine.Timeline;
|
|
+using UnityEngine.Timeline;
|
|
-
|
|
+
|
|
-public class TimelinePlayableWizard : EditorWindow
|
|
+public class TimelinePlayableWizard : EditorWindow
|
|
-{
|
|
+{
|
|
- public class Variable : IComparable
|
|
+ public class Variable : IComparable
|
|
- {
|
|
+ {
|
|
- public string name;
|
|
+ public string name;
|
|
- public UsableType usableType;
|
|
+ public UsableType usableType;
|
|
-
|
|
+
|
|
- int m_TypeIndex;
|
|
+ int m_TypeIndex;
|
|
-
|
|
+
|
|
- public Variable (string name, UsableType usableType)
|
|
+ public Variable (string name, UsableType usableType)
|
|
- {
|
|
+ {
|
|
- this.name = name;
|
|
+ this.name = name;
|
|
- this.usableType = usableType;
|
|
+ this.usableType = usableType;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public bool GUI (UsableType[] usableTypes)
|
|
+ public bool GUI (UsableType[] usableTypes)
|
|
- {
|
|
+ {
|
|
- bool removeThis = false;
|
|
+ bool removeThis = false;
|
|
- EditorGUILayout.BeginHorizontal();
|
|
+ EditorGUILayout.BeginHorizontal();
|
|
- name = EditorGUILayout.TextField(name);
|
|
+ name = EditorGUILayout.TextField(name);
|
|
- m_TypeIndex = EditorGUILayout.Popup(m_TypeIndex, UsableType.GetNamewithSortingArray (usableTypes));
|
|
+ m_TypeIndex = EditorGUILayout.Popup(m_TypeIndex, UsableType.GetNamewithSortingArray (usableTypes));
|
|
- usableType = usableTypes[m_TypeIndex];
|
|
+ usableType = usableTypes[m_TypeIndex];
|
|
- if (GUILayout.Button("Remove", GUILayout.Width(60f)))
|
|
+ if (GUILayout.Button("Remove", GUILayout.Width(60f)))
|
|
- {
|
|
+ {
|
|
- removeThis = true;
|
|
+ removeThis = true;
|
|
- }
|
|
+ }
|
|
- EditorGUILayout.EndHorizontal();
|
|
+ EditorGUILayout.EndHorizontal();
|
|
-
|
|
+
|
|
- return removeThis;
|
|
+ return removeThis;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public int CompareTo (object obj)
|
|
+ public int CompareTo (object obj)
|
|
- {
|
|
+ {
|
|
- if (obj == null)
|
|
+ if (obj == null)
|
|
- return 1;
|
|
+ return 1;
|
|
-
|
|
+
|
|
- UsableType other = (UsableType)obj;
|
|
+ UsableType other = (UsableType)obj;
|
|
-
|
|
+
|
|
- if (other == null)
|
|
+ if (other == null)
|
|
- throw new ArgumentException("This object is not a Variable.");
|
|
+ throw new ArgumentException("This object is not a Variable.");
|
|
-
|
|
+
|
|
- return name.ToLower().CompareTo(other.name.ToLower());
|
|
+ return name.ToLower().CompareTo(other.name.ToLower());
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public static UsableType[] GetUsableTypesFromVariableArray (Variable[] variables)
|
|
+ public static UsableType[] GetUsableTypesFromVariableArray (Variable[] variables)
|
|
- {
|
|
+ {
|
|
- UsableType[] usableTypes = new UsableType[variables.Length];
|
|
+ UsableType[] usableTypes = new UsableType[variables.Length];
|
|
- for (int i = 0; i < usableTypes.Length; i++)
|
|
+ for (int i = 0; i < usableTypes.Length; i++)
|
|
- {
|
|
+ {
|
|
- usableTypes[i] = variables[i].usableType;
|
|
+ usableTypes[i] = variables[i].usableType;
|
|
- }
|
|
+ }
|
|
- return usableTypes;
|
|
+ return usableTypes;
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- public class UsableType : IComparable
|
|
+ public class UsableType : IComparable
|
|
- {
|
|
+ {
|
|
- public readonly string name;
|
|
+ public readonly string name;
|
|
- public readonly string nameWithSorting;
|
|
+ public readonly string nameWithSorting;
|
|
- public readonly string additionalNamespace;
|
|
+ public readonly string additionalNamespace;
|
|
- public readonly GUIContent guiContentWithSorting;
|
|
+ public readonly GUIContent guiContentWithSorting;
|
|
- public readonly Type type;
|
|
+ public readonly Type type;
|
|
-
|
|
+
|
|
- public readonly string[] unrequiredNamespaces =
|
|
+ public readonly string[] unrequiredNamespaces =
|
|
- {
|
|
+ {
|
|
- "UnityEngine",
|
|
+ "UnityEngine",
|
|
- "UnityEngine.Timeline",
|
|
+ "UnityEngine.Timeline",
|
|
- "UnityEngine.Playables"
|
|
+ "UnityEngine.Playables"
|
|
- };
|
|
+ };
|
|
- public const string blankAdditionalNamespace = "";
|
|
+ public const string blankAdditionalNamespace = "";
|
|
-
|
|
+
|
|
- const string k_NameForNullType = "None";
|
|
+ const string k_NameForNullType = "None";
|
|
-
|
|
+
|
|
- public UsableType (Type usableType)
|
|
+ public UsableType (Type usableType)
|
|
- {
|
|
+ {
|
|
- type = usableType;
|
|
+ type = usableType;
|
|
-
|
|
+
|
|
- if (type != null)
|
|
+ if (type != null)
|
|
- {
|
|
+ {
|
|
- name = usableType.Name;
|
|
+ name = usableType.Name;
|
|
- nameWithSorting = name.ToUpper ()[0] + "/" + name;
|
|
+ nameWithSorting = name.ToUpper ()[0] + "/" + name;
|
|
- additionalNamespace = unrequiredNamespaces.All (t => usableType.Namespace != t) ? usableType.Namespace : blankAdditionalNamespace;
|
|
+ additionalNamespace = unrequiredNamespaces.All (t => usableType.Namespace != t) ? usableType.Namespace : blankAdditionalNamespace;
|
|
- }
|
|
+ }
|
|
- else
|
|
+ else
|
|
- {
|
|
+ {
|
|
- name = k_NameForNullType;
|
|
+ name = k_NameForNullType;
|
|
- nameWithSorting = k_NameForNullType;
|
|
+ nameWithSorting = k_NameForNullType;
|
|
- additionalNamespace = blankAdditionalNamespace;
|
|
+ additionalNamespace = blankAdditionalNamespace;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- guiContentWithSorting = new GUIContent(nameWithSorting);
|
|
+ guiContentWithSorting = new GUIContent(nameWithSorting);
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public UsableType (string name)
|
|
+ public UsableType (string name)
|
|
- {
|
|
+ {
|
|
- this.name = name;
|
|
+ this.name = name;
|
|
- nameWithSorting = name.ToUpper()[0] + "/" + name;
|
|
+ nameWithSorting = name.ToUpper()[0] + "/" + name;
|
|
- additionalNamespace = blankAdditionalNamespace;
|
|
+ additionalNamespace = blankAdditionalNamespace;
|
|
- guiContentWithSorting = new GUIContent(nameWithSorting);
|
|
+ guiContentWithSorting = new GUIContent(nameWithSorting);
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public int CompareTo (object obj)
|
|
+ public int CompareTo (object obj)
|
|
- {
|
|
+ {
|
|
- if (obj == null)
|
|
+ if (obj == null)
|
|
- return 1;
|
|
+ return 1;
|
|
-
|
|
+
|
|
- UsableType other = (UsableType)obj;
|
|
+ UsableType other = (UsableType)obj;
|
|
-
|
|
+
|
|
- if(other == null)
|
|
+ if(other == null)
|
|
- throw new ArgumentException("This object is not a UsableType.");
|
|
+ throw new ArgumentException("This object is not a UsableType.");
|
|
-
|
|
+
|
|
- return name.ToLower().CompareTo (other.name.ToLower());
|
|
+ return name.ToLower().CompareTo (other.name.ToLower());
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public static UsableType[] GetUsableTypeArray (Type[] types, params UsableType[] additionalUsableTypes)
|
|
+ public static UsableType[] GetUsableTypeArray (Type[] types, params UsableType[] additionalUsableTypes)
|
|
- {
|
|
+ {
|
|
- List<UsableType> usableTypeList = new List<UsableType> ();
|
|
+ List<UsableType> usableTypeList = new List<UsableType> ();
|
|
- for (int i = 0; i < types.Length; i++)
|
|
+ for (int i = 0; i < types.Length; i++)
|
|
- {
|
|
+ {
|
|
- usableTypeList.Add (new UsableType (types[i]));
|
|
+ usableTypeList.Add (new UsableType (types[i]));
|
|
- }
|
|
+ }
|
|
- usableTypeList.AddRange (additionalUsableTypes);
|
|
+ usableTypeList.AddRange (additionalUsableTypes);
|
|
- return usableTypeList.ToArray ();
|
|
+ return usableTypeList.ToArray ();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public static UsableType[] AmalgamateUsableTypes (UsableType[] usableTypeArray, params UsableType[] usableTypes)
|
|
+ public static UsableType[] AmalgamateUsableTypes (UsableType[] usableTypeArray, params UsableType[] usableTypes)
|
|
- {
|
|
+ {
|
|
- List<UsableType> usableTypeList = new List<UsableType> ();
|
|
+ List<UsableType> usableTypeList = new List<UsableType> ();
|
|
- for (int i = 0; i < usableTypes.Length; i++)
|
|
+ for (int i = 0; i < usableTypes.Length; i++)
|
|
- {
|
|
+ {
|
|
- usableTypeList.Add (usableTypes[i]);
|
|
+ usableTypeList.Add (usableTypes[i]);
|
|
- }
|
|
+ }
|
|
- usableTypeList.AddRange(usableTypeArray);
|
|
+ usableTypeList.AddRange(usableTypeArray);
|
|
- return usableTypeList.ToArray();
|
|
+ return usableTypeList.ToArray();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public static string[] GetNamewithSortingArray(UsableType[] usableTypes)
|
|
+ public static string[] GetNamewithSortingArray(UsableType[] usableTypes)
|
|
- {
|
|
+ {
|
|
- if (usableTypes == null || usableTypes.Length == 0)
|
|
+ if (usableTypes == null || usableTypes.Length == 0)
|
|
- return new string[0];
|
|
+ return new string[0];
|
|
-
|
|
+
|
|
- string[] displayNames = new string[usableTypes.Length];
|
|
+ string[] displayNames = new string[usableTypes.Length];
|
|
- for (int i = 0; i < displayNames.Length; i++)
|
|
+ for (int i = 0; i < displayNames.Length; i++)
|
|
- {
|
|
+ {
|
|
- displayNames[i] = usableTypes[i].nameWithSorting;
|
|
+ displayNames[i] = usableTypes[i].nameWithSorting;
|
|
- }
|
|
+ }
|
|
- return displayNames;
|
|
+ return displayNames;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public static GUIContent[] GetGUIContentWithSortingArray (UsableType[] usableTypes)
|
|
+ public static GUIContent[] GetGUIContentWithSortingArray (UsableType[] usableTypes)
|
|
- {
|
|
+ {
|
|
- if(usableTypes == null || usableTypes.Length == 0)
|
|
+ if(usableTypes == null || usableTypes.Length == 0)
|
|
- return new GUIContent[0];
|
|
+ return new GUIContent[0];
|
|
-
|
|
+
|
|
- GUIContent[] guiContents = new GUIContent[usableTypes.Length];
|
|
+ GUIContent[] guiContents = new GUIContent[usableTypes.Length];
|
|
- for (int i = 0; i < guiContents.Length; i++)
|
|
+ for (int i = 0; i < guiContents.Length; i++)
|
|
- {
|
|
+ {
|
|
- guiContents[i] = usableTypes[i].guiContentWithSorting;
|
|
+ guiContents[i] = usableTypes[i].guiContentWithSorting;
|
|
- }
|
|
+ }
|
|
- return guiContents;
|
|
+ return guiContents;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public static string[] GetDistinctAdditionalNamespaces (UsableType[] usableTypes)
|
|
+ public static string[] GetDistinctAdditionalNamespaces (UsableType[] usableTypes)
|
|
- {
|
|
+ {
|
|
- if (usableTypes == null || usableTypes.Length == 0)
|
|
+ if (usableTypes == null || usableTypes.Length == 0)
|
|
- return new string[0];
|
|
+ return new string[0];
|
|
-
|
|
+
|
|
- string[] namespaceArray = new string[usableTypes.Length];
|
|
+ string[] namespaceArray = new string[usableTypes.Length];
|
|
- for (int i = 0; i < namespaceArray.Length; i++)
|
|
+ for (int i = 0; i < namespaceArray.Length; i++)
|
|
- {
|
|
+ {
|
|
- namespaceArray[i] = usableTypes[i].additionalNamespace;
|
|
+ namespaceArray[i] = usableTypes[i].additionalNamespace;
|
|
- }
|
|
+ }
|
|
- return namespaceArray.Distinct().ToArray();
|
|
+ return namespaceArray.Distinct().ToArray();
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- public class UsableProperty : IComparable
|
|
+ public class UsableProperty : IComparable
|
|
- {
|
|
+ {
|
|
- public enum Usability
|
|
+ public enum Usability
|
|
- {
|
|
+ {
|
|
- Blendable, Assignable, Not
|
|
+ Blendable, Assignable, Not
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public enum UsablePropertyType
|
|
+ public enum UsablePropertyType
|
|
- {
|
|
+ {
|
|
- Property, Field
|
|
+ Property, Field
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public string type;
|
|
+ public string type;
|
|
- public string name;
|
|
+ public string name;
|
|
- public string defaultValue;
|
|
+ public string defaultValue;
|
|
- public Usability usability;
|
|
+ public Usability usability;
|
|
- public UsablePropertyType usablePropertyType;
|
|
+ public UsablePropertyType usablePropertyType;
|
|
- public PropertyInfo propertyInfo;
|
|
+ public PropertyInfo propertyInfo;
|
|
- public FieldInfo fieldInfo;
|
|
+ public FieldInfo fieldInfo;
|
|
-
|
|
+
|
|
- int m_TypeIndex;
|
|
+ int m_TypeIndex;
|
|
-
|
|
+
|
|
- public string NameWithCaptial
|
|
+ public string NameWithCaptial
|
|
- {
|
|
+ {
|
|
- get { return name.First().ToString().ToUpper() + name.Substring(1); }
|
|
+ get { return name.First().ToString().ToUpper() + name.Substring(1); }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public string NameAsPrivate
|
|
+ public string NameAsPrivate
|
|
- {
|
|
+ {
|
|
- get { return "m_" + NameWithCaptial; }
|
|
+ get { return "m_" + NameWithCaptial; }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public string NameAsPrivateDefault
|
|
+ public string NameAsPrivateDefault
|
|
- {
|
|
+ {
|
|
- get { return "m_Default" + NameWithCaptial; }
|
|
+ get { return "m_Default" + NameWithCaptial; }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public string NameAsPrivateAssigned
|
|
+ public string NameAsPrivateAssigned
|
|
- {
|
|
+ {
|
|
- get { return "m_Assigned" + NameWithCaptial; }
|
|
+ get { return "m_Assigned" + NameWithCaptial; }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public string NameAsLocalBlended
|
|
+ public string NameAsLocalBlended
|
|
- {
|
|
+ {
|
|
- get { return "blended" + NameWithCaptial; }
|
|
+ get { return "blended" + NameWithCaptial; }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public string NameAsLocalSerializedProperty
|
|
+ public string NameAsLocalSerializedProperty
|
|
- {
|
|
+ {
|
|
- get { return name + "Prop"; }
|
|
+ get { return name + "Prop"; }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public UsableProperty (PropertyInfo propertyInfo)
|
|
+ public UsableProperty (PropertyInfo propertyInfo)
|
|
- {
|
|
+ {
|
|
- usablePropertyType = UsablePropertyType.Property;
|
|
+ usablePropertyType = UsablePropertyType.Property;
|
|
- this.propertyInfo = propertyInfo;
|
|
+ this.propertyInfo = propertyInfo;
|
|
-
|
|
+
|
|
- if (propertyInfo.PropertyType.Name == "Single")
|
|
+ if (propertyInfo.PropertyType.Name == "Single")
|
|
- type = "float";
|
|
+ type = "float";
|
|
- else if (propertyInfo.PropertyType.Name == "Int32")
|
|
+ else if (propertyInfo.PropertyType.Name == "Int32")
|
|
- type = "int";
|
|
+ type = "int";
|
|
- else if (propertyInfo.PropertyType.Name == "Double")
|
|
+ else if (propertyInfo.PropertyType.Name == "Double")
|
|
- type = "double";
|
|
+ type = "double";
|
|
- else if (propertyInfo.PropertyType.Name == "Boolean")
|
|
+ else if (propertyInfo.PropertyType.Name == "Boolean")
|
|
- type = "bool";
|
|
+ type = "bool";
|
|
- else if (propertyInfo.PropertyType.Name == "String")
|
|
+ else if (propertyInfo.PropertyType.Name == "String")
|
|
- type = "string";
|
|
+ type = "string";
|
|
- else
|
|
+ else
|
|
- type = propertyInfo.PropertyType.Name;
|
|
+ type = propertyInfo.PropertyType.Name;
|
|
-
|
|
+
|
|
- name = propertyInfo.Name;
|
|
+ name = propertyInfo.Name;
|
|
-
|
|
+
|
|
- if (IsTypeBlendable(propertyInfo.PropertyType))
|
|
+ if (IsTypeBlendable(propertyInfo.PropertyType))
|
|
- usability = Usability.Blendable;
|
|
+ usability = Usability.Blendable;
|
|
- else if (IsTypeAssignable(propertyInfo.PropertyType))
|
|
+ else if (IsTypeAssignable(propertyInfo.PropertyType))
|
|
- usability = Usability.Assignable;
|
|
+ usability = Usability.Assignable;
|
|
- else
|
|
+ else
|
|
- usability = Usability.Not;
|
|
+ usability = Usability.Not;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public UsableProperty (FieldInfo fieldInfo)
|
|
+ public UsableProperty (FieldInfo fieldInfo)
|
|
- {
|
|
+ {
|
|
- usablePropertyType = UsablePropertyType.Field;
|
|
+ usablePropertyType = UsablePropertyType.Field;
|
|
- this.fieldInfo = fieldInfo;
|
|
+ this.fieldInfo = fieldInfo;
|
|
-
|
|
+
|
|
- if (fieldInfo.FieldType.Name == "Single")
|
|
+ if (fieldInfo.FieldType.Name == "Single")
|
|
- type = "float";
|
|
+ type = "float";
|
|
- else if (fieldInfo.FieldType.Name == "Int32")
|
|
+ else if (fieldInfo.FieldType.Name == "Int32")
|
|
- type = "int";
|
|
+ type = "int";
|
|
- else if (fieldInfo.FieldType.Name == "Double")
|
|
+ else if (fieldInfo.FieldType.Name == "Double")
|
|
- type = "double";
|
|
+ type = "double";
|
|
- else if (fieldInfo.FieldType.Name == "Boolean")
|
|
+ else if (fieldInfo.FieldType.Name == "Boolean")
|
|
- type = "bool";
|
|
+ type = "bool";
|
|
- else if (fieldInfo.FieldType.Name == "String")
|
|
+ else if (fieldInfo.FieldType.Name == "String")
|
|
- type = "string";
|
|
+ type = "string";
|
|
- else
|
|
+ else
|
|
- type = fieldInfo.FieldType.Name;
|
|
+ type = fieldInfo.FieldType.Name;
|
|
-
|
|
+
|
|
- name = fieldInfo.Name;
|
|
+ name = fieldInfo.Name;
|
|
-
|
|
+
|
|
- if (IsTypeBlendable(fieldInfo.FieldType))
|
|
+ if (IsTypeBlendable(fieldInfo.FieldType))
|
|
- usability = Usability.Blendable;
|
|
+ usability = Usability.Blendable;
|
|
- else if (IsTypeAssignable(fieldInfo.FieldType))
|
|
+ else if (IsTypeAssignable(fieldInfo.FieldType))
|
|
- usability = Usability.Assignable;
|
|
+ usability = Usability.Assignable;
|
|
- else
|
|
+ else
|
|
- usability = Usability.Not;
|
|
+ usability = Usability.Not;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public string ZeroValueAsString ()
|
|
+ public string ZeroValueAsString ()
|
|
- {
|
|
+ {
|
|
- if(usability != Usability.Blendable)
|
|
+ if(usability != Usability.Blendable)
|
|
- throw new UnityException("UsableType is not blendable, shouldn't be looking for zero value as string.");
|
|
+ throw new UnityException("UsableType is not blendable, shouldn't be looking for zero value as string.");
|
|
-
|
|
+
|
|
- switch (type)
|
|
+ switch (type)
|
|
- {
|
|
+ {
|
|
- case "float":
|
|
+ case "float":
|
|
- return "0f";
|
|
+ return "0f";
|
|
- case "int":
|
|
+ case "int":
|
|
- return "0";
|
|
+ return "0";
|
|
- case "double":
|
|
+ case "double":
|
|
- return "0.0";
|
|
+ return "0.0";
|
|
- case "Vector2":
|
|
+ case "Vector2":
|
|
- return "Vector2.zero";
|
|
+ return "Vector2.zero";
|
|
- case "Vector3":
|
|
+ case "Vector3":
|
|
- return "Vector3.zero";
|
|
+ return "Vector3.zero";
|
|
- case "Color":
|
|
+ case "Color":
|
|
- return "Color.clear";
|
|
+ return "Color.clear";
|
|
- }
|
|
+ }
|
|
- return "";
|
|
+ return "";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public void CreateSettingDefaultValueString (Component defaultValuesComponent)
|
|
+ public void CreateSettingDefaultValueString (Component defaultValuesComponent)
|
|
- {
|
|
+ {
|
|
- if (defaultValuesComponent == null)
|
|
+ if (defaultValuesComponent == null)
|
|
- {
|
|
+ {
|
|
- defaultValue = "";
|
|
+ defaultValue = "";
|
|
- return;
|
|
+ return;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- object defaultValueObj = usablePropertyType == UsablePropertyType.Property ? propertyInfo.GetValue (defaultValuesComponent, null) : fieldInfo.GetValue (defaultValuesComponent);
|
|
+ object defaultValueObj = usablePropertyType == UsablePropertyType.Property ? propertyInfo.GetValue (defaultValuesComponent, null) : fieldInfo.GetValue (defaultValuesComponent);
|
|
-
|
|
+
|
|
- switch (type)
|
|
+ switch (type)
|
|
- {
|
|
+ {
|
|
- case "float":
|
|
+ case "float":
|
|
- float defaultFloatValue = (float)defaultValueObj;
|
|
+ float defaultFloatValue = (float)defaultValueObj;
|
|
- defaultValue = defaultFloatValue + "f";
|
|
+ defaultValue = defaultFloatValue + "f";
|
|
- break;
|
|
+ break;
|
|
- case "int":
|
|
+ case "int":
|
|
- int defaultIntValue = (int)defaultValueObj;
|
|
+ int defaultIntValue = (int)defaultValueObj;
|
|
- defaultValue = defaultIntValue.ToString();
|
|
+ defaultValue = defaultIntValue.ToString();
|
|
- break;
|
|
+ break;
|
|
- case "double":
|
|
+ case "double":
|
|
- double defaultDoubleValue = (double)defaultValueObj;
|
|
+ double defaultDoubleValue = (double)defaultValueObj;
|
|
- defaultValue = defaultDoubleValue.ToString();
|
|
+ defaultValue = defaultDoubleValue.ToString();
|
|
- break;
|
|
+ break;
|
|
- case "Vector2":
|
|
+ case "Vector2":
|
|
- Vector2 defaultVector2Value = (Vector2)defaultValueObj;
|
|
+ Vector2 defaultVector2Value = (Vector2)defaultValueObj;
|
|
- defaultValue = "new Vector2(" + defaultVector2Value.x + "f, " + defaultVector2Value.y + "f)";
|
|
+ defaultValue = "new Vector2(" + defaultVector2Value.x + "f, " + defaultVector2Value.y + "f)";
|
|
- break;
|
|
+ break;
|
|
- case "Vector3":
|
|
+ case "Vector3":
|
|
- Vector3 defaultVector3Value = (Vector3)defaultValueObj;
|
|
+ Vector3 defaultVector3Value = (Vector3)defaultValueObj;
|
|
- defaultValue = "new Vector3(" + defaultVector3Value.x + "f, " + defaultVector3Value.y + "f, " + defaultVector3Value.z + "f)";
|
|
+ defaultValue = "new Vector3(" + defaultVector3Value.x + "f, " + defaultVector3Value.y + "f, " + defaultVector3Value.z + "f)";
|
|
- break;
|
|
+ break;
|
|
- case "Color":
|
|
+ case "Color":
|
|
- Color defaultColorValue = (Color)defaultValueObj;
|
|
+ Color defaultColorValue = (Color)defaultValueObj;
|
|
- defaultValue = "new Color(" + defaultColorValue.r + "f, " + defaultColorValue.g + "f, " + defaultColorValue.b + "f, " + defaultColorValue.a + "f)";
|
|
+ defaultValue = "new Color(" + defaultColorValue.r + "f, " + defaultColorValue.g + "f, " + defaultColorValue.b + "f, " + defaultColorValue.a + "f)";
|
|
- break;
|
|
+ break;
|
|
- case "string":
|
|
+ case "string":
|
|
- defaultValue = "\"" + defaultValueObj + "\"";
|
|
+ defaultValue = "\"" + defaultValueObj + "\"";
|
|
- break;
|
|
+ break;
|
|
- case "bool":
|
|
+ case "bool":
|
|
- bool defaultBoolValue = (bool)defaultValueObj;
|
|
+ bool defaultBoolValue = (bool)defaultValueObj;
|
|
- defaultValue = defaultBoolValue.ToString ().ToLower();
|
|
+ defaultValue = defaultBoolValue.ToString ().ToLower();
|
|
- break;
|
|
+ break;
|
|
- default:
|
|
+ default:
|
|
- Enum defaultEnumValue = (Enum)defaultValueObj;
|
|
+ Enum defaultEnumValue = (Enum)defaultValueObj;
|
|
- Type enumSystemType = defaultEnumValue.GetType ();
|
|
+ Type enumSystemType = defaultEnumValue.GetType ();
|
|
- string[] splits = enumSystemType.ToString().Split('+');
|
|
+ string[] splits = enumSystemType.ToString().Split('+');
|
|
- string enumType = splits[splits.Length - 1];
|
|
+ string enumType = splits[splits.Length - 1];
|
|
- string enumConstantName = Enum.GetName (enumSystemType, defaultEnumValue);
|
|
+ string enumConstantName = Enum.GetName (enumSystemType, defaultEnumValue);
|
|
- defaultValue = enumType + "." + enumConstantName;
|
|
+ defaultValue = enumType + "." + enumConstantName;
|
|
- break;
|
|
+ break;
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public bool GUI (List<UsableProperty> allUsableProperties)
|
|
+ public bool GUI (List<UsableProperty> allUsableProperties)
|
|
- {
|
|
+ {
|
|
- bool removeThis = false;
|
|
+ bool removeThis = false;
|
|
- EditorGUILayout.BeginHorizontal();
|
|
+ EditorGUILayout.BeginHorizontal();
|
|
- m_TypeIndex = EditorGUILayout.Popup(m_TypeIndex, GetNameWithSortingArray (allUsableProperties));
|
|
+ m_TypeIndex = EditorGUILayout.Popup(m_TypeIndex, GetNameWithSortingArray (allUsableProperties));
|
|
- type = allUsableProperties[m_TypeIndex].type;
|
|
+ type = allUsableProperties[m_TypeIndex].type;
|
|
- name = allUsableProperties[m_TypeIndex].name;
|
|
+ name = allUsableProperties[m_TypeIndex].name;
|
|
- usablePropertyType = allUsableProperties[m_TypeIndex].usablePropertyType;
|
|
+ usablePropertyType = allUsableProperties[m_TypeIndex].usablePropertyType;
|
|
- propertyInfo = allUsableProperties[m_TypeIndex].propertyInfo;
|
|
+ propertyInfo = allUsableProperties[m_TypeIndex].propertyInfo;
|
|
- fieldInfo = allUsableProperties[m_TypeIndex].fieldInfo;
|
|
+ fieldInfo = allUsableProperties[m_TypeIndex].fieldInfo;
|
|
- usability = allUsableProperties[m_TypeIndex].usability;
|
|
+ usability = allUsableProperties[m_TypeIndex].usability;
|
|
- if (GUILayout.Button("Remove", GUILayout.Width(60f)))
|
|
+ if (GUILayout.Button("Remove", GUILayout.Width(60f)))
|
|
- {
|
|
+ {
|
|
- removeThis = true;
|
|
+ removeThis = true;
|
|
- }
|
|
+ }
|
|
- EditorGUILayout.EndHorizontal();
|
|
+ EditorGUILayout.EndHorizontal();
|
|
- return removeThis;
|
|
+ return removeThis;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public int CompareTo(object obj)
|
|
+ public int CompareTo(object obj)
|
|
- {
|
|
+ {
|
|
- if (obj == null)
|
|
+ if (obj == null)
|
|
- return 1;
|
|
+ return 1;
|
|
-
|
|
+
|
|
- UsableType other = (UsableType)obj;
|
|
+ UsableType other = (UsableType)obj;
|
|
-
|
|
+
|
|
- if (other == null)
|
|
+ if (other == null)
|
|
- throw new ArgumentException("This object is not a UsableProperty.");
|
|
+ throw new ArgumentException("This object is not a UsableProperty.");
|
|
-
|
|
+
|
|
- return name.ToLower().CompareTo(other.name.ToLower());
|
|
+ return name.ToLower().CompareTo(other.name.ToLower());
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public static string[] GetNameWithSortingArray (List<UsableProperty> usableProperties)
|
|
+ public static string[] GetNameWithSortingArray (List<UsableProperty> usableProperties)
|
|
- {
|
|
+ {
|
|
- string[] returnVal = new string[usableProperties.Count];
|
|
+ string[] returnVal = new string[usableProperties.Count];
|
|
- for (int i = 0; i < returnVal.Length; i++)
|
|
+ for (int i = 0; i < returnVal.Length; i++)
|
|
- {
|
|
+ {
|
|
- returnVal[i] = usableProperties[i].name;
|
|
+ returnVal[i] = usableProperties[i].name;
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public UsableProperty GetDuplicate ()
|
|
+ public UsableProperty GetDuplicate ()
|
|
- {
|
|
+ {
|
|
- UsableProperty duplicate = usablePropertyType == UsablePropertyType.Property ? new UsableProperty (propertyInfo) : new UsableProperty (fieldInfo);
|
|
+ UsableProperty duplicate = usablePropertyType == UsablePropertyType.Property ? new UsableProperty (propertyInfo) : new UsableProperty (fieldInfo);
|
|
- duplicate.defaultValue = defaultValue;
|
|
+ duplicate.defaultValue = defaultValue;
|
|
- return duplicate;
|
|
+ return duplicate;
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- public enum CreationError
|
|
+ public enum CreationError
|
|
- {
|
|
+ {
|
|
- NoError,
|
|
+ NoError,
|
|
- PlayableAssetAlreadyExists,
|
|
+ PlayableAssetAlreadyExists,
|
|
- PlayableBehaviourAlreadyExists,
|
|
+ PlayableBehaviourAlreadyExists,
|
|
- PlayableBehaviourMixerAlreadyExists,
|
|
+ PlayableBehaviourMixerAlreadyExists,
|
|
- TrackAssetAlreadyExists,
|
|
+ TrackAssetAlreadyExists,
|
|
- PlayableDrawerAlreadyExists,
|
|
+ PlayableDrawerAlreadyExists,
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- public bool showHelpBoxes = true;
|
|
+ public bool showHelpBoxes = true;
|
|
- public string playableName = "";
|
|
+ public string playableName = "";
|
|
- public bool isStandardBlendPlayable;
|
|
+ public bool isStandardBlendPlayable;
|
|
- public UsableType trackBinding;
|
|
+ public UsableType trackBinding;
|
|
- public Component defaultValuesComponent;
|
|
+ public Component defaultValuesComponent;
|
|
- public List<Variable> exposedReferences = new List<Variable> ();
|
|
+ public List<Variable> exposedReferences = new List<Variable> ();
|
|
- public List<Variable> playableBehaviourVariables = new List<Variable> ();
|
|
+ public List<Variable> playableBehaviourVariables = new List<Variable> ();
|
|
- public List<UsableProperty> standardBlendPlayableProperties = new List<UsableProperty> ();
|
|
+ public List<UsableProperty> standardBlendPlayableProperties = new List<UsableProperty> ();
|
|
- public ClipCaps clipCaps;
|
|
+ public ClipCaps clipCaps;
|
|
-
|
|
+
|
|
- public float clipDefaultDurationSeconds = 5f;
|
|
+ public float clipDefaultDurationSeconds = 5f;
|
|
- public float clipDefaultEaseInSeconds;
|
|
+ public float clipDefaultEaseInSeconds;
|
|
- public float clipDefaultEaseOutSeconds;
|
|
+ public float clipDefaultEaseOutSeconds;
|
|
- public float clipDefaultClipInSeconds;
|
|
+ public float clipDefaultClipInSeconds;
|
|
- public float clipDefaultSpeedMultiplier = 1f;*/
|
|
+ public float clipDefaultSpeedMultiplier = 1f;*/
|
|
- public Color trackColor = new Color(0.855f, 0.8623f, 0.870f);
|
|
+ public Color trackColor = new Color(0.855f, 0.8623f, 0.870f);
|
|
-
|
|
+
|
|
- int m_TrackBindingTypeIndex;
|
|
+ int m_TrackBindingTypeIndex;
|
|
- int m_ComponentBindingTypeIndex;
|
|
+ int m_ComponentBindingTypeIndex;
|
|
- PropertyInfo[] m_TrackBindingProperties;
|
|
+ PropertyInfo[] m_TrackBindingProperties;
|
|
- FieldInfo[] m_TrackBindingFields;
|
|
+ FieldInfo[] m_TrackBindingFields;
|
|
- List<UsableProperty> m_TrackBindingUsableProperties = new List<UsableProperty> ();
|
|
+ List<UsableProperty> m_TrackBindingUsableProperties = new List<UsableProperty> ();
|
|
- bool m_CreateDrawer;
|
|
+ bool m_CreateDrawer;
|
|
- bool m_CreateButtonPressed;
|
|
+ bool m_CreateButtonPressed;
|
|
- Vector2 m_ScrollViewPos;
|
|
+ Vector2 m_ScrollViewPos;
|
|
- CreationError m_CreationError;
|
|
+ CreationError m_CreationError;
|
|
-
|
|
+
|
|
- readonly GUIContent m_ShowHelpBoxesContent = new GUIContent("Show Help", "Do you want to see the help boxes as part of this wizard?");
|
|
+ readonly GUIContent m_ShowHelpBoxesContent = new GUIContent("Show Help", "Do you want to see the help boxes as part of this wizard?");
|
|
- readonly GUIContent m_PlayableNameContent = new GUIContent("Playable Name", "This is the name that will represent the playable. E.G. TransformTween. It will be the basis for the class names so it is best not to use the postfixes: 'Clip', 'Behaviour', 'MixerBehaviour' or 'Drawer'.");
|
|
+ readonly GUIContent m_PlayableNameContent = new GUIContent("Playable Name", "This is the name that will represent the playable. E.G. TransformTween. It will be the basis for the class names so it is best not to use the postfixes: 'Clip', 'Behaviour', 'MixerBehaviour' or 'Drawer'.");
|
|
- readonly GUIContent m_StandardBlendPlayableContent = new GUIContent("Standard Blend Playable", "Often when creating a playable it's intended purpose is just to briefly override the properties of a component for the playable's duration and then blend back to the defaults. For example a playable that changes the color of a Light but changes it back. To make a playable with this functionality, check this box.");
|
|
+ readonly GUIContent m_StandardBlendPlayableContent = new GUIContent("Standard Blend Playable", "Often when creating a playable it's intended purpose is just to briefly override the properties of a component for the playable's duration and then blend back to the defaults. For example a playable that changes the color of a Light but changes it back. To make a playable with this functionality, check this box.");
|
|
- readonly GUIContent m_TrackBindingTypeContent = new GUIContent("Track Binding Type", "This is the type of object the Playable will affect. E.G. To affect the position choose Transform.");
|
|
+ readonly GUIContent m_TrackBindingTypeContent = new GUIContent("Track Binding Type", "This is the type of object the Playable will affect. E.G. To affect the position choose Transform.");
|
|
- readonly GUIContent m_DefaultValuesComponentContent = new GUIContent("Default Values", "When the scripts are created, each of the selected properties are assigned a default from the selected Component. If this is left blank no defaults will be used.");
|
|
+ readonly GUIContent m_DefaultValuesComponentContent = new GUIContent("Default Values", "When the scripts are created, each of the selected properties are assigned a default from the selected Component. If this is left blank no defaults will be used.");
|
|
- readonly GUIContent m_ExposedReferencesContent = new GUIContent("Exposed References", "Exposed References are references to objects in a scene that your Playable needs. For example, if you want to tween between two Transforms, they will need to be Exposed References.");
|
|
+ readonly GUIContent m_ExposedReferencesContent = new GUIContent("Exposed References", "Exposed References are references to objects in a scene that your Playable needs. For example, if you want to tween between two Transforms, they will need to be Exposed References.");
|
|
- readonly GUIContent m_BehaviourVariablesContent = new GUIContent("Behaviour Variables", "Behaviour Variables are all the variables you wish to use in your playable that do NOT need a reference to something in a scene. For example a float for speed.");
|
|
+ readonly GUIContent m_BehaviourVariablesContent = new GUIContent("Behaviour Variables", "Behaviour Variables are all the variables you wish to use in your playable that do NOT need a reference to something in a scene. For example a float for speed.");
|
|
- readonly GUIContent m_TrackColorContent = new GUIContent("Track Color", "Timeline tracks have a colored outline, use this to select that color for your track.");
|
|
+ readonly GUIContent m_TrackColorContent = new GUIContent("Track Color", "Timeline tracks have a colored outline, use this to select that color for your track.");
|
|
- readonly GUIContent m_CreateDrawerContent = new GUIContent("Create Drawer?", "Checking this box will enable the creation of a PropertyDrawer for your playable. Having this script will make it easier to customise how your playable appears in the inspector.");
|
|
+ readonly GUIContent m_CreateDrawerContent = new GUIContent("Create Drawer?", "Checking this box will enable the creation of a PropertyDrawer for your playable. Having this script will make it easier to customise how your playable appears in the inspector.");
|
|
- readonly GUIContent m_StandardBlendPlayablePropertiesContent = new GUIContent("Standard Blend Playable Properties", "Having already selected a Track Binding type, you can select the properties of the bound component you want the playable to affect. For example, if your playable is bound to a Transform, you can affect the position property. Note that changing the component binding will clear the list of properties.");
|
|
+ readonly GUIContent m_StandardBlendPlayablePropertiesContent = new GUIContent("Standard Blend Playable Properties", "Having already selected a Track Binding type, you can select the properties of the bound component you want the playable to affect. For example, if your playable is bound to a Transform, you can affect the position property. Note that changing the component binding will clear the list of properties.");
|
|
- readonly GUIContent m_ClipCapsContent = new GUIContent("Clip Caps", "Clip Caps are used to change the way Timelines work with your playables. For example, enabling Blending will mean that your playables can blend when they overlap and have ease in and out durations. To find out a little about each hover the cursor over the options. For details, please see the documentation.");
|
|
+ readonly GUIContent m_ClipCapsContent = new GUIContent("Clip Caps", "Clip Caps are used to change the way Timelines work with your playables. For example, enabling Blending will mean that your playables can blend when they overlap and have ease in and out durations. To find out a little about each hover the cursor over the options. For details, please see the documentation.");
|
|
- readonly GUIContent m_CCNoneContent = new GUIContent("None", "Your playable supports none of the features below.");
|
|
+ readonly GUIContent m_CCNoneContent = new GUIContent("None", "Your playable supports none of the features below.");
|
|
- readonly GUIContent m_CCLoopingContent = new GUIContent("Looping", "Your playable has a specified time that it takes and will start again after it finishes until the clip's duration has played.");
|
|
+ readonly GUIContent m_CCLoopingContent = new GUIContent("Looping", "Your playable has a specified time that it takes and will start again after it finishes until the clip's duration has played.");
|
|
- readonly GUIContent m_CCExtrapolationContent = new GUIContent("Extrapolation", "Your playable will persist beyond its end time and its results will continue until the next clip is encountered.");
|
|
+ readonly GUIContent m_CCExtrapolationContent = new GUIContent("Extrapolation", "Your playable will persist beyond its end time and its results will continue until the next clip is encountered.");
|
|
- readonly GUIContent m_CCClipInContent = new GUIContent("Clip In", "Your playable need not be at the start of the Timeline.");
|
|
+ readonly GUIContent m_CCClipInContent = new GUIContent("Clip In", "Your playable need not be at the start of the Timeline.");
|
|
- readonly GUIContent m_CCSpeedMultiplierContent = new GUIContent("Speed Multiplier", "Your playable supports changes to the time scale.");
|
|
+ readonly GUIContent m_CCSpeedMultiplierContent = new GUIContent("Speed Multiplier", "Your playable supports changes to the time scale.");
|
|
- readonly GUIContent m_CCBlendingContent = new GUIContent("Blending", "Your playable supports overlapping of clips to blend between them.");
|
|
+ readonly GUIContent m_CCBlendingContent = new GUIContent("Blending", "Your playable supports overlapping of clips to blend between them.");
|
|
- readonly GUIContent m_CCAllContent = new GUIContent("All", "Your playable supports all of the above features.");
|
|
+ readonly GUIContent m_CCAllContent = new GUIContent("All", "Your playable supports all of the above features.");
|
|
-
|
|
+
|
|
- readonly GUIContent m_ClipDefaultsContent = new GUIContent("Clip Defaults");
|
|
+ readonly GUIContent m_ClipDefaultsContent = new GUIContent("Clip Defaults");
|
|
- readonly GUIContent m_CDClipTimingContent = new GUIContent("Clip Timing", "Various settings that affect the durations over which the playable will be active.");
|
|
+ readonly GUIContent m_CDClipTimingContent = new GUIContent("Clip Timing", "Various settings that affect the durations over which the playable will be active.");
|
|
- readonly GUIContent m_CDDurationContent = new GUIContent("Duration", "The default length of the clip in seconds.");
|
|
+ readonly GUIContent m_CDDurationContent = new GUIContent("Duration", "The default length of the clip in seconds.");
|
|
- readonly GUIContent m_CDEaseInContent = new GUIContent("Ease In Duration", "The default duration over which the clip's weight increases to one. When clips are overlapped, this is controlled by their overlap. A clip requires the Blending ClipCap to support this.");
|
|
+ readonly GUIContent m_CDEaseInContent = new GUIContent("Ease In Duration", "The default duration over which the clip's weight increases to one. When clips are overlapped, this is controlled by their overlap. A clip requires the Blending ClipCap to support this.");
|
|
- readonly GUIContent m_CDEaseOutContent = new GUIContent("Ease Out Duration", "The default duration over which the clip's weight decreases to zero. When clips are overlapped, this is controlled by their overlap. A clip requires the Blending ClipCap to support this.");
|
|
+ readonly GUIContent m_CDEaseOutContent = new GUIContent("Ease Out Duration", "The default duration over which the clip's weight decreases to zero. When clips are overlapped, this is controlled by their overlap. A clip requires the Blending ClipCap to support this.");
|
|
- readonly GUIContent m_CDClipInContent = new GUIContent("Clip In", "The length of time after the start that the clip should start. A clip requires the ClipIn ClipCap to support this.");
|
|
+ readonly GUIContent m_CDClipInContent = new GUIContent("Clip In", "The length of time after the start that the clip should start. A clip requires the ClipIn ClipCap to support this.");
|
|
- readonly GUIContent m_CDSpeedMultiplierContent = new GUIContent("Speed Multiplier", "The amount a clip's time dependent aspects will speed up or slow down by. A clip requires the SpeedMultiplier ClipCap to support this.");
|
|
+ readonly GUIContent m_CDSpeedMultiplierContent = new GUIContent("Speed Multiplier", "The amount a clip's time dependent aspects will speed up or slow down by. A clip requires the SpeedMultiplier ClipCap to support this.");
|
|
- */
|
|
+ */
|
|
- const string k_Tab = " ";
|
|
+ const string k_Tab = " ";
|
|
- const string k_ShowHelpBoxesKey = "TimelinePlayableWizard_ShowHelpBoxes";
|
|
+ const string k_ShowHelpBoxesKey = "TimelinePlayableWizard_ShowHelpBoxes";
|
|
- const string k_TimelineClipAssetSuffix = "Clip";
|
|
+ const string k_TimelineClipAssetSuffix = "Clip";
|
|
- const string k_TimelineClipBehaviourSuffix = "Behaviour";
|
|
+ const string k_TimelineClipBehaviourSuffix = "Behaviour";
|
|
- const string k_PlayableBehaviourMixerSuffix = "MixerBehaviour";
|
|
+ const string k_PlayableBehaviourMixerSuffix = "MixerBehaviour";
|
|
- const string k_TrackAssetSuffix = "Track";
|
|
+ const string k_TrackAssetSuffix = "Track";
|
|
- const string k_PropertyDrawerSuffix = "Drawer";
|
|
+ const string k_PropertyDrawerSuffix = "Drawer";
|
|
- const int k_PlayableNameCharLimit = 64;
|
|
+ const int k_PlayableNameCharLimit = 64;
|
|
- const float k_WindowWidth = 500f;
|
|
+ const float k_WindowWidth = 500f;
|
|
- const float k_MaxWindowHeight = 800f;
|
|
+ const float k_MaxWindowHeight = 800f;
|
|
- const float k_ScreenSizeWindowBuffer = 50f;
|
|
+ const float k_ScreenSizeWindowBuffer = 50f;
|
|
-
|
|
+
|
|
- static UsableType[] s_ComponentTypes;
|
|
+ static UsableType[] s_ComponentTypes;
|
|
- static UsableType[] s_TrackBindingTypes;
|
|
+ static UsableType[] s_TrackBindingTypes;
|
|
- static UsableType[] s_ExposedReferenceTypes;
|
|
+ static UsableType[] s_ExposedReferenceTypes;
|
|
- static UsableType[] s_BehaviourVariableTypes;
|
|
+ static UsableType[] s_BehaviourVariableTypes;
|
|
- static Type[] s_BlendableTypes =
|
|
+ static Type[] s_BlendableTypes =
|
|
- {
|
|
+ {
|
|
- typeof(float), typeof(int), typeof(double), typeof(Vector2), typeof(Vector3), typeof(Color),
|
|
+ typeof(float), typeof(int), typeof(double), typeof(Vector2), typeof(Vector3), typeof(Color),
|
|
- };
|
|
+ };
|
|
- static Type[] s_AssignableTypes =
|
|
+ static Type[] s_AssignableTypes =
|
|
- {
|
|
+ {
|
|
- typeof(string), typeof(bool)
|
|
+ typeof(string), typeof(bool)
|
|
- };
|
|
+ };
|
|
- static string[] s_DisallowedPropertyNames =
|
|
+ static string[] s_DisallowedPropertyNames =
|
|
- {
|
|
+ {
|
|
- "name",
|
|
+ "name",
|
|
- };
|
|
+ };
|
|
-
|
|
+
|
|
- [MenuItem("Window/Timeline Playable Wizard...")]
|
|
+ [MenuItem("Window/Timeline Playable Wizard...")]
|
|
- static void CreateWindow ()
|
|
+ static void CreateWindow ()
|
|
- {
|
|
+ {
|
|
- TimelinePlayableWizard wizard = GetWindow<TimelinePlayableWizard>(true, "Timeline Playable Wizard", true);
|
|
+ TimelinePlayableWizard wizard = GetWindow<TimelinePlayableWizard>(true, "Timeline Playable Wizard", true);
|
|
-
|
|
+
|
|
- Vector2 position = Vector2.zero;
|
|
+ Vector2 position = Vector2.zero;
|
|
- SceneView sceneView = SceneView.lastActiveSceneView;
|
|
+ SceneView sceneView = SceneView.lastActiveSceneView;
|
|
- if (sceneView != null)
|
|
+ if (sceneView != null)
|
|
- position = new Vector2(sceneView.position.x, sceneView.position.y);
|
|
+ position = new Vector2(sceneView.position.x, sceneView.position.y);
|
|
- wizard.position = new Rect(position.x + k_ScreenSizeWindowBuffer, position.y + k_ScreenSizeWindowBuffer, k_WindowWidth, Mathf.Min(Screen.currentResolution.height - k_ScreenSizeWindowBuffer, k_MaxWindowHeight));
|
|
+ wizard.position = new Rect(position.x + k_ScreenSizeWindowBuffer, position.y + k_ScreenSizeWindowBuffer, k_WindowWidth, Mathf.Min(Screen.currentResolution.height - k_ScreenSizeWindowBuffer, k_MaxWindowHeight));
|
|
-
|
|
+
|
|
- wizard.showHelpBoxes = EditorPrefs.GetBool (k_ShowHelpBoxesKey);
|
|
+ wizard.showHelpBoxes = EditorPrefs.GetBool (k_ShowHelpBoxesKey);
|
|
- wizard.Show();
|
|
+ wizard.Show();
|
|
-
|
|
+
|
|
- Init ();
|
|
+ Init ();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- static void Init ()
|
|
+ static void Init ()
|
|
- {
|
|
+ {
|
|
- Type[] componentTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).Where(t => typeof(Component).IsAssignableFrom(t)).Where (t => t.IsPublic).ToArray();
|
|
+ Type[] componentTypes = AppDomain.CurrentDomain.GetAssemblies().SelectMany(a => a.GetTypes()).Where(t => typeof(Component).IsAssignableFrom(t)).Where (t => t.IsPublic).ToArray();
|
|
-
|
|
+
|
|
- List<UsableType> componentUsableTypesList = UsableType.GetUsableTypeArray(componentTypes).ToList();
|
|
+ List<UsableType> componentUsableTypesList = UsableType.GetUsableTypeArray(componentTypes).ToList();
|
|
- componentUsableTypesList.Sort();
|
|
+ componentUsableTypesList.Sort();
|
|
- s_ComponentTypes = componentUsableTypesList.ToArray ();
|
|
+ s_ComponentTypes = componentUsableTypesList.ToArray ();
|
|
-
|
|
+
|
|
- UsableType gameObjectUsableType = new UsableType(typeof(GameObject));
|
|
+ UsableType gameObjectUsableType = new UsableType(typeof(GameObject));
|
|
- UsableType[] defaultUsableTypes = UsableType.GetUsableTypeArray(componentTypes, gameObjectUsableType);
|
|
+ UsableType[] defaultUsableTypes = UsableType.GetUsableTypeArray(componentTypes, gameObjectUsableType);
|
|
-
|
|
+
|
|
- List<UsableType> exposedRefTypeList = defaultUsableTypes.ToList ();
|
|
+ List<UsableType> exposedRefTypeList = defaultUsableTypes.ToList ();
|
|
- exposedRefTypeList.Sort();
|
|
+ exposedRefTypeList.Sort();
|
|
- s_ExposedReferenceTypes = exposedRefTypeList.ToArray();
|
|
+ s_ExposedReferenceTypes = exposedRefTypeList.ToArray();
|
|
-
|
|
+
|
|
- UsableType noneType = new UsableType((Type)null);
|
|
+ UsableType noneType = new UsableType((Type)null);
|
|
- s_TrackBindingTypes = UsableType.AmalgamateUsableTypes(s_ExposedReferenceTypes, noneType);
|
|
+ s_TrackBindingTypes = UsableType.AmalgamateUsableTypes(s_ExposedReferenceTypes, noneType);
|
|
-
|
|
+
|
|
- s_BehaviourVariableTypes = UsableType.AmalgamateUsableTypes
|
|
+ s_BehaviourVariableTypes = UsableType.AmalgamateUsableTypes
|
|
- (
|
|
+ (
|
|
- s_ExposedReferenceTypes,
|
|
+ s_ExposedReferenceTypes,
|
|
- new UsableType("int"),
|
|
+ new UsableType("int"),
|
|
- new UsableType("bool"),
|
|
+ new UsableType("bool"),
|
|
- new UsableType("float"),
|
|
+ new UsableType("float"),
|
|
- new UsableType("Color"),
|
|
+ new UsableType("Color"),
|
|
- new UsableType("double"),
|
|
+ new UsableType("double"),
|
|
- new UsableType("string"),
|
|
+ new UsableType("string"),
|
|
- new UsableType("Vector2"),
|
|
+ new UsableType("Vector2"),
|
|
- new UsableType("Vector3"),
|
|
+ new UsableType("Vector3"),
|
|
- new UsableType("AudioClip"),
|
|
+ new UsableType("AudioClip"),
|
|
- new UsableType("AnimationCurve")
|
|
+ new UsableType("AnimationCurve")
|
|
- );
|
|
+ );
|
|
- List<UsableType> scriptVariableTypeList = s_BehaviourVariableTypes.ToList();
|
|
+ List<UsableType> scriptVariableTypeList = s_BehaviourVariableTypes.ToList();
|
|
- scriptVariableTypeList.Sort();
|
|
+ scriptVariableTypeList.Sort();
|
|
- s_BehaviourVariableTypes = scriptVariableTypeList.ToArray();
|
|
+ s_BehaviourVariableTypes = scriptVariableTypeList.ToArray();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- void OnGUI ()
|
|
+ void OnGUI ()
|
|
- {
|
|
+ {
|
|
- if(s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
|
|
+ if(s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
|
|
- Init ();
|
|
+ Init ();
|
|
-
|
|
+
|
|
- if (s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
|
|
+ if (s_ComponentTypes == null || s_TrackBindingTypes == null || s_ExposedReferenceTypes == null || s_BehaviourVariableTypes == null)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox ("Failed to initialise.", MessageType.Error);
|
|
+ EditorGUILayout.HelpBox ("Failed to initialise.", MessageType.Error);
|
|
- return;
|
|
+ return;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- m_ScrollViewPos = EditorGUILayout.BeginScrollView (m_ScrollViewPos);
|
|
+ m_ScrollViewPos = EditorGUILayout.BeginScrollView (m_ScrollViewPos);
|
|
-
|
|
+
|
|
- bool oldShowHelpBoxes = showHelpBoxes;
|
|
+ bool oldShowHelpBoxes = showHelpBoxes;
|
|
- showHelpBoxes = EditorGUILayout.Toggle (m_ShowHelpBoxesContent, showHelpBoxes);
|
|
+ showHelpBoxes = EditorGUILayout.Toggle (m_ShowHelpBoxesContent, showHelpBoxes);
|
|
- if (oldShowHelpBoxes != showHelpBoxes)
|
|
+ if (oldShowHelpBoxes != showHelpBoxes)
|
|
- {
|
|
+ {
|
|
- EditorPrefs.SetBool (k_ShowHelpBoxesKey, showHelpBoxes);
|
|
+ EditorPrefs.SetBool (k_ShowHelpBoxesKey, showHelpBoxes);
|
|
- EditorGUILayout.Space ();
|
|
+ EditorGUILayout.Space ();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- if (showHelpBoxes)
|
|
+ if (showHelpBoxes)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox("This wizard is used to create the basics of a custom playable for the Timeline. "
|
|
+ EditorGUILayout.HelpBox("This wizard is used to create the basics of a custom playable for the Timeline. "
|
|
- + "It will create 4 scripts that you can then edit to complete their functionality. "
|
|
+ + "It will create 4 scripts that you can then edit to complete their functionality. "
|
|
- + "The purpose is to setup the boilerplate code for you. If you are already familiar "
|
|
+ + "The purpose is to setup the boilerplate code for you. If you are already familiar "
|
|
- + "with playables and the Timeline, you may wish to create your own scripts instead.", MessageType.None);
|
|
+ + "with playables and the Timeline, you may wish to create your own scripts instead.", MessageType.None);
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.Space ();
|
|
+ EditorGUILayout.Space ();
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- EditorGUILayout.BeginVertical (GUI.skin.box);
|
|
+ EditorGUILayout.BeginVertical (GUI.skin.box);
|
|
- if (showHelpBoxes)
|
|
+ if (showHelpBoxes)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox(m_PlayableNameContent.tooltip, MessageType.Info);
|
|
+ EditorGUILayout.HelpBox(m_PlayableNameContent.tooltip, MessageType.Info);
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- }
|
|
+ }
|
|
- playableName = EditorGUILayout.TextField (m_PlayableNameContent, playableName);
|
|
+ playableName = EditorGUILayout.TextField (m_PlayableNameContent, playableName);
|
|
-
|
|
+
|
|
- bool playableNameNotEmpty = !string.IsNullOrEmpty (playableName);
|
|
+ bool playableNameNotEmpty = !string.IsNullOrEmpty (playableName);
|
|
- bool playableNameFormatted = CodeGenerator.IsValidLanguageIndependentIdentifier(playableName);
|
|
+ bool playableNameFormatted = CodeGenerator.IsValidLanguageIndependentIdentifier(playableName);
|
|
- if (!playableNameNotEmpty || !playableNameFormatted)
|
|
+ if (!playableNameNotEmpty || !playableNameFormatted)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox ("The Playable needs a name which starts with a capital letter and contains no spaces or special characters.", MessageType.Error);
|
|
+ EditorGUILayout.HelpBox ("The Playable needs a name which starts with a capital letter and contains no spaces or special characters.", MessageType.Error);
|
|
- }
|
|
+ }
|
|
- bool playableNameTooLong = playableName.Length > k_PlayableNameCharLimit;
|
|
+ bool playableNameTooLong = playableName.Length > k_PlayableNameCharLimit;
|
|
- if (playableNameTooLong)
|
|
+ if (playableNameTooLong)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox ("The Playable needs a name which is fewer than " + k_PlayableNameCharLimit + " characters long.", MessageType.Error);
|
|
+ EditorGUILayout.HelpBox ("The Playable needs a name which is fewer than " + k_PlayableNameCharLimit + " characters long.", MessageType.Error);
|
|
- }
|
|
+ }
|
|
- EditorGUILayout.EndVertical ();
|
|
+ EditorGUILayout.EndVertical ();
|
|
-
|
|
+
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- EditorGUILayout.BeginVertical(GUI.skin.box);
|
|
+ EditorGUILayout.BeginVertical(GUI.skin.box);
|
|
- if(showHelpBoxes)
|
|
+ if(showHelpBoxes)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox(m_StandardBlendPlayableContent.tooltip, MessageType.Info);
|
|
+ EditorGUILayout.HelpBox(m_StandardBlendPlayableContent.tooltip, MessageType.Info);
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- }
|
|
+ }
|
|
- bool oldStandardBlendPlayable = isStandardBlendPlayable;
|
|
+ bool oldStandardBlendPlayable = isStandardBlendPlayable;
|
|
- isStandardBlendPlayable = EditorGUILayout.Toggle (m_StandardBlendPlayableContent, isStandardBlendPlayable);
|
|
+ isStandardBlendPlayable = EditorGUILayout.Toggle (m_StandardBlendPlayableContent, isStandardBlendPlayable);
|
|
- EditorGUILayout.EndVertical ();
|
|
+ EditorGUILayout.EndVertical ();
|
|
-
|
|
+
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- EditorGUILayout.BeginVertical(GUI.skin.box);
|
|
+ EditorGUILayout.BeginVertical(GUI.skin.box);
|
|
- if(showHelpBoxes)
|
|
+ if(showHelpBoxes)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox(m_TrackBindingTypeContent.tooltip, MessageType.Info);
|
|
+ EditorGUILayout.HelpBox(m_TrackBindingTypeContent.tooltip, MessageType.Info);
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- }
|
|
+ }
|
|
- int oldIndex = -1;
|
|
+ int oldIndex = -1;
|
|
- if (isStandardBlendPlayable)
|
|
+ if (isStandardBlendPlayable)
|
|
- {
|
|
+ {
|
|
- oldIndex = m_ComponentBindingTypeIndex;
|
|
+ oldIndex = m_ComponentBindingTypeIndex;
|
|
-
|
|
+
|
|
- m_ComponentBindingTypeIndex = EditorGUILayout.Popup (m_TrackBindingTypeContent, m_ComponentBindingTypeIndex, UsableType.GetGUIContentWithSortingArray (s_ComponentTypes));
|
|
+ m_ComponentBindingTypeIndex = EditorGUILayout.Popup (m_TrackBindingTypeContent, m_ComponentBindingTypeIndex, UsableType.GetGUIContentWithSortingArray (s_ComponentTypes));
|
|
- trackBinding = s_ComponentTypes[m_ComponentBindingTypeIndex];
|
|
+ trackBinding = s_ComponentTypes[m_ComponentBindingTypeIndex];
|
|
-
|
|
+
|
|
- EditorGUILayout.Space ();
|
|
+ EditorGUILayout.Space ();
|
|
-
|
|
+
|
|
- defaultValuesComponent = EditorGUILayout.ObjectField (m_DefaultValuesComponentContent, defaultValuesComponent, trackBinding.type, true) as Component;
|
|
+ defaultValuesComponent = EditorGUILayout.ObjectField (m_DefaultValuesComponentContent, defaultValuesComponent, trackBinding.type, true) as Component;
|
|
- }
|
|
+ }
|
|
- else
|
|
+ else
|
|
- {
|
|
+ {
|
|
- m_TrackBindingTypeIndex = EditorGUILayout.Popup(m_TrackBindingTypeContent, m_TrackBindingTypeIndex, UsableType.GetGUIContentWithSortingArray(s_TrackBindingTypes));
|
|
+ m_TrackBindingTypeIndex = EditorGUILayout.Popup(m_TrackBindingTypeContent, m_TrackBindingTypeIndex, UsableType.GetGUIContentWithSortingArray(s_TrackBindingTypes));
|
|
- trackBinding = s_TrackBindingTypes[m_TrackBindingTypeIndex];
|
|
+ trackBinding = s_TrackBindingTypes[m_TrackBindingTypeIndex];
|
|
- }
|
|
+ }
|
|
- EditorGUILayout.EndVertical ();
|
|
+ EditorGUILayout.EndVertical ();
|
|
-
|
|
+
|
|
- bool exposedVariablesNamesValid = true;
|
|
+ bool exposedVariablesNamesValid = true;
|
|
- bool scriptVariablesNamesValid = true;
|
|
+ bool scriptVariablesNamesValid = true;
|
|
- bool allUniqueVariableNames = true;
|
|
+ bool allUniqueVariableNames = true;
|
|
-
|
|
+
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- if (isStandardBlendPlayable)
|
|
+ if (isStandardBlendPlayable)
|
|
- {
|
|
+ {
|
|
- StandardBlendPlayablePropertyGUI(oldIndex != m_ComponentBindingTypeIndex || oldStandardBlendPlayable != isStandardBlendPlayable);
|
|
+ StandardBlendPlayablePropertyGUI(oldIndex != m_ComponentBindingTypeIndex || oldStandardBlendPlayable != isStandardBlendPlayable);
|
|
- }
|
|
+ }
|
|
- else
|
|
+ else
|
|
- {
|
|
+ {
|
|
- exposedVariablesNamesValid = VariableListGUI(exposedReferences, s_ExposedReferenceTypes, m_ExposedReferencesContent, "newExposedReference");
|
|
+ exposedVariablesNamesValid = VariableListGUI(exposedReferences, s_ExposedReferenceTypes, m_ExposedReferencesContent, "newExposedReference");
|
|
-
|
|
+
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- scriptVariablesNamesValid = VariableListGUI(playableBehaviourVariables, s_BehaviourVariableTypes, m_BehaviourVariablesContent, "newBehaviourVariable");
|
|
+ scriptVariablesNamesValid = VariableListGUI(playableBehaviourVariables, s_BehaviourVariableTypes, m_BehaviourVariablesContent, "newBehaviourVariable");
|
|
-
|
|
+
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- allUniqueVariableNames = AllVariablesUniquelyNamed();
|
|
+ allUniqueVariableNames = AllVariablesUniquelyNamed();
|
|
- if (!allUniqueVariableNames)
|
|
+ if (!allUniqueVariableNames)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox("Your variables to not have unique names. Make sure all of your Exposed References and Behaviour Variables have unique names.", MessageType.Error);
|
|
+ EditorGUILayout.HelpBox("Your variables to not have unique names. Make sure all of your Exposed References and Behaviour Variables have unique names.", MessageType.Error);
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- ClipCapsGUI();
|
|
+ ClipCapsGUI();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- EditorGUILayout.Space ();
|
|
+ EditorGUILayout.Space ();
|
|
- EditorGUILayout.Space ();*/
|
|
+ EditorGUILayout.Space ();*/
|
|
-
|
|
+
|
|
- EditorGUILayout.BeginVertical(GUI.skin.box);
|
|
+ EditorGUILayout.BeginVertical(GUI.skin.box);
|
|
- if (showHelpBoxes)
|
|
+ if (showHelpBoxes)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox(m_TrackColorContent.tooltip, MessageType.Info);
|
|
+ EditorGUILayout.HelpBox(m_TrackColorContent.tooltip, MessageType.Info);
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- }
|
|
+ }
|
|
- trackColor = EditorGUILayout.ColorField(m_TrackColorContent, trackColor);
|
|
+ trackColor = EditorGUILayout.ColorField(m_TrackColorContent, trackColor);
|
|
- EditorGUILayout.EndVertical ();
|
|
+ EditorGUILayout.EndVertical ();
|
|
-
|
|
+
|
|
- if (!isStandardBlendPlayable)
|
|
+ if (!isStandardBlendPlayable)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- EditorGUILayout.BeginVertical(GUI.skin.box);
|
|
+ EditorGUILayout.BeginVertical(GUI.skin.box);
|
|
- if (showHelpBoxes)
|
|
+ if (showHelpBoxes)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox(m_CreateDrawerContent.tooltip, MessageType.Info);
|
|
+ EditorGUILayout.HelpBox(m_CreateDrawerContent.tooltip, MessageType.Info);
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- }
|
|
+ }
|
|
- m_CreateDrawer = EditorGUILayout.Toggle(m_CreateDrawerContent, m_CreateDrawer);
|
|
+ m_CreateDrawer = EditorGUILayout.Toggle(m_CreateDrawerContent, m_CreateDrawer);
|
|
- EditorGUILayout.EndVertical ();
|
|
+ EditorGUILayout.EndVertical ();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- if (playableNameNotEmpty && playableNameFormatted && allUniqueVariableNames && exposedVariablesNamesValid && scriptVariablesNamesValid && !playableNameTooLong)
|
|
+ if (playableNameNotEmpty && playableNameFormatted && allUniqueVariableNames && exposedVariablesNamesValid && scriptVariablesNamesValid && !playableNameTooLong)
|
|
- {
|
|
+ {
|
|
- if (GUILayout.Button("Create", GUILayout.Width(60f)))
|
|
+ if (GUILayout.Button("Create", GUILayout.Width(60f)))
|
|
- {
|
|
+ {
|
|
- m_CreateButtonPressed = true;
|
|
+ m_CreateButtonPressed = true;
|
|
-
|
|
+
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- standardBlendPlayableProperties[i].CreateSettingDefaultValueString (defaultValuesComponent);
|
|
+ standardBlendPlayableProperties[i].CreateSettingDefaultValueString (defaultValuesComponent);
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- m_CreationError = CreateScripts();
|
|
+ m_CreationError = CreateScripts();
|
|
-
|
|
+
|
|
- if (m_CreationError == CreationError.NoError)
|
|
+ if (m_CreationError == CreationError.NoError)
|
|
- {
|
|
+ {
|
|
- Close ();
|
|
+ Close ();
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- if (m_CreateButtonPressed)
|
|
+ if (m_CreateButtonPressed)
|
|
- {
|
|
+ {
|
|
- switch (m_CreationError)
|
|
+ switch (m_CreationError)
|
|
- {
|
|
+ {
|
|
- case CreationError.NoError:
|
|
+ case CreationError.NoError:
|
|
- EditorGUILayout.HelpBox ("Playable was successfully created.", MessageType.Info);
|
|
+ EditorGUILayout.HelpBox ("Playable was successfully created.", MessageType.Info);
|
|
- break;
|
|
+ break;
|
|
- case CreationError.PlayableAssetAlreadyExists:
|
|
+ case CreationError.PlayableAssetAlreadyExists:
|
|
- EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipAssetSuffix + " already exists, no files were created.", MessageType.Error);
|
|
+ EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipAssetSuffix + " already exists, no files were created.", MessageType.Error);
|
|
- break;
|
|
+ break;
|
|
- case CreationError.PlayableBehaviourAlreadyExists:
|
|
+ case CreationError.PlayableBehaviourAlreadyExists:
|
|
- EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipBehaviourSuffix + " already exists, no files were created.", MessageType.Error);
|
|
+ EditorGUILayout.HelpBox ("The type " + playableName + k_TimelineClipBehaviourSuffix + " already exists, no files were created.", MessageType.Error);
|
|
- break;
|
|
+ break;
|
|
- case CreationError.PlayableBehaviourMixerAlreadyExists:
|
|
+ case CreationError.PlayableBehaviourMixerAlreadyExists:
|
|
- EditorGUILayout.HelpBox ("The type " + playableName + k_PlayableBehaviourMixerSuffix + " already exists, no files were created.", MessageType.Error);
|
|
+ EditorGUILayout.HelpBox ("The type " + playableName + k_PlayableBehaviourMixerSuffix + " already exists, no files were created.", MessageType.Error);
|
|
- break;
|
|
+ break;
|
|
- case CreationError.TrackAssetAlreadyExists:
|
|
+ case CreationError.TrackAssetAlreadyExists:
|
|
- EditorGUILayout.HelpBox ("The type " + playableName + k_TrackAssetSuffix + " already exists, no files were created.", MessageType.Error);
|
|
+ EditorGUILayout.HelpBox ("The type " + playableName + k_TrackAssetSuffix + " already exists, no files were created.", MessageType.Error);
|
|
- break;
|
|
+ break;
|
|
- case CreationError.PlayableDrawerAlreadyExists:
|
|
+ case CreationError.PlayableDrawerAlreadyExists:
|
|
- EditorGUILayout.HelpBox ("The type " + playableName + k_PropertyDrawerSuffix + " already exists, no files were created.", MessageType.Error);
|
|
+ EditorGUILayout.HelpBox ("The type " + playableName + k_PropertyDrawerSuffix + " already exists, no files were created.", MessageType.Error);
|
|
- break;
|
|
+ break;
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- if (GUILayout.Button ("Reset", GUILayout.Width (60f)))
|
|
+ if (GUILayout.Button ("Reset", GUILayout.Width (60f)))
|
|
- {
|
|
+ {
|
|
- ResetWindow ();
|
|
+ ResetWindow ();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.EndScrollView ();
|
|
+ EditorGUILayout.EndScrollView ();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- void StandardBlendPlayablePropertyGUI (bool findNewProperties)
|
|
+ void StandardBlendPlayablePropertyGUI (bool findNewProperties)
|
|
- {
|
|
+ {
|
|
- if (findNewProperties || m_TrackBindingProperties == null && m_TrackBindingFields == null)
|
|
+ if (findNewProperties || m_TrackBindingProperties == null && m_TrackBindingFields == null)
|
|
- {
|
|
+ {
|
|
- m_TrackBindingUsableProperties.Clear ();
|
|
+ m_TrackBindingUsableProperties.Clear ();
|
|
-
|
|
+
|
|
- IEnumerable<PropertyInfo> propertyInfos = trackBinding.type.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.GetProperty);
|
|
+ IEnumerable<PropertyInfo> propertyInfos = trackBinding.type.GetProperties (BindingFlags.Instance | BindingFlags.Public | BindingFlags.SetProperty | BindingFlags.GetProperty);
|
|
- propertyInfos = propertyInfos.Where (x => IsTypeBlendable(x.PropertyType) || IsTypeAssignable(x.PropertyType));
|
|
+ propertyInfos = propertyInfos.Where (x => IsTypeBlendable(x.PropertyType) || IsTypeAssignable(x.PropertyType));
|
|
- propertyInfos = propertyInfos.Where (x => x.CanWrite && x.CanRead);
|
|
+ propertyInfos = propertyInfos.Where (x => x.CanWrite && x.CanRead);
|
|
- propertyInfos = propertyInfos.Where (x => HasAllowedName (x));
|
|
+ propertyInfos = propertyInfos.Where (x => HasAllowedName (x));
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- m_TrackBindingProperties = propertyInfos.ToArray();
|
|
+ m_TrackBindingProperties = propertyInfos.ToArray();
|
|
- foreach (PropertyInfo trackBindingProperty in m_TrackBindingProperties)
|
|
+ foreach (PropertyInfo trackBindingProperty in m_TrackBindingProperties)
|
|
- {
|
|
+ {
|
|
- m_TrackBindingUsableProperties.Add (new UsableProperty (trackBindingProperty));
|
|
+ m_TrackBindingUsableProperties.Add (new UsableProperty (trackBindingProperty));
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- IEnumerable<FieldInfo> fieldInfos = trackBinding.type.GetFields (BindingFlags.Instance | BindingFlags.Public);
|
|
+ IEnumerable<FieldInfo> fieldInfos = trackBinding.type.GetFields (BindingFlags.Instance | BindingFlags.Public);
|
|
- fieldInfos = fieldInfos.Where(x => IsTypeBlendable(x.FieldType) || IsTypeAssignable(x.FieldType));
|
|
+ fieldInfos = fieldInfos.Where(x => IsTypeBlendable(x.FieldType) || IsTypeAssignable(x.FieldType));
|
|
- m_TrackBindingFields = fieldInfos.ToArray ();
|
|
+ m_TrackBindingFields = fieldInfos.ToArray ();
|
|
- foreach (FieldInfo trackBindingField in m_TrackBindingFields)
|
|
+ foreach (FieldInfo trackBindingField in m_TrackBindingFields)
|
|
- {
|
|
+ {
|
|
- m_TrackBindingUsableProperties.Add (new UsableProperty (trackBindingField));
|
|
+ m_TrackBindingUsableProperties.Add (new UsableProperty (trackBindingField));
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- m_TrackBindingUsableProperties = m_TrackBindingUsableProperties.OrderBy (x => x.name).ToList ();
|
|
+ m_TrackBindingUsableProperties = m_TrackBindingUsableProperties.OrderBy (x => x.name).ToList ();
|
|
- standardBlendPlayableProperties.Clear ();
|
|
+ standardBlendPlayableProperties.Clear ();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.BeginVertical (GUI.skin.box);
|
|
+ EditorGUILayout.BeginVertical (GUI.skin.box);
|
|
-
|
|
+
|
|
- if (showHelpBoxes)
|
|
+ if (showHelpBoxes)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox(m_StandardBlendPlayablePropertiesContent.tooltip, MessageType.Info);
|
|
+ EditorGUILayout.HelpBox(m_StandardBlendPlayablePropertiesContent.tooltip, MessageType.Info);
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.LabelField(m_StandardBlendPlayablePropertiesContent);
|
|
+ EditorGUILayout.LabelField(m_StandardBlendPlayablePropertiesContent);
|
|
-
|
|
+
|
|
- int indexToRemove = -1;
|
|
+ int indexToRemove = -1;
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- if (standardBlendPlayableProperties[i].GUI(m_TrackBindingUsableProperties))
|
|
+ if (standardBlendPlayableProperties[i].GUI(m_TrackBindingUsableProperties))
|
|
- indexToRemove = i;
|
|
+ indexToRemove = i;
|
|
- }
|
|
+ }
|
|
- if (indexToRemove != -1)
|
|
+ if (indexToRemove != -1)
|
|
- standardBlendPlayableProperties.RemoveAt(indexToRemove);
|
|
+ standardBlendPlayableProperties.RemoveAt(indexToRemove);
|
|
-
|
|
+
|
|
- if (GUILayout.Button("Add", GUILayout.Width(40f)))
|
|
+ if (GUILayout.Button("Add", GUILayout.Width(40f)))
|
|
- standardBlendPlayableProperties.Add(m_TrackBindingUsableProperties[0].GetDuplicate ());
|
|
+ standardBlendPlayableProperties.Add(m_TrackBindingUsableProperties[0].GetDuplicate ());
|
|
-
|
|
+
|
|
- if (standardBlendPlayableProperties.Any(IsObsolete))
|
|
+ if (standardBlendPlayableProperties.Any(IsObsolete))
|
|
- EditorGUILayout.HelpBox ("One or more of your chosen properties are marked 'Obsolete'. Consider changing them to avoid deprecation with future versions of Unity.", MessageType.Warning);
|
|
+ EditorGUILayout.HelpBox ("One or more of your chosen properties are marked 'Obsolete'. Consider changing them to avoid deprecation with future versions of Unity.", MessageType.Warning);
|
|
-
|
|
+
|
|
- EditorGUILayout.EndVertical ();
|
|
+ EditorGUILayout.EndVertical ();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- static bool IsTypeBlendable (Type type)
|
|
+ static bool IsTypeBlendable (Type type)
|
|
- {
|
|
+ {
|
|
- for (int i = 0; i < s_BlendableTypes.Length; i++)
|
|
+ for (int i = 0; i < s_BlendableTypes.Length; i++)
|
|
- {
|
|
+ {
|
|
- if (type == s_BlendableTypes[i])
|
|
+ if (type == s_BlendableTypes[i])
|
|
- return true;
|
|
+ return true;
|
|
- }
|
|
+ }
|
|
- return false;
|
|
+ return false;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- static bool IsTypeAssignable (Type type)
|
|
+ static bool IsTypeAssignable (Type type)
|
|
- {
|
|
+ {
|
|
- for (int i = 0; i < s_AssignableTypes.Length; i++)
|
|
+ for (int i = 0; i < s_AssignableTypes.Length; i++)
|
|
- {
|
|
+ {
|
|
- if (type == s_AssignableTypes[i] || type.IsEnum)
|
|
+ if (type == s_AssignableTypes[i] || type.IsEnum)
|
|
- return true;
|
|
+ return true;
|
|
- }
|
|
+ }
|
|
- return false;
|
|
+ return false;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- static bool HasAllowedName (PropertyInfo propertyInfo)
|
|
+ static bool HasAllowedName (PropertyInfo propertyInfo)
|
|
- {
|
|
+ {
|
|
- for (int i = 0; i < s_DisallowedPropertyNames.Length; i++)
|
|
+ for (int i = 0; i < s_DisallowedPropertyNames.Length; i++)
|
|
- {
|
|
+ {
|
|
- if (propertyInfo.Name == s_DisallowedPropertyNames[i])
|
|
+ if (propertyInfo.Name == s_DisallowedPropertyNames[i])
|
|
- return false;
|
|
+ return false;
|
|
- }
|
|
+ }
|
|
- return true;
|
|
+ return true;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- static bool IsObsolete (UsableProperty usableProperty)
|
|
+ static bool IsObsolete (UsableProperty usableProperty)
|
|
- {
|
|
+ {
|
|
- if (usableProperty.usablePropertyType == UsableProperty.UsablePropertyType.Field)
|
|
+ if (usableProperty.usablePropertyType == UsableProperty.UsablePropertyType.Field)
|
|
- return Attribute.IsDefined (usableProperty.fieldInfo, typeof(ObsoleteAttribute));
|
|
+ return Attribute.IsDefined (usableProperty.fieldInfo, typeof(ObsoleteAttribute));
|
|
- return Attribute.IsDefined (usableProperty.propertyInfo, typeof(ObsoleteAttribute));
|
|
+ return Attribute.IsDefined (usableProperty.propertyInfo, typeof(ObsoleteAttribute));
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- bool VariableListGUI (List<Variable> variables, UsableType[] usableTypes, GUIContent guiContent, string newName)
|
|
+ bool VariableListGUI (List<Variable> variables, UsableType[] usableTypes, GUIContent guiContent, string newName)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.BeginVertical(GUI.skin.box);
|
|
+ EditorGUILayout.BeginVertical(GUI.skin.box);
|
|
-
|
|
+
|
|
- if (showHelpBoxes)
|
|
+ if (showHelpBoxes)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox(guiContent.tooltip, MessageType.Info);
|
|
+ EditorGUILayout.HelpBox(guiContent.tooltip, MessageType.Info);
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.LabelField(guiContent);
|
|
+ EditorGUILayout.LabelField(guiContent);
|
|
-
|
|
+
|
|
- int indexToRemove = -1;
|
|
+ int indexToRemove = -1;
|
|
- bool allNamesValid = true;
|
|
+ bool allNamesValid = true;
|
|
- for (int i = 0; i < variables.Count; i++)
|
|
+ for (int i = 0; i < variables.Count; i++)
|
|
- {
|
|
+ {
|
|
- if (variables[i].GUI(usableTypes))
|
|
+ if (variables[i].GUI(usableTypes))
|
|
- indexToRemove = i;
|
|
+ indexToRemove = i;
|
|
-
|
|
+
|
|
- if (!CodeGenerator.IsValidLanguageIndependentIdentifier(variables[i].name))
|
|
+ if (!CodeGenerator.IsValidLanguageIndependentIdentifier(variables[i].name))
|
|
- {
|
|
+ {
|
|
- allNamesValid = false;
|
|
+ allNamesValid = false;
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- if (indexToRemove != -1)
|
|
+ if (indexToRemove != -1)
|
|
- variables.RemoveAt(indexToRemove);
|
|
+ variables.RemoveAt(indexToRemove);
|
|
-
|
|
+
|
|
- if (GUILayout.Button("Add", GUILayout.Width(40f)))
|
|
+ if (GUILayout.Button("Add", GUILayout.Width(40f)))
|
|
- variables.Add(new Variable(newName, usableTypes[0]));
|
|
+ variables.Add(new Variable(newName, usableTypes[0]));
|
|
-
|
|
+
|
|
- if (!allNamesValid)
|
|
+ if (!allNamesValid)
|
|
- EditorGUILayout.HelpBox("One of the variables has an invalid character, make sure they don't contain any spaces or special characters.", MessageType.Error);
|
|
+ EditorGUILayout.HelpBox("One of the variables has an invalid character, make sure they don't contain any spaces or special characters.", MessageType.Error);
|
|
-
|
|
+
|
|
- EditorGUILayout.EndVertical();
|
|
+ EditorGUILayout.EndVertical();
|
|
-
|
|
+
|
|
- return allNamesValid;
|
|
+ return allNamesValid;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- bool AllVariablesUniquelyNamed ()
|
|
+ bool AllVariablesUniquelyNamed ()
|
|
- {
|
|
+ {
|
|
- for (int i = 0; i < exposedReferences.Count; i++)
|
|
+ for (int i = 0; i < exposedReferences.Count; i++)
|
|
- {
|
|
+ {
|
|
- string exposedRefName = exposedReferences[i].name;
|
|
+ string exposedRefName = exposedReferences[i].name;
|
|
-
|
|
+
|
|
- for (int j = 0; j < exposedReferences.Count; j++)
|
|
+ for (int j = 0; j < exposedReferences.Count; j++)
|
|
- {
|
|
+ {
|
|
- if (i != j && exposedRefName == exposedReferences[j].name)
|
|
+ if (i != j && exposedRefName == exposedReferences[j].name)
|
|
- return false;
|
|
+ return false;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- for (int j = 0; j < playableBehaviourVariables.Count; j++)
|
|
+ for (int j = 0; j < playableBehaviourVariables.Count; j++)
|
|
- {
|
|
+ {
|
|
- if (exposedRefName == playableBehaviourVariables[j].name)
|
|
+ if (exposedRefName == playableBehaviourVariables[j].name)
|
|
- return false;
|
|
+ return false;
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- for (int i = 0; i < playableBehaviourVariables.Count; i++)
|
|
+ for (int i = 0; i < playableBehaviourVariables.Count; i++)
|
|
- {
|
|
+ {
|
|
- string scriptPlayableVariableName = playableBehaviourVariables[i].name;
|
|
+ string scriptPlayableVariableName = playableBehaviourVariables[i].name;
|
|
-
|
|
+
|
|
- for (int j = 0; j < exposedReferences.Count; j++)
|
|
+ for (int j = 0; j < exposedReferences.Count; j++)
|
|
- {
|
|
+ {
|
|
- if (scriptPlayableVariableName == exposedReferences[j].name)
|
|
+ if (scriptPlayableVariableName == exposedReferences[j].name)
|
|
- return false;
|
|
+ return false;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- for (int j = 0; j < playableBehaviourVariables.Count; j++)
|
|
+ for (int j = 0; j < playableBehaviourVariables.Count; j++)
|
|
- {
|
|
+ {
|
|
- if (i != j && scriptPlayableVariableName == playableBehaviourVariables[j].name)
|
|
+ if (i != j && scriptPlayableVariableName == playableBehaviourVariables[j].name)
|
|
- return false;
|
|
+ return false;
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
- return true;
|
|
+ return true;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- void ClipCapsGUI ()
|
|
+ void ClipCapsGUI ()
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.BeginVertical (GUI.skin.box);
|
|
+ EditorGUILayout.BeginVertical (GUI.skin.box);
|
|
-
|
|
+
|
|
- if (showHelpBoxes)
|
|
+ if (showHelpBoxes)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox(m_ClipCapsContent.tooltip, MessageType.Info);
|
|
+ EditorGUILayout.HelpBox(m_ClipCapsContent.tooltip, MessageType.Info);
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.LabelField (m_ClipCapsContent);
|
|
+ EditorGUILayout.LabelField (m_ClipCapsContent);
|
|
-
|
|
+
|
|
- bool isLooping = (clipCaps & ClipCaps.Looping) == ClipCaps.Looping;
|
|
+ bool isLooping = (clipCaps & ClipCaps.Looping) == ClipCaps.Looping;
|
|
- bool isExtrapolation = (clipCaps & ClipCaps.Extrapolation) == ClipCaps.Extrapolation;
|
|
+ bool isExtrapolation = (clipCaps & ClipCaps.Extrapolation) == ClipCaps.Extrapolation;
|
|
- bool isClipIn = (clipCaps & ClipCaps.ClipIn) == ClipCaps.ClipIn;
|
|
+ bool isClipIn = (clipCaps & ClipCaps.ClipIn) == ClipCaps.ClipIn;
|
|
- bool isSpeedMultiplier = (clipCaps & ClipCaps.SpeedMultiplier) == ClipCaps.SpeedMultiplier;
|
|
+ bool isSpeedMultiplier = (clipCaps & ClipCaps.SpeedMultiplier) == ClipCaps.SpeedMultiplier;
|
|
- bool isBlending = (clipCaps & ClipCaps.Blending) == ClipCaps.Blending;
|
|
+ bool isBlending = (clipCaps & ClipCaps.Blending) == ClipCaps.Blending;
|
|
-
|
|
+
|
|
- bool isNone = !isLooping && !isExtrapolation && !isClipIn && !isSpeedMultiplier && !isBlending;
|
|
+ bool isNone = !isLooping && !isExtrapolation && !isClipIn && !isSpeedMultiplier && !isBlending;
|
|
- bool isAll = isLooping && isExtrapolation && isClipIn && isSpeedMultiplier && isBlending;
|
|
+ bool isAll = isLooping && isExtrapolation && isClipIn && isSpeedMultiplier && isBlending;
|
|
-
|
|
+
|
|
- EditorGUI.BeginChangeCheck ();
|
|
+ EditorGUI.BeginChangeCheck ();
|
|
- isNone = EditorGUILayout.ToggleLeft (m_CCNoneContent, isNone);
|
|
+ isNone = EditorGUILayout.ToggleLeft (m_CCNoneContent, isNone);
|
|
- if (EditorGUI.EndChangeCheck ())
|
|
+ if (EditorGUI.EndChangeCheck ())
|
|
- {
|
|
+ {
|
|
- if (isNone)
|
|
+ if (isNone)
|
|
- {
|
|
+ {
|
|
- isLooping = false;
|
|
+ isLooping = false;
|
|
- isExtrapolation = false;
|
|
+ isExtrapolation = false;
|
|
- isClipIn = false;
|
|
+ isClipIn = false;
|
|
- isSpeedMultiplier = false;
|
|
+ isSpeedMultiplier = false;
|
|
- isBlending = false;
|
|
+ isBlending = false;
|
|
- isAll = false;
|
|
+ isAll = false;
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUI.BeginChangeCheck ();
|
|
+ EditorGUI.BeginChangeCheck ();
|
|
- isLooping = EditorGUILayout.ToggleLeft (m_CCLoopingContent, isLooping);
|
|
+ isLooping = EditorGUILayout.ToggleLeft (m_CCLoopingContent, isLooping);
|
|
- isExtrapolation = EditorGUILayout.ToggleLeft (m_CCExtrapolationContent, isExtrapolation);
|
|
+ isExtrapolation = EditorGUILayout.ToggleLeft (m_CCExtrapolationContent, isExtrapolation);
|
|
- isClipIn = EditorGUILayout.ToggleLeft (m_CCClipInContent, isClipIn);
|
|
+ isClipIn = EditorGUILayout.ToggleLeft (m_CCClipInContent, isClipIn);
|
|
- isSpeedMultiplier = EditorGUILayout.ToggleLeft (m_CCSpeedMultiplierContent, isSpeedMultiplier);
|
|
+ isSpeedMultiplier = EditorGUILayout.ToggleLeft (m_CCSpeedMultiplierContent, isSpeedMultiplier);
|
|
- isBlending = EditorGUILayout.ToggleLeft (m_CCBlendingContent, isBlending);
|
|
+ isBlending = EditorGUILayout.ToggleLeft (m_CCBlendingContent, isBlending);
|
|
- if (EditorGUI.EndChangeCheck ())
|
|
+ if (EditorGUI.EndChangeCheck ())
|
|
- {
|
|
+ {
|
|
- isNone = !isLooping && !isExtrapolation && !isClipIn && !isSpeedMultiplier && !isBlending;
|
|
+ isNone = !isLooping && !isExtrapolation && !isClipIn && !isSpeedMultiplier && !isBlending;
|
|
- isAll = isLooping && isExtrapolation && isClipIn && isSpeedMultiplier && isBlending;
|
|
+ isAll = isLooping && isExtrapolation && isClipIn && isSpeedMultiplier && isBlending;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUI.BeginChangeCheck ();
|
|
+ EditorGUI.BeginChangeCheck ();
|
|
- isAll = EditorGUILayout.ToggleLeft (m_CCAllContent, isAll);
|
|
+ isAll = EditorGUILayout.ToggleLeft (m_CCAllContent, isAll);
|
|
- if (EditorGUI.EndChangeCheck ())
|
|
+ if (EditorGUI.EndChangeCheck ())
|
|
- {
|
|
+ {
|
|
- if (isAll)
|
|
+ if (isAll)
|
|
- {
|
|
+ {
|
|
- isNone = false;
|
|
+ isNone = false;
|
|
- isLooping = true;
|
|
+ isLooping = true;
|
|
- isExtrapolation = true;
|
|
+ isExtrapolation = true;
|
|
- isClipIn = true;
|
|
+ isClipIn = true;
|
|
- isSpeedMultiplier = true;
|
|
+ isSpeedMultiplier = true;
|
|
- isBlending = true;
|
|
+ isBlending = true;
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.EndVertical();
|
|
+ EditorGUILayout.EndVertical();
|
|
-
|
|
+
|
|
- clipCaps = ClipCaps.None;
|
|
+ clipCaps = ClipCaps.None;
|
|
-
|
|
+
|
|
- if (isNone)
|
|
+ if (isNone)
|
|
- return;
|
|
+ return;
|
|
-
|
|
+
|
|
- if (isAll)
|
|
+ if (isAll)
|
|
- {
|
|
+ {
|
|
- clipCaps = ClipCaps.All;
|
|
+ clipCaps = ClipCaps.All;
|
|
- return;
|
|
+ return;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- if (isLooping)
|
|
+ if (isLooping)
|
|
- clipCaps |= ClipCaps.Looping;
|
|
+ clipCaps |= ClipCaps.Looping;
|
|
-
|
|
+
|
|
- if (isExtrapolation)
|
|
+ if (isExtrapolation)
|
|
- clipCaps |= ClipCaps.Extrapolation;
|
|
+ clipCaps |= ClipCaps.Extrapolation;
|
|
-
|
|
+
|
|
- if (isClipIn)
|
|
+ if (isClipIn)
|
|
- clipCaps |= ClipCaps.ClipIn;
|
|
+ clipCaps |= ClipCaps.ClipIn;
|
|
-
|
|
+
|
|
- if (isSpeedMultiplier)
|
|
+ if (isSpeedMultiplier)
|
|
- clipCaps |= ClipCaps.SpeedMultiplier;
|
|
+ clipCaps |= ClipCaps.SpeedMultiplier;
|
|
-
|
|
+
|
|
- if (isBlending)
|
|
+ if (isBlending)
|
|
- clipCaps |= ClipCaps.Blending;
|
|
+ clipCaps |= ClipCaps.Blending;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.BeginVertical (GUI.skin.box);
|
|
+ EditorGUILayout.BeginVertical (GUI.skin.box);
|
|
-
|
|
+
|
|
- setClipDefaults = EditorGUILayout.Toggle (m_SetClipDefaultsContent, setClipDefaults);
|
|
+ setClipDefaults = EditorGUILayout.Toggle (m_SetClipDefaultsContent, setClipDefaults);
|
|
-
|
|
+
|
|
- if (!setClipDefaults)
|
|
+ if (!setClipDefaults)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.EndVertical ();
|
|
+ EditorGUILayout.EndVertical ();
|
|
- return;
|
|
+ return;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- if (showHelpBoxes)
|
|
+ if (showHelpBoxes)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.HelpBox (m_ClipDefaultsContent.tooltip, MessageType.Info);
|
|
+ EditorGUILayout.HelpBox (m_ClipDefaultsContent.tooltip, MessageType.Info);
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.LabelField (m_ClipDefaultsContent);
|
|
+ EditorGUILayout.LabelField (m_ClipDefaultsContent);
|
|
-
|
|
+
|
|
- EditorGUILayout.Space ();
|
|
+ EditorGUILayout.Space ();
|
|
-
|
|
+
|
|
- EditorGUILayout.LabelField (m_CDClipTimingContent);
|
|
+ EditorGUILayout.LabelField (m_CDClipTimingContent);
|
|
- EditorGUI.indentLevel++;
|
|
+ EditorGUI.indentLevel++;
|
|
- clipDefaultDurationSeconds = EditorGUILayout.FloatField(m_CDDurationContent, clipDefaultDurationSeconds);
|
|
+ clipDefaultDurationSeconds = EditorGUILayout.FloatField(m_CDDurationContent, clipDefaultDurationSeconds);
|
|
-
|
|
+
|
|
- EditorGUILayout.Space ();
|
|
+ EditorGUILayout.Space ();
|
|
-
|
|
+
|
|
- clipDefaultEaseInSeconds = EditorGUILayout.FloatField(m_CDEaseInContent, clipDefaultEaseInSeconds);
|
|
+ clipDefaultEaseInSeconds = EditorGUILayout.FloatField(m_CDEaseInContent, clipDefaultEaseInSeconds);
|
|
- clipDefaultEaseOutSeconds = EditorGUILayout.FloatField (m_CDEaseOutContent, clipDefaultEaseOutSeconds);
|
|
+ clipDefaultEaseOutSeconds = EditorGUILayout.FloatField (m_CDEaseOutContent, clipDefaultEaseOutSeconds);
|
|
-
|
|
+
|
|
- if (isStandardBlendPlayable)
|
|
+ if (isStandardBlendPlayable)
|
|
- {
|
|
+ {
|
|
- EditorGUILayout.EndVertical();
|
|
+ EditorGUILayout.EndVertical();
|
|
- return;
|
|
+ return;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- clipDefaultClipInSeconds = EditorGUILayout.FloatField(m_CDClipInContent, clipDefaultClipInSeconds);
|
|
+ clipDefaultClipInSeconds = EditorGUILayout.FloatField(m_CDClipInContent, clipDefaultClipInSeconds);
|
|
-
|
|
+
|
|
- EditorGUILayout.Space();
|
|
+ EditorGUILayout.Space();
|
|
-
|
|
+
|
|
- clipDefaultSpeedMultiplier = EditorGUILayout.FloatField(m_CDSpeedMultiplierContent, clipDefaultSpeedMultiplier);
|
|
+ clipDefaultSpeedMultiplier = EditorGUILayout.FloatField(m_CDSpeedMultiplierContent, clipDefaultSpeedMultiplier);
|
|
- EditorGUI.indentLevel--;
|
|
+ EditorGUI.indentLevel--;
|
|
-
|
|
+
|
|
- EditorGUILayout.EndVertical();
|
|
+ EditorGUILayout.EndVertical();
|
|
- }*/
|
|
+ }*/
|
|
-
|
|
+
|
|
- CreationError CreateScripts ()
|
|
+ CreationError CreateScripts ()
|
|
- {
|
|
+ {
|
|
- if (ScriptAlreadyExists(playableName + k_TimelineClipAssetSuffix))
|
|
+ if (ScriptAlreadyExists(playableName + k_TimelineClipAssetSuffix))
|
|
- return CreationError.PlayableAssetAlreadyExists;
|
|
+ return CreationError.PlayableAssetAlreadyExists;
|
|
-
|
|
+
|
|
- if (ScriptAlreadyExists(playableName + k_TimelineClipBehaviourSuffix))
|
|
+ if (ScriptAlreadyExists(playableName + k_TimelineClipBehaviourSuffix))
|
|
- return CreationError.PlayableBehaviourAlreadyExists;
|
|
+ return CreationError.PlayableBehaviourAlreadyExists;
|
|
-
|
|
+
|
|
- if (ScriptAlreadyExists(playableName + k_PlayableBehaviourMixerSuffix))
|
|
+ if (ScriptAlreadyExists(playableName + k_PlayableBehaviourMixerSuffix))
|
|
- return CreationError.PlayableBehaviourMixerAlreadyExists;
|
|
+ return CreationError.PlayableBehaviourMixerAlreadyExists;
|
|
-
|
|
+
|
|
- if (ScriptAlreadyExists(playableName + k_TrackAssetSuffix))
|
|
+ if (ScriptAlreadyExists(playableName + k_TrackAssetSuffix))
|
|
- return CreationError.TrackAssetAlreadyExists;
|
|
+ return CreationError.TrackAssetAlreadyExists;
|
|
-
|
|
+
|
|
- if (m_CreateDrawer && ScriptAlreadyExists(playableName + k_PropertyDrawerSuffix))
|
|
+ if (m_CreateDrawer && ScriptAlreadyExists(playableName + k_PropertyDrawerSuffix))
|
|
- return CreationError.PlayableDrawerAlreadyExists;
|
|
+ return CreationError.PlayableDrawerAlreadyExists;
|
|
-
|
|
+
|
|
- AssetDatabase.CreateFolder ("Assets", playableName);
|
|
+ AssetDatabase.CreateFolder ("Assets", playableName);
|
|
-
|
|
+
|
|
- if (isStandardBlendPlayable)
|
|
+ if (isStandardBlendPlayable)
|
|
- {
|
|
+ {
|
|
- CreateScript (playableName + k_TimelineClipAssetSuffix, StandardBlendPlayableAsset());
|
|
+ CreateScript (playableName + k_TimelineClipAssetSuffix, StandardBlendPlayableAsset());
|
|
- CreateScript (playableName + k_TimelineClipBehaviourSuffix, StandardBlendPlayableBehaviour ());
|
|
+ CreateScript (playableName + k_TimelineClipBehaviourSuffix, StandardBlendPlayableBehaviour ());
|
|
- CreateScript (playableName + k_PlayableBehaviourMixerSuffix, StandardBlendPlayableBehaviourMixer ());
|
|
+ CreateScript (playableName + k_PlayableBehaviourMixerSuffix, StandardBlendPlayableBehaviourMixer ());
|
|
- CreateScript (playableName + k_TrackAssetSuffix, StandardBlendTrackAssetScript ());
|
|
+ CreateScript (playableName + k_TrackAssetSuffix, StandardBlendTrackAssetScript ());
|
|
-
|
|
+
|
|
- AssetDatabase.CreateFolder ("Assets/" + playableName, "Editor");
|
|
+ AssetDatabase.CreateFolder ("Assets/" + playableName, "Editor");
|
|
-
|
|
+
|
|
- string path = Application.dataPath + "/" + playableName + "/Editor/" + playableName + k_PropertyDrawerSuffix + ".cs";
|
|
+ string path = Application.dataPath + "/" + playableName + "/Editor/" + playableName + k_PropertyDrawerSuffix + ".cs";
|
|
- using (StreamWriter writer = File.CreateText (path))
|
|
+ using (StreamWriter writer = File.CreateText (path))
|
|
- {
|
|
+ {
|
|
- writer.Write (StandardBlendPlayableDrawer ());
|
|
+ writer.Write (StandardBlendPlayableDrawer ());
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
- else
|
|
+ else
|
|
- {
|
|
+ {
|
|
- CreateScript(playableName + k_TimelineClipAssetSuffix, PlayableAsset());
|
|
+ CreateScript(playableName + k_TimelineClipAssetSuffix, PlayableAsset());
|
|
- CreateScript(playableName + k_TimelineClipBehaviourSuffix, PlayableBehaviour());
|
|
+ CreateScript(playableName + k_TimelineClipBehaviourSuffix, PlayableBehaviour());
|
|
- CreateScript(playableName + k_PlayableBehaviourMixerSuffix, PlayableBehaviourMixer());
|
|
+ CreateScript(playableName + k_PlayableBehaviourMixerSuffix, PlayableBehaviourMixer());
|
|
- CreateScript(playableName + k_TrackAssetSuffix, TrackAssetScript());
|
|
+ CreateScript(playableName + k_TrackAssetSuffix, TrackAssetScript());
|
|
-
|
|
+
|
|
- if (m_CreateDrawer)
|
|
+ if (m_CreateDrawer)
|
|
- {
|
|
+ {
|
|
- AssetDatabase.CreateFolder("Assets/" + playableName, "Editor");
|
|
+ AssetDatabase.CreateFolder("Assets/" + playableName, "Editor");
|
|
-
|
|
+
|
|
- string path = Application.dataPath + "/" + playableName + "/Editor/" + playableName + k_PropertyDrawerSuffix + ".cs";
|
|
+ string path = Application.dataPath + "/" + playableName + "/Editor/" + playableName + k_PropertyDrawerSuffix + ".cs";
|
|
- using (StreamWriter writer = File.CreateText(path))
|
|
+ using (StreamWriter writer = File.CreateText(path))
|
|
- {
|
|
+ {
|
|
- writer.Write(PlayableDrawer());
|
|
+ writer.Write(PlayableDrawer());
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- AssetDatabase.SaveAssets ();
|
|
+ AssetDatabase.SaveAssets ();
|
|
- AssetDatabase.Refresh ();
|
|
+ AssetDatabase.Refresh ();
|
|
-
|
|
+
|
|
- return CreationError.NoError;
|
|
+ return CreationError.NoError;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- static bool ScriptAlreadyExists(string scriptName)
|
|
+ static bool ScriptAlreadyExists(string scriptName)
|
|
- {
|
|
+ {
|
|
- string[] guids = AssetDatabase.FindAssets(scriptName);
|
|
+ string[] guids = AssetDatabase.FindAssets(scriptName);
|
|
-
|
|
+
|
|
- if (guids.Length == 0)
|
|
+ if (guids.Length == 0)
|
|
- return false;
|
|
+ return false;
|
|
-
|
|
+
|
|
- for (int i = 0; i < guids.Length; i++)
|
|
+ for (int i = 0; i < guids.Length; i++)
|
|
- {
|
|
+ {
|
|
- string path = AssetDatabase.GUIDToAssetPath(guids[i]);
|
|
+ string path = AssetDatabase.GUIDToAssetPath(guids[i]);
|
|
- Type assetType = AssetDatabase.GetMainAssetTypeAtPath(path);
|
|
+ Type assetType = AssetDatabase.GetMainAssetTypeAtPath(path);
|
|
- if (assetType == typeof(MonoScript))
|
|
+ if (assetType == typeof(MonoScript))
|
|
- return true;
|
|
+ return true;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- return false;
|
|
+ return false;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- void CreateScript (string fileName, string content)
|
|
+ void CreateScript (string fileName, string content)
|
|
- {
|
|
+ {
|
|
- string path = Application.dataPath + "/" + playableName + "/" + fileName + ".cs";
|
|
+ string path = Application.dataPath + "/" + playableName + "/" + fileName + ".cs";
|
|
- using (StreamWriter writer = File.CreateText (path))
|
|
+ using (StreamWriter writer = File.CreateText (path))
|
|
- writer.Write (content);
|
|
+ writer.Write (content);
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- void ResetWindow ()
|
|
+ void ResetWindow ()
|
|
- {
|
|
+ {
|
|
- playableName = "";
|
|
+ playableName = "";
|
|
- isStandardBlendPlayable = false;
|
|
+ isStandardBlendPlayable = false;
|
|
- trackBinding = s_TrackBindingTypes[0];
|
|
+ trackBinding = s_TrackBindingTypes[0];
|
|
- defaultValuesComponent = null;
|
|
+ defaultValuesComponent = null;
|
|
- exposedReferences = new List<Variable>();
|
|
+ exposedReferences = new List<Variable>();
|
|
- playableBehaviourVariables = new List<Variable>();
|
|
+ playableBehaviourVariables = new List<Variable>();
|
|
- standardBlendPlayableProperties = new List<UsableProperty>();
|
|
+ standardBlendPlayableProperties = new List<UsableProperty>();
|
|
- clipCaps = ClipCaps.None;
|
|
+ clipCaps = ClipCaps.None;
|
|
-
|
|
+
|
|
- clipDefaultDurationSeconds = 5f;
|
|
+ clipDefaultDurationSeconds = 5f;
|
|
- clipDefaultEaseInSeconds = 0f;
|
|
+ clipDefaultEaseInSeconds = 0f;
|
|
- clipDefaultEaseOutSeconds = 0f;
|
|
+ clipDefaultEaseOutSeconds = 0f;
|
|
- clipDefaultClipInSeconds = 0f;
|
|
+ clipDefaultClipInSeconds = 0f;
|
|
- clipDefaultSpeedMultiplier = 1f;*/
|
|
+ clipDefaultSpeedMultiplier = 1f;*/
|
|
- trackColor = new Color(0.855f, 0.8623f, 0.870f);
|
|
+ trackColor = new Color(0.855f, 0.8623f, 0.870f);
|
|
-
|
|
+
|
|
- m_TrackBindingTypeIndex = 0;
|
|
+ m_TrackBindingTypeIndex = 0;
|
|
- m_ComponentBindingTypeIndex = 0;
|
|
+ m_ComponentBindingTypeIndex = 0;
|
|
- m_TrackBindingProperties = null;
|
|
+ m_TrackBindingProperties = null;
|
|
- m_TrackBindingFields = null;
|
|
+ m_TrackBindingFields = null;
|
|
- m_TrackBindingUsableProperties = null;
|
|
+ m_TrackBindingUsableProperties = null;
|
|
- m_CreateDrawer = false;
|
|
+ m_CreateDrawer = false;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string TrackAssetScript ()
|
|
+ string TrackAssetScript ()
|
|
- {
|
|
+ {
|
|
- return
|
|
+ return
|
|
- "using UnityEngine;\n" +
|
|
+ "using UnityEngine;\n" +
|
|
- "using UnityEngine.Playables;\n" +
|
|
+ "using UnityEngine.Playables;\n" +
|
|
- "using UnityEngine.Timeline;\n" +
|
|
+ "using UnityEngine.Timeline;\n" +
|
|
- AdditionalNamespacesToString() +
|
|
+ AdditionalNamespacesToString() +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- "[TrackColor(" + trackColor.r + "f, " + trackColor.g + "f, " + trackColor.b + "f)]\n" +
|
|
+ "[TrackColor(" + trackColor.r + "f, " + trackColor.g + "f, " + trackColor.b + "f)]\n" +
|
|
- "[TrackClipType(typeof(" + playableName + k_TimelineClipAssetSuffix + "))]\n" +
|
|
+ "[TrackClipType(typeof(" + playableName + k_TimelineClipAssetSuffix + "))]\n" +
|
|
- TrackBindingToString () +
|
|
+ TrackBindingToString () +
|
|
- "public class " + playableName + k_TrackAssetSuffix + " : TrackAsset\n" +
|
|
+ "public class " + playableName + k_TrackAssetSuffix + " : TrackAsset\n" +
|
|
- "{\n" +
|
|
+ "{\n" +
|
|
- k_Tab + "public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)\n" +
|
|
+ k_Tab + "public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + "return ScriptPlayable<" + playableName + k_PlayableBehaviourMixerSuffix + ">.Create (graph, inputCount);\n" +
|
|
+ k_Tab + k_Tab + "return ScriptPlayable<" + playableName + k_PlayableBehaviourMixerSuffix + ">.Create (graph, inputCount);\n" +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "}\n";
|
|
+ "}\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string PlayableAsset ()
|
|
+ string PlayableAsset ()
|
|
- {
|
|
+ {
|
|
- return
|
|
+ return
|
|
- "using System;\n" +
|
|
+ "using System;\n" +
|
|
- "using UnityEngine;\n" +
|
|
+ "using UnityEngine;\n" +
|
|
- "using UnityEngine.Playables;\n" +
|
|
+ "using UnityEngine.Playables;\n" +
|
|
- "using UnityEngine.Timeline;\n" +
|
|
+ "using UnityEngine.Timeline;\n" +
|
|
- AdditionalNamespacesToString() +
|
|
+ AdditionalNamespacesToString() +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- "[Serializable]\n" +
|
|
+ "[Serializable]\n" +
|
|
- "public class " + playableName + k_TimelineClipAssetSuffix + " : PlayableAsset, ITimelineClipAsset\n" +
|
|
+ "public class " + playableName + k_TimelineClipAssetSuffix + " : PlayableAsset, ITimelineClipAsset\n" +
|
|
- "{\n" +
|
|
+ "{\n" +
|
|
- k_Tab + "public " + playableName + k_TimelineClipBehaviourSuffix + " template = new " + playableName + k_TimelineClipBehaviourSuffix + " ();\n" +
|
|
+ k_Tab + "public " + playableName + k_TimelineClipBehaviourSuffix + " template = new " + playableName + k_TimelineClipBehaviourSuffix + " ();\n" +
|
|
- ExposedReferencesToString () +
|
|
+ ExposedReferencesToString () +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + "public ClipCaps clipCaps\n" +
|
|
+ k_Tab + "public ClipCaps clipCaps\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + "get { return " + ClipCapsToString () + "; }\n" +
|
|
+ k_Tab + k_Tab + "get { return " + ClipCapsToString () + "; }\n" +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + "public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)\n" +
|
|
+ k_Tab + "public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + "var playable = ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">.Create (graph, template);\n" +
|
|
+ k_Tab + k_Tab + "var playable = ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">.Create (graph, template);\n" +
|
|
- ExposedReferencesResolvingToString () +
|
|
+ ExposedReferencesResolvingToString () +
|
|
- k_Tab + k_Tab + "return playable;\n" +
|
|
+ k_Tab + k_Tab + "return playable;\n" +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "}\n";
|
|
+ "}\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string PlayableBehaviour ()
|
|
+ string PlayableBehaviour ()
|
|
- {
|
|
+ {
|
|
- return
|
|
+ return
|
|
- "using System;\n" +
|
|
+ "using System;\n" +
|
|
- "using UnityEngine;\n" +
|
|
+ "using UnityEngine;\n" +
|
|
- "using UnityEngine.Playables;\n" +
|
|
+ "using UnityEngine.Playables;\n" +
|
|
- "using UnityEngine.Timeline;\n" +
|
|
+ "using UnityEngine.Timeline;\n" +
|
|
- AdditionalNamespacesToString() +
|
|
+ AdditionalNamespacesToString() +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- "[Serializable]\n" +
|
|
+ "[Serializable]\n" +
|
|
- "public class " + playableName + k_TimelineClipBehaviourSuffix + " : PlayableBehaviour\n" +
|
|
+ "public class " + playableName + k_TimelineClipBehaviourSuffix + " : PlayableBehaviour\n" +
|
|
- "{\n" +
|
|
+ "{\n" +
|
|
- ExposedReferencesAsScriptVariablesToString () +
|
|
+ ExposedReferencesAsScriptVariablesToString () +
|
|
- PlayableBehaviourVariablesToString () +
|
|
+ PlayableBehaviourVariablesToString () +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + "public override void OnPlayableCreate (Playable playable)\n" +
|
|
+ k_Tab + "public override void OnPlayableCreate (Playable playable)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + "\n" +
|
|
+ k_Tab + k_Tab + "\n" +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "}\n";
|
|
+ "}\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string PlayableBehaviourMixer ()
|
|
+ string PlayableBehaviourMixer ()
|
|
- {
|
|
+ {
|
|
- return
|
|
+ return
|
|
- "using System;\n" +
|
|
+ "using System;\n" +
|
|
- "using UnityEngine;\n" +
|
|
+ "using UnityEngine;\n" +
|
|
- "using UnityEngine.Playables;\n" +
|
|
+ "using UnityEngine.Playables;\n" +
|
|
- "using UnityEngine.Timeline;\n" +
|
|
+ "using UnityEngine.Timeline;\n" +
|
|
- AdditionalNamespacesToString() +
|
|
+ AdditionalNamespacesToString() +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- "public class " + playableName + k_PlayableBehaviourMixerSuffix + " : PlayableBehaviour\n" +
|
|
+ "public class " + playableName + k_PlayableBehaviourMixerSuffix + " : PlayableBehaviour\n" +
|
|
- "{\n" +
|
|
+ "{\n" +
|
|
- k_Tab + "// NOTE: This function is called at runtime and edit time. Keep that in mind when setting the values of properties.\n" +
|
|
+ k_Tab + "// NOTE: This function is called at runtime and edit time. Keep that in mind when setting the values of properties.\n" +
|
|
- k_Tab + "public override void ProcessFrame(Playable playable, FrameData info, object playerData)\n" +
|
|
+ k_Tab + "public override void ProcessFrame(Playable playable, FrameData info, object playerData)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- MixerTrackBindingLocalVariableToString () +
|
|
+ MixerTrackBindingLocalVariableToString () +
|
|
- k_Tab + k_Tab + "int inputCount = playable.GetInputCount ();\n" +
|
|
+ k_Tab + k_Tab + "int inputCount = playable.GetInputCount ();\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + k_Tab + "for (int i = 0; i < inputCount; i++)\n" +
|
|
+ k_Tab + k_Tab + "for (int i = 0; i < inputCount; i++)\n" +
|
|
- k_Tab + k_Tab + "{\n" +
|
|
+ k_Tab + k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + k_Tab + "float inputWeight = playable.GetInputWeight(i);\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "float inputWeight = playable.GetInputWeight(i);\n" +
|
|
- k_Tab + k_Tab + k_Tab + "ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + "> inputPlayable = (ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">)playable.GetInput(i);\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + "> inputPlayable = (ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">)playable.GetInput(i);\n" +
|
|
- k_Tab + k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " input = inputPlayable.GetBehaviour ();\n" +
|
|
+ k_Tab + k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " input = inputPlayable.GetBehaviour ();\n" +
|
|
- k_Tab + k_Tab + k_Tab + "\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "\n" +
|
|
- k_Tab + k_Tab + k_Tab + "// Use the above variables to process each frame of this playable.\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "// Use the above variables to process each frame of this playable.\n" +
|
|
- k_Tab + k_Tab + k_Tab + "\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "\n" +
|
|
- k_Tab + k_Tab + "}\n" +
|
|
+ k_Tab + k_Tab + "}\n" +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "}\n";
|
|
+ "}\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string PlayableDrawer ()
|
|
+ string PlayableDrawer ()
|
|
- {
|
|
+ {
|
|
- return
|
|
+ return
|
|
- "using UnityEditor;\n" +
|
|
+ "using UnityEditor;\n" +
|
|
- "using UnityEngine;\n" +
|
|
+ "using UnityEngine;\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- "[CustomPropertyDrawer(typeof(" + playableName + k_TimelineClipBehaviourSuffix + "))]\n" +
|
|
+ "[CustomPropertyDrawer(typeof(" + playableName + k_TimelineClipBehaviourSuffix + "))]\n" +
|
|
- "public class " + playableName + k_PropertyDrawerSuffix + " : PropertyDrawer\n" +
|
|
+ "public class " + playableName + k_PropertyDrawerSuffix + " : PropertyDrawer\n" +
|
|
- "{\n" +
|
|
+ "{\n" +
|
|
- k_Tab + "public override float GetPropertyHeight (SerializedProperty property, GUIContent label)\n" +
|
|
+ k_Tab + "public override float GetPropertyHeight (SerializedProperty property, GUIContent label)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + "int fieldCount = " + playableBehaviourVariables.Count +";\n" +
|
|
+ k_Tab + k_Tab + "int fieldCount = " + playableBehaviourVariables.Count +";\n" +
|
|
- k_Tab + k_Tab + "return fieldCount * EditorGUIUtility.singleLineHeight;\n" +
|
|
+ k_Tab + k_Tab + "return fieldCount * EditorGUIUtility.singleLineHeight;\n" +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + "public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)\n" +
|
|
+ k_Tab + "public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- ScriptVariablesAsSerializedPropAssignmentToString () +
|
|
+ ScriptVariablesAsSerializedPropAssignmentToString () +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + k_Tab + "Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);\n" +
|
|
+ k_Tab + k_Tab + "Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);\n" +
|
|
- ScriptVariablesAsSerializedPropGUIToString () +
|
|
+ ScriptVariablesAsSerializedPropGUIToString () +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "}\n";
|
|
+ "}\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string TrackBindingToString ()
|
|
+ string TrackBindingToString ()
|
|
- {
|
|
+ {
|
|
- if (m_TrackBindingTypeIndex != 0)
|
|
+ if (m_TrackBindingTypeIndex != 0)
|
|
- return "[TrackBindingType(typeof(" + trackBinding.name + "))]\n";
|
|
+ return "[TrackBindingType(typeof(" + trackBinding.name + "))]\n";
|
|
- return "";
|
|
+ return "";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string AdditionalNamespacesToString ()
|
|
+ string AdditionalNamespacesToString ()
|
|
- {
|
|
+ {
|
|
- UsableType[] exposedReferenceTypes = Variable.GetUsableTypesFromVariableArray (exposedReferences.ToArray ());
|
|
+ UsableType[] exposedReferenceTypes = Variable.GetUsableTypesFromVariableArray (exposedReferences.ToArray ());
|
|
- UsableType[] behaviourVariableTypes = Variable.GetUsableTypesFromVariableArray (playableBehaviourVariables.ToArray ());
|
|
+ UsableType[] behaviourVariableTypes = Variable.GetUsableTypesFromVariableArray (playableBehaviourVariables.ToArray ());
|
|
- UsableType[] allUsedTypes = new UsableType[exposedReferenceTypes.Length + behaviourVariableTypes.Length + 1];
|
|
+ UsableType[] allUsedTypes = new UsableType[exposedReferenceTypes.Length + behaviourVariableTypes.Length + 1];
|
|
- for (int i = 0; i < exposedReferenceTypes.Length; i++)
|
|
+ for (int i = 0; i < exposedReferenceTypes.Length; i++)
|
|
- {
|
|
+ {
|
|
- allUsedTypes[i] = exposedReferenceTypes[i];
|
|
+ allUsedTypes[i] = exposedReferenceTypes[i];
|
|
- }
|
|
+ }
|
|
- for (int i = 0; i < behaviourVariableTypes.Length; i++)
|
|
+ for (int i = 0; i < behaviourVariableTypes.Length; i++)
|
|
- {
|
|
+ {
|
|
- allUsedTypes[i + exposedReferenceTypes.Length] = behaviourVariableTypes[i];
|
|
+ allUsedTypes[i + exposedReferenceTypes.Length] = behaviourVariableTypes[i];
|
|
- }
|
|
+ }
|
|
- allUsedTypes[allUsedTypes.Length - 1] = trackBinding;
|
|
+ allUsedTypes[allUsedTypes.Length - 1] = trackBinding;
|
|
-
|
|
+
|
|
- string[] distinctNamespaces = UsableType.GetDistinctAdditionalNamespaces (allUsedTypes).Where (x => !string.IsNullOrEmpty (x)).ToArray ();
|
|
+ string[] distinctNamespaces = UsableType.GetDistinctAdditionalNamespaces (allUsedTypes).Where (x => !string.IsNullOrEmpty (x)).ToArray ();
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < distinctNamespaces.Length; i++)
|
|
+ for (int i = 0; i < distinctNamespaces.Length; i++)
|
|
- {
|
|
+ {
|
|
- returnVal += "using " + distinctNamespaces[i] + ";\n";
|
|
+ returnVal += "using " + distinctNamespaces[i] + ";\n";
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string ExposedReferencesToString ()
|
|
+ string ExposedReferencesToString ()
|
|
- {
|
|
+ {
|
|
- string expRefText = "";
|
|
+ string expRefText = "";
|
|
- foreach (var expRef in exposedReferences)
|
|
+ foreach (var expRef in exposedReferences)
|
|
- expRefText += k_Tab + "public ExposedReference<" + expRef.usableType.name + "> " + expRef.name + ";\n";
|
|
+ expRefText += k_Tab + "public ExposedReference<" + expRef.usableType.name + "> " + expRef.name + ";\n";
|
|
- return expRefText;
|
|
+ return expRefText;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string ExposedReferencesResolvingToString ()
|
|
+ string ExposedReferencesResolvingToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- returnVal += k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " clone = playable.GetBehaviour ();\n";
|
|
+ returnVal += k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " clone = playable.GetBehaviour ();\n";
|
|
- for (int i = 0; i < exposedReferences.Count; i++)
|
|
+ for (int i = 0; i < exposedReferences.Count; i++)
|
|
- {
|
|
+ {
|
|
- returnVal += k_Tab + k_Tab + "clone." + exposedReferences[i].name + " = " + exposedReferences[i].name + ".Resolve (graph.GetResolver ());\n";
|
|
+ returnVal += k_Tab + k_Tab + "clone." + exposedReferences[i].name + " = " + exposedReferences[i].name + ".Resolve (graph.GetResolver ());\n";
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- {
|
|
+ {
|
|
- if (!setClipDefaults)
|
|
+ if (!setClipDefaults)
|
|
- return "";
|
|
+ return "";
|
|
-
|
|
+
|
|
- string returnVal = "\n";
|
|
+ string returnVal = "\n";
|
|
- returnVal += k_Tab + "public override void OnCreate ()\n";
|
|
+ returnVal += k_Tab + "public override void OnCreate ()\n";
|
|
- returnVal += k_Tab + "{\n";
|
|
+ returnVal += k_Tab + "{\n";
|
|
- returnVal += k_Tab + k_Tab + "owner.duration = " + clipDefaultDurationSeconds + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + "owner.duration = " + clipDefaultDurationSeconds + ";\n";
|
|
- returnVal += k_Tab + k_Tab + "owner.easeInDuration = " + clipDefaultEaseInSeconds + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + "owner.easeInDuration = " + clipDefaultEaseInSeconds + ";\n";
|
|
- returnVal += k_Tab + k_Tab + "owner.easeOutDuration = " + clipDefaultEaseOutSeconds + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + "owner.easeOutDuration = " + clipDefaultEaseOutSeconds + ";\n";
|
|
- returnVal += k_Tab + k_Tab + "owner.clipIn = " + clipDefaultClipInSeconds + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + "owner.clipIn = " + clipDefaultClipInSeconds + ";\n";
|
|
- returnVal += k_Tab + k_Tab + "owner.timeScale = " + clipDefaultSpeedMultiplier + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + "owner.timeScale = " + clipDefaultSpeedMultiplier + ";\n";
|
|
- returnVal += k_Tab + "}\n";
|
|
+ returnVal += k_Tab + "}\n";
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }*/
|
|
+ }*/
|
|
-
|
|
+
|
|
- string ClipCapsToString ()
|
|
+ string ClipCapsToString ()
|
|
- {
|
|
+ {
|
|
- string message = clipCaps.ToString ();
|
|
+ string message = clipCaps.ToString ();
|
|
- string[] splits = message.Split (' ');
|
|
+ string[] splits = message.Split (' ');
|
|
-
|
|
+
|
|
- for (int i = 0; i < splits.Length; i++)
|
|
+ for (int i = 0; i < splits.Length; i++)
|
|
- {
|
|
+ {
|
|
- if (splits[i][splits[i].Length - 1] == ',')
|
|
+ if (splits[i][splits[i].Length - 1] == ',')
|
|
- splits[i] = splits[i].Substring (0, splits[i].Length - 1);
|
|
+ splits[i] = splits[i].Substring (0, splits[i].Length - 1);
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
-
|
|
+
|
|
- for (int i = 0; i < splits.Length; i++)
|
|
+ for (int i = 0; i < splits.Length; i++)
|
|
- {
|
|
+ {
|
|
- returnVal += "ClipCaps." + splits[i];
|
|
+ returnVal += "ClipCaps." + splits[i];
|
|
-
|
|
+
|
|
- if (i < splits.Length - 1)
|
|
+ if (i < splits.Length - 1)
|
|
- returnVal += " | ";
|
|
+ returnVal += " | ";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string ExposedReferencesAsScriptVariablesToString ()
|
|
+ string ExposedReferencesAsScriptVariablesToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < exposedReferences.Count; i++)
|
|
+ for (int i = 0; i < exposedReferences.Count; i++)
|
|
- {
|
|
+ {
|
|
- returnVal += k_Tab + "public " + exposedReferences[i].usableType.name + " " + exposedReferences[i].name + ";\n";
|
|
+ returnVal += k_Tab + "public " + exposedReferences[i].usableType.name + " " + exposedReferences[i].name + ";\n";
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string PlayableBehaviourVariablesToString ()
|
|
+ string PlayableBehaviourVariablesToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < playableBehaviourVariables.Count; i++)
|
|
+ for (int i = 0; i < playableBehaviourVariables.Count; i++)
|
|
- {
|
|
+ {
|
|
- returnVal += k_Tab + "public " + playableBehaviourVariables[i].usableType.name + " " + playableBehaviourVariables[i].name + ";\n";
|
|
+ returnVal += k_Tab + "public " + playableBehaviourVariables[i].usableType.name + " " + playableBehaviourVariables[i].name + ";\n";
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string MixerTrackBindingLocalVariableToString ()
|
|
+ string MixerTrackBindingLocalVariableToString ()
|
|
- {
|
|
+ {
|
|
- if (m_TrackBindingTypeIndex != 0)
|
|
+ if (m_TrackBindingTypeIndex != 0)
|
|
- return
|
|
+ return
|
|
- k_Tab + k_Tab + trackBinding.name + " trackBinding = playerData as " + trackBinding.name + ";\n\n" +
|
|
+ k_Tab + k_Tab + trackBinding.name + " trackBinding = playerData as " + trackBinding.name + ";\n\n" +
|
|
- k_Tab + k_Tab + "if (!trackBinding)\n" +
|
|
+ k_Tab + k_Tab + "if (!trackBinding)\n" +
|
|
- k_Tab + k_Tab + k_Tab + "return;\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "return;\n" +
|
|
- "\n";
|
|
+ "\n";
|
|
- return "";
|
|
+ return "";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string ScriptVariablesAsSerializedPropAssignmentToString ()
|
|
+ string ScriptVariablesAsSerializedPropAssignmentToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < playableBehaviourVariables.Count; i++)
|
|
+ for (int i = 0; i < playableBehaviourVariables.Count; i++)
|
|
- {
|
|
+ {
|
|
- returnVal += k_Tab + k_Tab + "SerializedProperty " + playableBehaviourVariables[i].name + "Prop = property.FindPropertyRelative(\"" + playableBehaviourVariables[i].name + "\");\n";
|
|
+ returnVal += k_Tab + k_Tab + "SerializedProperty " + playableBehaviourVariables[i].name + "Prop = property.FindPropertyRelative(\"" + playableBehaviourVariables[i].name + "\");\n";
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string ScriptVariablesAsSerializedPropGUIToString ()
|
|
+ string ScriptVariablesAsSerializedPropGUIToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < playableBehaviourVariables.Count; i++)
|
|
+ for (int i = 0; i < playableBehaviourVariables.Count; i++)
|
|
- {
|
|
+ {
|
|
- returnVal += k_Tab + k_Tab + "EditorGUI.PropertyField(singleFieldRect, " + playableBehaviourVariables[i].name + "Prop);\n";
|
|
+ returnVal += k_Tab + k_Tab + "EditorGUI.PropertyField(singleFieldRect, " + playableBehaviourVariables[i].name + "Prop);\n";
|
|
-
|
|
+
|
|
- if (i < playableBehaviourVariables.Count - 1)
|
|
+ if (i < playableBehaviourVariables.Count - 1)
|
|
- {
|
|
+ {
|
|
- returnVal += "\n";
|
|
+ returnVal += "\n";
|
|
- returnVal += k_Tab + k_Tab + "singleFieldRect.y += EditorGUIUtility.singleLineHeight;\n";
|
|
+ returnVal += k_Tab + k_Tab + "singleFieldRect.y += EditorGUIUtility.singleLineHeight;\n";
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendPlayableAsset ()
|
|
+ string StandardBlendPlayableAsset ()
|
|
- {
|
|
+ {
|
|
- return
|
|
+ return
|
|
- "using System;\n" +
|
|
+ "using System;\n" +
|
|
- "using UnityEngine;\n" +
|
|
+ "using UnityEngine;\n" +
|
|
- "using UnityEngine.Playables;\n" +
|
|
+ "using UnityEngine.Playables;\n" +
|
|
- "using UnityEngine.Timeline;\n" +
|
|
+ "using UnityEngine.Timeline;\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- "[Serializable]\n" +
|
|
+ "[Serializable]\n" +
|
|
- "public class " + playableName + k_TimelineClipAssetSuffix + " : PlayableAsset, ITimelineClipAsset\n" +
|
|
+ "public class " + playableName + k_TimelineClipAssetSuffix + " : PlayableAsset, ITimelineClipAsset\n" +
|
|
- "{\n" +
|
|
+ "{\n" +
|
|
- k_Tab + "public " + playableName + k_TimelineClipBehaviourSuffix + " template = new " + playableName + k_TimelineClipBehaviourSuffix + " ();\n" +
|
|
+ k_Tab + "public " + playableName + k_TimelineClipBehaviourSuffix + " template = new " + playableName + k_TimelineClipBehaviourSuffix + " ();\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + "public ClipCaps clipCaps\n" +
|
|
+ k_Tab + "public ClipCaps clipCaps\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + "get { return ClipCaps.Blending; }\n" +
|
|
+ k_Tab + k_Tab + "get { return ClipCaps.Blending; }\n" +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + "public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)\n" +
|
|
+ k_Tab + "public override Playable CreatePlayable (PlayableGraph graph, GameObject owner)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + "var playable = ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">.Create (graph, template);\n" +
|
|
+ k_Tab + k_Tab + "var playable = ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">.Create (graph, template);\n" +
|
|
- k_Tab + k_Tab + "return playable;\n" +
|
|
+ k_Tab + k_Tab + "return playable;\n" +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "}\n";
|
|
+ "}\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendPlayableBehaviour ()
|
|
+ string StandardBlendPlayableBehaviour ()
|
|
- {
|
|
+ {
|
|
- return
|
|
+ return
|
|
- "using System;\n" +
|
|
+ "using System;\n" +
|
|
- "using UnityEngine;\n" +
|
|
+ "using UnityEngine;\n" +
|
|
- "using UnityEngine.Playables;\n" +
|
|
+ "using UnityEngine.Playables;\n" +
|
|
- "using UnityEngine.Timeline;\n" +
|
|
+ "using UnityEngine.Timeline;\n" +
|
|
- AdditionalNamespacesToString() +
|
|
+ AdditionalNamespacesToString() +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- "[Serializable]\n" +
|
|
+ "[Serializable]\n" +
|
|
- "public class " + playableName + k_TimelineClipBehaviourSuffix + " : PlayableBehaviour\n" +
|
|
+ "public class " + playableName + k_TimelineClipBehaviourSuffix + " : PlayableBehaviour\n" +
|
|
- "{\n" +
|
|
+ "{\n" +
|
|
- StandardBlendScriptPlayablePropertiesToString () +
|
|
+ StandardBlendScriptPlayablePropertiesToString () +
|
|
- "}\n";
|
|
+ "}\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendPlayableBehaviourMixer ()
|
|
+ string StandardBlendPlayableBehaviourMixer ()
|
|
- {
|
|
+ {
|
|
- return
|
|
+ return
|
|
- "using System;\n" +
|
|
+ "using System;\n" +
|
|
- "using UnityEngine;\n" +
|
|
+ "using UnityEngine;\n" +
|
|
- "using UnityEngine.Playables;\n" +
|
|
+ "using UnityEngine.Playables;\n" +
|
|
- "using UnityEngine.Timeline;\n" +
|
|
+ "using UnityEngine.Timeline;\n" +
|
|
- AdditionalNamespacesToString() +
|
|
+ AdditionalNamespacesToString() +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- "public class " + playableName + k_PlayableBehaviourMixerSuffix + " : PlayableBehaviour\n" +
|
|
+ "public class " + playableName + k_PlayableBehaviourMixerSuffix + " : PlayableBehaviour\n" +
|
|
- "{\n" +
|
|
+ "{\n" +
|
|
- StandardBlendTrackBindingPropertiesDefaultsDeclarationToString () +
|
|
+ StandardBlendTrackBindingPropertiesDefaultsDeclarationToString () +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- StandardBlendTrackBindingPropertiesBlendedDeclarationToString () +
|
|
+ StandardBlendTrackBindingPropertiesBlendedDeclarationToString () +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + trackBinding.name + " m_TrackBinding;\n" +
|
|
+ k_Tab + trackBinding.name + " m_TrackBinding;\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + "public override void ProcessFrame(Playable playable, FrameData info, object playerData)\n" +
|
|
+ k_Tab + "public override void ProcessFrame(Playable playable, FrameData info, object playerData)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + "m_TrackBinding = playerData as " + trackBinding.name + ";\n" +
|
|
+ k_Tab + k_Tab + "m_TrackBinding = playerData as " + trackBinding.name + ";\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + k_Tab + "if (m_TrackBinding == null)\n" +
|
|
+ k_Tab + k_Tab + "if (m_TrackBinding == null)\n" +
|
|
- k_Tab + k_Tab + k_Tab + "return;\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "return;\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- StandardBlendTrackBindingPropertiesDefaultsAssignmentToString () +
|
|
+ StandardBlendTrackBindingPropertiesDefaultsAssignmentToString () +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + k_Tab + "int inputCount = playable.GetInputCount ();\n" +
|
|
+ k_Tab + k_Tab + "int inputCount = playable.GetInputCount ();\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- StandardBlendBlendedVariablesCreationToString () +
|
|
+ StandardBlendBlendedVariablesCreationToString () +
|
|
- k_Tab + k_Tab + "float totalWeight = 0f;\n" +
|
|
+ k_Tab + k_Tab + "float totalWeight = 0f;\n" +
|
|
- k_Tab + k_Tab + "float greatestWeight = 0f;\n" +
|
|
+ k_Tab + k_Tab + "float greatestWeight = 0f;\n" +
|
|
- StandardBlendPlayableCurrentInputsDeclarationToString () +
|
|
+ StandardBlendPlayableCurrentInputsDeclarationToString () +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + k_Tab + "for (int i = 0; i < inputCount; i++)\n" +
|
|
+ k_Tab + k_Tab + "for (int i = 0; i < inputCount; i++)\n" +
|
|
- k_Tab + k_Tab + "{\n" +
|
|
+ k_Tab + k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + k_Tab + "float inputWeight = playable.GetInputWeight(i);\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "float inputWeight = playable.GetInputWeight(i);\n" +
|
|
- k_Tab + k_Tab + k_Tab + "ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + "> inputPlayable = (ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">)playable.GetInput(i);\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + "> inputPlayable = (ScriptPlayable<" + playableName + k_TimelineClipBehaviourSuffix + ">)playable.GetInput(i);\n" +
|
|
- k_Tab + k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " input = inputPlayable.GetBehaviour ();\n" +
|
|
+ k_Tab + k_Tab + k_Tab + playableName + k_TimelineClipBehaviourSuffix + " input = inputPlayable.GetBehaviour ();\n" +
|
|
- k_Tab + k_Tab + k_Tab + "\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "\n" +
|
|
- StandardBlendBlendedVariablesWeightedIncrementationToString () +
|
|
+ StandardBlendBlendedVariablesWeightedIncrementationToString () +
|
|
- k_Tab + k_Tab + k_Tab + "totalWeight += inputWeight;\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "totalWeight += inputWeight;\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- StandardBlendAssignableVariablesAssignedBasedOnGreatestWeightToString () +
|
|
+ StandardBlendAssignableVariablesAssignedBasedOnGreatestWeightToString () +
|
|
- StandardBlendPlayableCurrentInputIterationToString () +
|
|
+ StandardBlendPlayableCurrentInputIterationToString () +
|
|
- k_Tab + k_Tab + "}\n" +
|
|
+ k_Tab + k_Tab + "}\n" +
|
|
- StandardBlendTrackBindingPropertiesBlendedAssignmentToString () +
|
|
+ StandardBlendTrackBindingPropertiesBlendedAssignmentToString () +
|
|
- StandardBlendTrackBindingPropertiesAssignableAssignmentToString () +
|
|
+ StandardBlendTrackBindingPropertiesAssignableAssignmentToString () +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "}\n";
|
|
+ "}\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendTrackAssetScript ()
|
|
+ string StandardBlendTrackAssetScript ()
|
|
- {
|
|
+ {
|
|
- return
|
|
+ return
|
|
- "using UnityEngine;\n" +
|
|
+ "using UnityEngine;\n" +
|
|
- "using UnityEngine.Playables;\n" +
|
|
+ "using UnityEngine.Playables;\n" +
|
|
- "using UnityEngine.Timeline;\n" +
|
|
+ "using UnityEngine.Timeline;\n" +
|
|
- "using System.Collections.Generic;\n" +
|
|
+ "using System.Collections.Generic;\n" +
|
|
- AdditionalNamespacesToString() +
|
|
+ AdditionalNamespacesToString() +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- "[TrackColor(" + trackColor.r + "f, " + trackColor.g + "f, " + trackColor.b + "f)]\n" +
|
|
+ "[TrackColor(" + trackColor.r + "f, " + trackColor.g + "f, " + trackColor.b + "f)]\n" +
|
|
- "[TrackClipType(typeof(" + playableName + k_TimelineClipAssetSuffix + "))]\n" +
|
|
+ "[TrackClipType(typeof(" + playableName + k_TimelineClipAssetSuffix + "))]\n" +
|
|
- StandardBlendComponentBindingToString () +
|
|
+ StandardBlendComponentBindingToString () +
|
|
- "public class " + playableName + k_TrackAssetSuffix + " : TrackAsset\n" +
|
|
+ "public class " + playableName + k_TrackAssetSuffix + " : TrackAsset\n" +
|
|
- "{\n" +
|
|
+ "{\n" +
|
|
- k_Tab + "public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)\n" +
|
|
+ k_Tab + "public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + "return ScriptPlayable<" + playableName + k_PlayableBehaviourMixerSuffix + ">.Create (graph, inputCount);\n" +
|
|
+ k_Tab + k_Tab + "return ScriptPlayable<" + playableName + k_PlayableBehaviourMixerSuffix + ">.Create (graph, inputCount);\n" +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + "// Please note this assumes only one component of type " + trackBinding.name + " on the same gameobject.\n" +
|
|
+ k_Tab + "// Please note this assumes only one component of type " + trackBinding.name + " on the same gameobject.\n" +
|
|
- k_Tab + "public override void GatherProperties (PlayableDirector director, IPropertyCollector driver)\n" +
|
|
+ k_Tab + "public override void GatherProperties (PlayableDirector director, IPropertyCollector driver)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- "#if UNITY_EDITOR\n" +
|
|
+ "#if UNITY_EDITOR\n" +
|
|
- k_Tab + k_Tab + trackBinding.name + " trackBinding = director.GetGenericBinding(this) as " + trackBinding.name + ";\n" +
|
|
+ k_Tab + k_Tab + trackBinding.name + " trackBinding = director.GetGenericBinding(this) as " + trackBinding.name + ";\n" +
|
|
- k_Tab + k_Tab + "if (trackBinding == null)\n" +
|
|
+ k_Tab + k_Tab + "if (trackBinding == null)\n" +
|
|
- k_Tab + k_Tab + k_Tab + "return;\n" +
|
|
+ k_Tab + k_Tab + k_Tab + "return;\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
-
|
|
+
|
|
- StandardBlendPropertiesAssignedToPropertyDriverToString () +
|
|
+ StandardBlendPropertiesAssignedToPropertyDriverToString () +
|
|
- "#endif\n" +
|
|
+ "#endif\n" +
|
|
- k_Tab + k_Tab + "base.GatherProperties (director, driver);\n" +
|
|
+ k_Tab + k_Tab + "base.GatherProperties (director, driver);\n" +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "}\n";
|
|
+ "}\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendPlayableDrawer ()
|
|
+ string StandardBlendPlayableDrawer ()
|
|
- {
|
|
+ {
|
|
- return
|
|
+ return
|
|
- "using UnityEditor;\n" +
|
|
+ "using UnityEditor;\n" +
|
|
- "using UnityEngine;\n" +
|
|
+ "using UnityEngine;\n" +
|
|
- "using UnityEngine.Playables;\n" +
|
|
+ "using UnityEngine.Playables;\n" +
|
|
- AdditionalNamespacesToString() +
|
|
+ AdditionalNamespacesToString() +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- "[CustomPropertyDrawer(typeof(" + playableName + k_TimelineClipBehaviourSuffix + "))]\n" +
|
|
+ "[CustomPropertyDrawer(typeof(" + playableName + k_TimelineClipBehaviourSuffix + "))]\n" +
|
|
- "public class " + playableName + k_PropertyDrawerSuffix + " : PropertyDrawer\n" +
|
|
+ "public class " + playableName + k_PropertyDrawerSuffix + " : PropertyDrawer\n" +
|
|
- "{\n" +
|
|
+ "{\n" +
|
|
- k_Tab + "public override float GetPropertyHeight (SerializedProperty property, GUIContent label)\n" +
|
|
+ k_Tab + "public override float GetPropertyHeight (SerializedProperty property, GUIContent label)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- k_Tab + k_Tab + "int fieldCount = " + standardBlendPlayableProperties.Count + ";\n" +
|
|
+ k_Tab + k_Tab + "int fieldCount = " + standardBlendPlayableProperties.Count + ";\n" +
|
|
- k_Tab + k_Tab + "return fieldCount * EditorGUIUtility.singleLineHeight;\n" +
|
|
+ k_Tab + k_Tab + "return fieldCount * EditorGUIUtility.singleLineHeight;\n" +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + "public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)\n" +
|
|
+ k_Tab + "public override void OnGUI (Rect position, SerializedProperty property, GUIContent label)\n" +
|
|
- k_Tab + "{\n" +
|
|
+ k_Tab + "{\n" +
|
|
- StandardBlendTrackBindingPropertiesAsSerializedPropsDeclarationToString () +
|
|
+ StandardBlendTrackBindingPropertiesAsSerializedPropsDeclarationToString () +
|
|
- "\n" +
|
|
+ "\n" +
|
|
- k_Tab + k_Tab + "Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);\n" +
|
|
+ k_Tab + k_Tab + "Rect singleFieldRect = new Rect(position.x, position.y, position.width, EditorGUIUtility.singleLineHeight);\n" +
|
|
- StandardBlendSerializedPropertyGUIToString () +
|
|
+ StandardBlendSerializedPropertyGUIToString () +
|
|
- k_Tab + "}\n" +
|
|
+ k_Tab + "}\n" +
|
|
- "}\n";
|
|
+ "}\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendScriptPlayablePropertiesToString ()
|
|
+ string StandardBlendScriptPlayablePropertiesToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- UsableProperty prop = standardBlendPlayableProperties[i];
|
|
+ UsableProperty prop = standardBlendPlayableProperties[i];
|
|
- if(prop.defaultValue == "")
|
|
+ if(prop.defaultValue == "")
|
|
- returnVal += k_Tab + "public " + prop.type + " " + prop.name + ";\n";
|
|
+ returnVal += k_Tab + "public " + prop.type + " " + prop.name + ";\n";
|
|
- else
|
|
+ else
|
|
- {
|
|
+ {
|
|
- returnVal += k_Tab + "public " + prop.type + " " + prop.name + " = " + prop.defaultValue + ";\n";
|
|
+ returnVal += k_Tab + "public " + prop.type + " " + prop.name + " = " + prop.defaultValue + ";\n";
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendTrackBindingPropertiesDefaultsDeclarationToString ()
|
|
+ string StandardBlendTrackBindingPropertiesDefaultsDeclarationToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- UsableProperty prop = standardBlendPlayableProperties[i];
|
|
+ UsableProperty prop = standardBlendPlayableProperties[i];
|
|
- returnVal += k_Tab + prop.type + " " + prop.NameAsPrivateDefault + ";\n";
|
|
+ returnVal += k_Tab + prop.type + " " + prop.NameAsPrivateDefault + ";\n";
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendTrackBindingPropertiesBlendedDeclarationToString ()
|
|
+ string StandardBlendTrackBindingPropertiesBlendedDeclarationToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- UsableProperty prop = standardBlendPlayableProperties[i];
|
|
+ UsableProperty prop = standardBlendPlayableProperties[i];
|
|
-
|
|
+
|
|
- returnVal += k_Tab + prop.type + " " + prop.NameAsPrivateAssigned + ";\n";
|
|
+ returnVal += k_Tab + prop.type + " " + prop.NameAsPrivateAssigned + ";\n";
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendTrackBindingPropertiesDefaultsAssignmentToString ()
|
|
+ string StandardBlendTrackBindingPropertiesDefaultsAssignmentToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- UsableProperty prop = standardBlendPlayableProperties[i];
|
|
+ UsableProperty prop = standardBlendPlayableProperties[i];
|
|
-
|
|
+
|
|
- switch (prop.type)
|
|
+ switch (prop.type)
|
|
- {
|
|
+ {
|
|
- case "float":
|
|
+ case "float":
|
|
- returnVal += k_Tab + k_Tab + "if (!Mathf.Approximately(m_TrackBinding." + prop.name + ", " + prop.NameAsPrivateAssigned + "))\n";
|
|
+ returnVal += k_Tab + k_Tab + "if (!Mathf.Approximately(m_TrackBinding." + prop.name + ", " + prop.NameAsPrivateAssigned + "))\n";
|
|
- returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
|
|
- break;
|
|
+ break;
|
|
- case "double":
|
|
+ case "double":
|
|
- returnVal += k_Tab + k_Tab + "if (!Mathf.Approximately((float)m_TrackBinding." + prop.name + ", (float)" + prop.NameAsPrivateAssigned + "))\n";
|
|
+ returnVal += k_Tab + k_Tab + "if (!Mathf.Approximately((float)m_TrackBinding." + prop.name + ", (float)" + prop.NameAsPrivateAssigned + "))\n";
|
|
- returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
|
|
- break;
|
|
+ break;
|
|
- default:
|
|
+ default:
|
|
- returnVal += k_Tab + k_Tab + "if (m_TrackBinding." + prop.name + " != " + prop.NameAsPrivateAssigned + ")\n";
|
|
+ returnVal += k_Tab + k_Tab + "if (m_TrackBinding." + prop.name + " != " + prop.NameAsPrivateAssigned + ")\n";
|
|
- returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsPrivateDefault + " = m_TrackBinding." + prop.name + ";\n";
|
|
- break;
|
|
+ break;
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendBlendedVariablesCreationToString ()
|
|
+ string StandardBlendBlendedVariablesCreationToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- UsableProperty prop = standardBlendPlayableProperties[i];
|
|
+ UsableProperty prop = standardBlendPlayableProperties[i];
|
|
-
|
|
+
|
|
- if(prop.usability != UsableProperty.Usability.Blendable)
|
|
+ if(prop.usability != UsableProperty.Usability.Blendable)
|
|
- continue;
|
|
+ continue;
|
|
-
|
|
+
|
|
- string type = prop.type == "int" ? "float" : prop.type;
|
|
+ string type = prop.type == "int" ? "float" : prop.type;
|
|
- string zeroVal = prop.type == "int" ? "0f" : prop.ZeroValueAsString ();
|
|
+ string zeroVal = prop.type == "int" ? "0f" : prop.ZeroValueAsString ();
|
|
- returnVal += k_Tab + k_Tab + type + " " + prop.NameAsLocalBlended + " = " + zeroVal + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + type + " " + prop.NameAsLocalBlended + " = " + zeroVal + ";\n";
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendPlayableCurrentInputsDeclarationToString ()
|
|
+ string StandardBlendPlayableCurrentInputsDeclarationToString ()
|
|
- {
|
|
+ {
|
|
- if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
|
|
+ if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
|
|
- {
|
|
+ {
|
|
- return k_Tab + k_Tab + "int currentInputs = 0;\n";
|
|
+ return k_Tab + k_Tab + "int currentInputs = 0;\n";
|
|
- }
|
|
+ }
|
|
- return "";
|
|
+ return "";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendBlendedVariablesWeightedIncrementationToString ()
|
|
+ string StandardBlendBlendedVariablesWeightedIncrementationToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- UsableProperty prop = standardBlendPlayableProperties[i];
|
|
+ UsableProperty prop = standardBlendPlayableProperties[i];
|
|
-
|
|
+
|
|
- if (prop.usability == UsableProperty.Usability.Blendable)
|
|
+ if (prop.usability == UsableProperty.Usability.Blendable)
|
|
- returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsLocalBlended + " += input." + prop.name + " * inputWeight;\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + prop.NameAsLocalBlended + " += input." + prop.name + " * inputWeight;\n";
|
|
-
|
|
+
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendAssignableVariablesAssignedBasedOnGreatestWeightToString ()
|
|
+ string StandardBlendAssignableVariablesAssignedBasedOnGreatestWeightToString ()
|
|
- {
|
|
+ {
|
|
- if (standardBlendPlayableProperties.Count == 0)
|
|
+ if (standardBlendPlayableProperties.Count == 0)
|
|
- return "";
|
|
+ return "";
|
|
-
|
|
+
|
|
- string returnVal = k_Tab + k_Tab + k_Tab + "if (inputWeight > greatestWeight)\n";
|
|
+ string returnVal = k_Tab + k_Tab + k_Tab + "if (inputWeight > greatestWeight)\n";
|
|
- returnVal += k_Tab + k_Tab + k_Tab + "{\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + "{\n";
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- UsableProperty prop = standardBlendPlayableProperties[i];
|
|
+ UsableProperty prop = standardBlendPlayableProperties[i];
|
|
- if (prop.usability == UsableProperty.Usability.Assignable)
|
|
+ if (prop.usability == UsableProperty.Usability.Assignable)
|
|
- {
|
|
+ {
|
|
- returnVal += k_Tab + k_Tab + k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = input." + prop.name + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = input." + prop.name + ";\n";
|
|
- returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateAssigned + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateAssigned + ";\n";
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
- returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "greatestWeight = inputWeight;\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "greatestWeight = inputWeight;\n";
|
|
- returnVal += k_Tab + k_Tab + k_Tab + "}\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + "}\n";
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendPlayableCurrentInputIterationToString ()
|
|
+ string StandardBlendPlayableCurrentInputIterationToString ()
|
|
- {
|
|
+ {
|
|
- if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
|
|
+ if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
|
|
- {
|
|
+ {
|
|
- string returnVal = "\n";
|
|
+ string returnVal = "\n";
|
|
- returnVal += k_Tab + k_Tab + k_Tab + "if (!Mathf.Approximately (inputWeight, 0f))\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + "if (!Mathf.Approximately (inputWeight, 0f))\n";
|
|
- returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "currentInputs++;\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + k_Tab + "currentInputs++;\n";
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
- return "";
|
|
+ return "";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendTrackBindingPropertiesBlendedAssignmentToString ()
|
|
+ string StandardBlendTrackBindingPropertiesBlendedAssignmentToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- bool firstNewLine = false;
|
|
+ bool firstNewLine = false;
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- UsableProperty prop = standardBlendPlayableProperties[i];
|
|
+ UsableProperty prop = standardBlendPlayableProperties[i];
|
|
- if (prop.usability != UsableProperty.Usability.Blendable)
|
|
+ if (prop.usability != UsableProperty.Usability.Blendable)
|
|
- continue;
|
|
+ continue;
|
|
-
|
|
+
|
|
- if (!firstNewLine)
|
|
+ if (!firstNewLine)
|
|
- {
|
|
+ {
|
|
- firstNewLine = true;
|
|
+ firstNewLine = true;
|
|
- returnVal += "\n";
|
|
+ returnVal += "\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- if (prop.type == "int")
|
|
+ if (prop.type == "int")
|
|
- returnVal += k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = Mathf.RoundToInt (" + prop.NameAsLocalBlended + " + " + prop.NameAsPrivateDefault + " * (1f - totalWeight));\n";
|
|
+ returnVal += k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = Mathf.RoundToInt (" + prop.NameAsLocalBlended + " + " + prop.NameAsPrivateDefault + " * (1f - totalWeight));\n";
|
|
- else
|
|
+ else
|
|
- returnVal += k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = " + prop.NameAsLocalBlended + " + " + prop.NameAsPrivateDefault + " * (1f - totalWeight);\n";
|
|
+ returnVal += k_Tab + k_Tab + prop.NameAsPrivateAssigned + " = " + prop.NameAsLocalBlended + " + " + prop.NameAsPrivateDefault + " * (1f - totalWeight);\n";
|
|
-
|
|
+
|
|
- returnVal += k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateAssigned + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateAssigned + ";\n";
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendTrackBindingPropertiesAssignableAssignmentToString ()
|
|
+ string StandardBlendTrackBindingPropertiesAssignableAssignmentToString ()
|
|
- {
|
|
+ {
|
|
- if (standardBlendPlayableProperties.Count == 0)
|
|
+ if (standardBlendPlayableProperties.Count == 0)
|
|
- return "";
|
|
+ return "";
|
|
-
|
|
+
|
|
- if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
|
|
+ if (standardBlendPlayableProperties.Any (x => x.usability == UsableProperty.Usability.Assignable))
|
|
- {
|
|
+ {
|
|
- string returnVal = "\n" + k_Tab + k_Tab + "if (currentInputs != 1 && 1f - totalWeight > greatestWeight)\n";
|
|
+ string returnVal = "\n" + k_Tab + k_Tab + "if (currentInputs != 1 && 1f - totalWeight > greatestWeight)\n";
|
|
- returnVal += k_Tab + k_Tab + "{\n";
|
|
+ returnVal += k_Tab + k_Tab + "{\n";
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- UsableProperty prop = standardBlendPlayableProperties[i];
|
|
+ UsableProperty prop = standardBlendPlayableProperties[i];
|
|
- if (prop.usability != UsableProperty.Usability.Assignable)
|
|
+ if (prop.usability != UsableProperty.Usability.Assignable)
|
|
- continue;
|
|
+ continue;
|
|
-
|
|
+
|
|
- returnVal += k_Tab + k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateDefault + ";\n";
|
|
+ returnVal += k_Tab + k_Tab + k_Tab + "m_TrackBinding." + prop.name + " = " + prop.NameAsPrivateDefault + ";\n";
|
|
- }
|
|
+ }
|
|
- returnVal += k_Tab + k_Tab + "}\n";
|
|
+ returnVal += k_Tab + k_Tab + "}\n";
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- return "";
|
|
+ return "";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendComponentBindingToString ()
|
|
+ string StandardBlendComponentBindingToString ()
|
|
- {
|
|
+ {
|
|
- return "[TrackBindingType(typeof(" + trackBinding.name + "))]\n";
|
|
+ return "[TrackBindingType(typeof(" + trackBinding.name + "))]\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendPropertiesAssignedToPropertyDriverToString ()
|
|
+ string StandardBlendPropertiesAssignedToPropertyDriverToString ()
|
|
- {
|
|
+ {
|
|
- if (standardBlendPlayableProperties.Count == 0)
|
|
+ if (standardBlendPlayableProperties.Count == 0)
|
|
- return "";
|
|
+ return "";
|
|
-
|
|
+
|
|
- string returnVal = k_Tab + k_Tab + "// These field names are procedurally generated estimations based on the associated property names.\n";
|
|
+ string returnVal = k_Tab + k_Tab + "// These field names are procedurally generated estimations based on the associated property names.\n";
|
|
- returnVal += k_Tab + k_Tab + "// If any of the names are incorrect you will get a DrivenPropertyManager error saying it has failed to register the name.\n";
|
|
+ returnVal += k_Tab + k_Tab + "// If any of the names are incorrect you will get a DrivenPropertyManager error saying it has failed to register the name.\n";
|
|
- returnVal += k_Tab + k_Tab + "// In this case you will need to find the correct backing field name.\n";
|
|
+ returnVal += k_Tab + k_Tab + "// In this case you will need to find the correct backing field name.\n";
|
|
- returnVal += k_Tab + k_Tab + "// The suggested way of finding the field name is to:\n";
|
|
+ returnVal += k_Tab + k_Tab + "// The suggested way of finding the field name is to:\n";
|
|
- returnVal += k_Tab + k_Tab + "// 1. Make sure your scene is serialized to text.\n";
|
|
+ returnVal += k_Tab + k_Tab + "// 1. Make sure your scene is serialized to text.\n";
|
|
- returnVal += k_Tab + k_Tab + "// 2. Search the text for the track binding component type.\n";
|
|
+ returnVal += k_Tab + k_Tab + "// 2. Search the text for the track binding component type.\n";
|
|
- returnVal += k_Tab + k_Tab + "// 3. Look through the field names until you see one that looks correct.\n";
|
|
+ returnVal += k_Tab + k_Tab + "// 3. Look through the field names until you see one that looks correct.\n";
|
|
-
|
|
+
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- UsableProperty prop = standardBlendPlayableProperties[i];
|
|
+ UsableProperty prop = standardBlendPlayableProperties[i];
|
|
-
|
|
+
|
|
- if (prop.usablePropertyType == UsableProperty.UsablePropertyType.Field)
|
|
+ if (prop.usablePropertyType == UsableProperty.UsablePropertyType.Field)
|
|
- {
|
|
+ {
|
|
- returnVal += k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, \"" + prop.name + "\");\n";
|
|
+ returnVal += k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, \"" + prop.name + "\");\n";
|
|
- }
|
|
+ }
|
|
- else
|
|
+ else
|
|
- {
|
|
+ {
|
|
- returnVal += k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, \"" + prop.NameAsPrivate + "\");\n";
|
|
+ returnVal += k_Tab + k_Tab + "driver.AddFromName<" + trackBinding.name + ">(trackBinding.gameObject, \"" + prop.NameAsPrivate + "\");\n";
|
|
- }
|
|
+ }
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendTrackBindingPropertiesAsSerializedPropsDeclarationToString ()
|
|
+ string StandardBlendTrackBindingPropertiesAsSerializedPropsDeclarationToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- UsableProperty prop = standardBlendPlayableProperties[i];
|
|
+ UsableProperty prop = standardBlendPlayableProperties[i];
|
|
- returnVal += k_Tab + k_Tab + "SerializedProperty " + prop.NameAsLocalSerializedProperty + " = property.FindPropertyRelative(\"" + prop.name + "\");\n";
|
|
+ returnVal += k_Tab + k_Tab + "SerializedProperty " + prop.NameAsLocalSerializedProperty + " = property.FindPropertyRelative(\"" + prop.name + "\");\n";
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- string StandardBlendSerializedPropertyGUIToString ()
|
|
+ string StandardBlendSerializedPropertyGUIToString ()
|
|
- {
|
|
+ {
|
|
- string returnVal = "";
|
|
+ string returnVal = "";
|
|
- for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
+ for (int i = 0; i < standardBlendPlayableProperties.Count; i++)
|
|
- {
|
|
+ {
|
|
- if (i != 0)
|
|
+ if (i != 0)
|
|
- {
|
|
+ {
|
|
- returnVal += "\n";
|
|
+ returnVal += "\n";
|
|
- returnVal += k_Tab + k_Tab + "singleFieldRect.y += EditorGUIUtility.singleLineHeight;\n";
|
|
+ returnVal += k_Tab + k_Tab + "singleFieldRect.y += EditorGUIUtility.singleLineHeight;\n";
|
|
- }
|
|
+ }
|
|
-
|
|
+
|
|
- returnVal += k_Tab + k_Tab + "EditorGUI.PropertyField(singleFieldRect, " + standardBlendPlayableProperties[i].NameAsLocalSerializedProperty + ");\n";
|
|
+ returnVal += k_Tab + k_Tab + "EditorGUI.PropertyField(singleFieldRect, " + standardBlendPlayableProperties[i].NameAsLocalSerializedProperty + ");\n";
|
|
- }
|
|
+ }
|
|
- return returnVal;
|
|
+ return returnVal;
|
|
- }
|
|
+ }
|
|
-}
|
|
+}
|