public static TrackType[] GetTrackTypeHandle(Type toBeHandled) { Type[] array = (from assemblyType in EditorAssemblies.get_loadedTypes() where assemblyType.IsSubclassOf(typeof(TrackAsset)) select assemblyType).ToArray <Type>(); List <TrackType> list = new List <TrackType>(); Type[] array2 = array; for (int i = 0; i < array2.Length; i++) { Type type = array2[i]; object[] customAttributes = type.GetCustomAttributes(typeof(TrackClipTypeAttribute), true); object[] array3 = customAttributes; for (int j = 0; j < array3.Length; j++) { object obj = array3[j]; Type inspectedType = ((TrackClipTypeAttribute)obj).inspectedType; if (inspectedType == toBeHandled || inspectedType.IsAssignableFrom(toBeHandled)) { TrackType item = new TrackType(type, TimelineHelpers.GetMediaTypeFromType(type)); list.Add(item); } } } if (toBeHandled == typeof(MonoScript)) { list.Add(new TrackType(typeof(PlayableTrack), TimelineHelpers.GetMediaTypeFromType(typeof(PlayableTrack)))); } return(list.ToArray()); }
public virtual void OnBuildTrackContextMenu(GenericMenu menu, TrackAsset trackAsset, ITimelineState state) { bool flag = trackAsset is AnimationTrack || trackAsset is AudioTrack; if (flag) { List <Type> list = TimelineHelpers.GetTypesHandledByTrackType(TimelineHelpers.TrackTypeFromType(trackAsset.GetType())).ToList <Type>(); for (int i = 0; i < list.Count; i++) { Type assetType = list[i]; this.AddAddAssetMenuItem(menu, assetType, trackAsset, state); } } else if (TimelineHelpers.GetMediaTypeFromType(trackAsset.GetType()) == TimelineAsset.MediaType.Script) { Type customPlayableType = trackAsset.GetCustomPlayableType(); if (customPlayableType != null) { string displayName = TrackDrawer.GetDisplayName(customPlayableType); GUIContent gUIContent = new GUIContent("Add " + displayName + " Clip"); menu.AddItem(new GUIContent(gUIContent), false, delegate(object userData) { TimelineHelpers.CreateClipOnTrack(userData as Type, trackAsset, state); }, customPlayableType); } } ITimelineMarkerContainer markerContainer = trackAsset as ITimelineMarkerContainer; if (markerContainer != null) { menu.AddItem(TrackDrawer.Styles.newMarker, false, delegate { this.CreateNewMarker(markerContainer, state); }); IEnumerable <string> enumerable = (from x in markerContainer.GetMarkers() select x.key).Distinct <string>(); if (enumerable.Any <string>()) { using (IEnumerator <string> enumerator = enumerable.GetEnumerator()) { while (enumerator.MoveNext()) { string key = enumerator.Current; menu.AddItem(new GUIContent(TrackDrawer.Styles.addMarker.get_text() + key), false, delegate { this.CreateExistingMarker(key, markerContainer, state); }); } } } } }
public static TrackType[] GetMixableTypes() { TrackType[] result; if (TimelineHelpers.s_CachedMixableTypes != null) { result = TimelineHelpers.s_CachedMixableTypes; } else { TimelineHelpers.s_CachedMixableTypes = (from x in EditorAssemblies.get_loadedTypes() where !x.IsAbstract && typeof(TrackAsset).IsAssignableFrom(x) select x into t select new TrackType(t, TimelineHelpers.GetMediaTypeFromType(t))).ToArray <TrackType>(); result = TimelineHelpers.s_CachedMixableTypes; } return(result); }
public static TrackType TrackTypeFromType(Type t) { return(new TrackType(t, TimelineHelpers.GetMediaTypeFromType(t))); }