A game about forced loneliness, made by TACStudios
at master 39 lines 1.4 kB view raw
1using System.Linq; 2using UnityEditor.IMGUI.Controls; 3using UnityEngine; 4 5namespace UnityEditor.Timeline 6{ 7 class CurveTreeViewNode : TreeViewItem 8 { 9 public bool forceGroup { get; } 10 public System.Type iconType { get; } 11 public GUIContent iconOverlay { get; } 12 13 EditorCurveBinding[] m_Bindings; 14 15 public EditorCurveBinding[] bindings 16 { 17 get { return m_Bindings; } 18 } 19 20 public CurveTreeViewNode(int id, TreeViewItem parent, string displayName, EditorCurveBinding[] bindings, bool _forceGroup = false) 21 : base(id, parent != null ? parent.depth + 1 : -1, parent, displayName) 22 { 23 m_Bindings = bindings; 24 forceGroup = _forceGroup; 25 26 27 // capture the preview icon type. If all subbindings are the same type, use that. Otherwise use null as a default 28 iconType = null; 29 if (parent != null && parent.depth >= 0 && bindings != null && bindings.Length > 0 && bindings.All(b => b.type == bindings[0].type)) 30 { 31 iconType = bindings[0].type; 32 33 // for components put the component type in a tooltip 34 if (iconType != null && typeof(Component).IsAssignableFrom(iconType)) 35 iconOverlay = new GUIContent(string.Empty, ObjectNames.NicifyVariableName(iconType.Name)); 36 } 37 } 38 } 39}