private void lockStatus(bool locked) { lockedState = !lockedState; TrackGroup trackGroup = TrackGroup.Behaviour as TrackGroup; if (trackGroup != null) { var tracks = TrackGroup.Tracks; foreach (var tracktype in tracks) { tracktype.Behaviour.gameObject.GetComponent <TimelineTrack>().lockedStatus = locked; } } }
public TrackTreeViewGroup(TrackGroup group) { if (group == null) { throw new System.ArgumentNullException("Invalid TrackGroup"); } this.Height = 20; this.Group = group; Foldout.Content.image = Resources.UITextures.Matinee.Folder; Foldout.IsOpen = group.IsOpen; Properties = new TrackTreeViewGroupProperties(this); Foldout.StateChanged += Foldout_StateChanged; Margin = new Thickness(0, 1); }
protected void InitTrackGroup() { if (m_TrackGroup == null) { m_TrackGroup = new TimelineTrackGroup(Context); Context.AddObject(m_TrackGroup); } float timeScale = 1.0f; TrackGroup group = GetTrackGroup(out timeScale); m_TrackGroup.SetTrackGroup(group, timeScale); m_TrackGroup.FinishCallback = OnTrackGroupComplete; m_TrackGroup.Play(); }
public void SetData(string titleName, TrackGroup groupData) { m_TitleName = titleName; m_GroupData = groupData; DrawerConfig.TimeLength = m_GroupData.Length; for (int i = 0; i < m_GroupData.Tracks.Count; i++) { ActionTrackDrawer trackDrawer = new ActionTrackDrawer(DrawerConfig, this); trackDrawer.SetData(i, m_GroupData.Tracks[i]); m_TrackDrawers.Add(trackDrawer); } }
public void OnTracksChanged(TrackGroupArray p0, TrackSelectionArray p1) { var trackGroupArray = new TrackGroup[p0.Length]; for (var i = 0; i < p0.Length; i++) { trackGroupArray[i] = p0.Get(i); } var trackSelectionArray = new ITrackSelection[p1.Length]; for (var i = 0; i < p1.Length; i++) { trackSelectionArray[i] = p1.Get(i); } TracksChanged?.Invoke(trackGroupArray, trackSelectionArray); }
public Transform GetActorTransform(TrackGroup targetGroup) { ActorTrackGroup targetTrackGroup = targetGroup as ActorTrackGroup; if (targetTrackGroup) { return(targetTrackGroup.Actor); } EntityTrackGroup entityTrackGroup = targetGroup as EntityTrackGroup; if (entityTrackGroup) { return(entityTrackGroup.Actor); } Debug.LogError("找不到目标对应的演员!"); return(null); }
public static void ReflectChanges(TimelineManager cutscene, CutsceneWrapper wrapper) { if (cutscene == null || wrapper == null) { return; } cutscene.Duration = wrapper.Duration; foreach (TrackGroupWrapper tgw in wrapper.TrackGroups) { TrackGroup tg = tgw.Behaviour as TrackGroup; tg.Ordinal = tgw.Ordinal; foreach (TimelineTrackWrapper trackWrapper in tgw.Tracks) { TimelineTrack track = trackWrapper.Behaviour as TimelineTrack; track.Ordinal = trackWrapper.Ordinal; } } }
public static void ShowAddTrackContextMenu(TrackGroup trackGroup) { List <Type> trackTypes = trackGroup.GetAllowedTrackTypes(); GenericMenu createMenu = new GenericMenu(); // Get the attributes of each track. foreach (Type t in trackTypes) { MemberInfo info = t; string label = string.Empty; foreach (TimelineTrackAttribute attribute in info.GetCustomAttributes(typeof(TimelineTrackAttribute), true)) { label = attribute.Label; break; } createMenu.AddItem(new GUIContent(string.Format("Add {0}", label)), false, addTrack, new TrackContextData(label, t, trackGroup)); } createMenu.ShowAsContext(); }
/// <summary> /// Create and show a context menu for adding new Timeline Tracks. /// </summary> protected override void addTrackContext() { TrackGroup trackGroup = TrackGroup.Behaviour as TrackGroup; if (trackGroup != null) { // Get the possible tracks that this group can contain. List <Type> trackTypes = trackGroup.GetAllowedTrackTypes(); GenericMenu createMenu = new GenericMenu(); { var __list1 = trackTypes; var __listCount1 = __list1.Count; for (int __i1 = 0; __i1 < __listCount1; ++__i1) { var t = (Type)__list1[__i1]; { MemberInfo info = t; string label = string.Empty; { var __array2 = info.GetCustomAttributes(typeof(TimelineTrackAttribute), true); var __arrayLength2 = __array2.Length; for (int __i2 = 0; __i2 < __arrayLength2; ++__i2) { var attribute = (TimelineTrackAttribute)__array2[__i2]; { label = attribute.Label; break; } } } createMenu.AddItem(new GUIContent(string.Format("Add {0}", label)), false, addTrack, new TrackContextData(label, t, trackGroup)); } } } createMenu.ShowAsContext(); } }
private void UpdateTrackNames() { this.trackGroupDictionary.Clear(); this.trackDictionary.Clear(); for (int i = 0; i < Context.Game.TrackGroups.Count; i++) { TrackGroup trackGroup = Context.Game.TrackGroups[i]; TreeNode trackGroupNode = this.treeView.Nodes[i]; this.trackGroupDictionary.Add(trackGroup, trackGroupNode); TreeNodeCollection trackNodes = trackGroupNode.Nodes; for (int j = 0; j < trackGroup.Count; j++) { Track track = trackGroup[j]; TreeNode trackNode = trackNodes[j]; this.trackDictionary.Add(track, trackNode); trackNode.Text = TrackTreeView.GetTrackText(track); } } }
public TrackContextData(string label, Type type, TrackGroup trackGroup) { Label = label; Type = type; TrackGroup = trackGroup; }
public TrackContextData(string label, Type type, TrackGroup trackGroup) { this.Label = label; this.Type = type; this.TrackGroup = trackGroup; }
private View BuildView(LayoutInflater inflater) { View view = inflater.Inflate(Resource.Layout.track_selection_dialog, null); ViewGroup root = (ViewGroup)view.FindViewById(Resource.Id.root); // View for disabling the renderer. _disableView = (CheckedTextView)inflater.Inflate( Android.Resource.Layout.SimpleListItemSingleChoice, root, false); _disableView.SetText(Resource.String.selection_disabled); _disableView.Focusable = true; _disableView.SetOnClickListener(this); root.AddView(_disableView); // View for clearing the override to allow the selector to use its default selection logic. _defaultView = (CheckedTextView)inflater.Inflate( Android.Resource.Layout.SimpleListItemSingleChoice, root, false); _defaultView.SetText(Resource.String.selection_default); _defaultView.Focusable = true; _defaultView.SetOnClickListener(this); root.AddView(inflater.Inflate(Resource.Layout.list_divider, root, false)); root.AddView(_defaultView); // Per-track views. bool haveSupportedTracks = false; bool haveAdaptiveTracks = false; _trackViews = new CheckedTextView[_trackGroups.Length][]; for (int groupIndex = 0; groupIndex < _trackGroups.Length; groupIndex++) { TrackGroup group = _trackGroups.Get(groupIndex); bool groupIsAdaptive = _trackGroupsAdaptive[groupIndex]; haveAdaptiveTracks |= groupIsAdaptive; _trackViews[groupIndex] = new CheckedTextView[group.Length]; for (int trackIndex = 0; trackIndex < group.Length; trackIndex++) { if (trackIndex == 0) { root.AddView(inflater.Inflate(Resource.Layout.list_divider, root, false)); } int trackViewLayoutId = groupIsAdaptive ? Android.Resource.Layout.SimpleListItemMultipleChoice : Android.Resource.Layout.SimpleListItemSingleChoice; CheckedTextView trackView = (CheckedTextView)inflater.Inflate( trackViewLayoutId, root, false); string txt = BuildTrackName(group.GetFormat(trackIndex)); trackView.SetText(txt, TextView.BufferType.Normal); if (_trackInfo.GetTrackFormatSupport(_rendererIndex, groupIndex, trackIndex) == RendererCapabilities.FormatHandled) { trackView.Focusable = true; trackView.Tag = Pair.Create(groupIndex, trackIndex); trackView.SetOnClickListener(this); haveSupportedTracks = true; } else { trackView.Focusable = false; trackView.Enabled = false; } _trackViews[groupIndex][trackIndex] = trackView; root.AddView(trackView); } } if (!haveSupportedTracks) { // Indicate that the default selection will be nothing. _defaultView.Text = Application.Context.GetString(Resource.String.selection_default_none); } else if (haveAdaptiveTracks) { // View for using random adaptation. _enableRandomAdaptationView = (CheckedTextView)inflater.Inflate( Android.Resource.Layout.SimpleListItemMultipleChoice, root, false); _enableRandomAdaptationView.Text = Application.Context.GetString(Resource.String.enable_random_adaptation); _enableRandomAdaptationView.SetOnClickListener(this); root.AddView(inflater.Inflate(Resource.Layout.list_divider, root, false)); root.AddView(_enableRandomAdaptationView); } UpdateViews(); return(view); }
public TrackGroupViewModel(TrackTypeViewModel trackTypeViewModel, TrackGroup track) : base(trackTypeViewModel, track) { this.LoadGroupCommand = new DelegateCommand(OnLoadGroup); this.track = track; this.Names = new MultilanguageStringViewModel(this.track.GroupName); }
private void Refresh(Transform transform, Skill.Framework.UI.Panel panel) { List <TrackGroup> groupList = new List <TrackGroup>(); List <Track> trackList = new List <Track>(); int childCount = transform.childCount; // first check for any new group or track for (int childIndex = 0; childIndex < childCount; childIndex++) { Transform childT = transform.GetChild(childIndex); TrackGroup group = childT.GetComponent <TrackGroup>(); if (group != null && !group.IsDestroyed) { groupList.Add(group); TrackTreeViewGroup groupItem = null; foreach (var item in panel.Controls) { if (item is TrackTreeViewGroup) { if (((TrackTreeViewGroup)item).Group == group) { groupItem = (TrackTreeViewGroup)item; break; } } } if (groupItem == null) { groupItem = new TrackTreeViewGroup(group); groupItem.Foldout.Content.text = groupItem.Group.gameObject.name; groupItem.ContextMenu = _TrackGroupContextMenu; panel.Controls.Add(groupItem); } //else //groupItem.Refresh(); Refresh(groupItem.Group.transform, groupItem); continue; } // if group not exist look for track Track track = childT.GetComponent <Track>(); if (track != null && !track.IsDestroyed) { trackList.Add(track); TrackTreeViewItem trackItem = null; foreach (var item in panel.Controls) { if (item is TrackTreeViewItem) { if (((TrackTreeViewItem)item).Track == track) { trackItem = (TrackTreeViewItem)item; break; } } } if (trackItem == null) { BaseTrackBar bar = CreateNewTrackBar(track); _Editor.TimeLine.View.Controls.Add(bar); trackItem = new TrackTreeViewItem(track, bar); trackItem.ContextMenu = _TrackItemContextMenu; panel.Controls.Add(trackItem); } } } // now check for any deleted group or track int index = 0; while (index < panel.Controls.Count) { var item = panel.Controls[index]; if (item is TrackTreeViewGroup) { TrackGroup group = ((TrackTreeViewGroup)item).Group; if (!groupList.Contains(group)) { RemoveTracks((TrackTreeViewGroup)item); panel.Controls.Remove(item); continue; } } else if (item is TrackTreeViewItem) { Track track = ((TrackTreeViewItem)item).Track; if (!trackList.Contains(track)) { panel.Controls.Remove(item); _Editor.TimeLine.View.Controls.Remove(((TrackTreeViewItem)item).TrackBar); continue; } } index++; } foreach (var item in Controls) { if (item is TrackTreeViewItem) { ((TrackTreeViewItem)item).Refresh(); } } }
/// <summary> /// Executes the specified query. /// </summary> /// <param name="experiments">The list of logged experiments on which the query will be processed</param> /// <param name="OnExpUnitProcessed">Callback function called when an exp unit is processed. Used to update the progress</param> /// <param name="resultTracks">Output list of track groups</param> /// <param name="reports">Output list of reports</param> public void Execute(BindableCollection <LoggedExperimentViewModel> experiments , LoadOptions.PerExperimentalUnitFunction OnExpUnitProcessed, out List <TrackGroup> resultTracks, out List <Report> reports) { TrackGroup resultTrackGroup = null; //initialize the output lists resultTracks = new List <TrackGroup>(); reports = DataTrackUtilities.FromLoggedVariables(VariablesVM); //if the in-group selection function requires a variable not selected for the report //we add it too to the list of variables read from the log if (GroupsEnabled && InGroupSelectionVariable != null && InGroupSelectionVariable != "" && !IsVariableSelected(InGroupSelectionVariable, InGroupSelectionReportType)) { EnumDescriptionConverter conv = new EnumDescriptionConverter(); ReportType reportType = (ReportType)((IValueConverter)conv).ConvertBack(InGroupSelectionReportType, typeof(ReportType), null, CultureInfo.CurrentCulture); reports.Add(new Report(InGroupSelectionVariable, reportType, GetVariableProcessFunc(InGroupSelectionVariable))); } //if we use some sorting function to select only some tracks, we need to add the variable // to the list too if (LimitTracks && !IsVariableSelected(OrderByVariable, OrderByReportType)) { EnumDescriptionConverter conv = new EnumDescriptionConverter(); ReportType reportType = (ReportType)((IValueConverter)conv).ConvertBack(OrderByReportType, typeof(ReportType), null, CultureInfo.CurrentCulture); reports.Add(new Report(OrderByVariable, reportType, GetVariableProcessFunc(OrderByVariable))); } //set the data resampling options foreach (Report report in reports) { report.Resample = ResampleData; report.NumSamples = ResamplingNumPoints; report.TimeOffset = TimeOffset; report.MinEpisodeLength = MinEpisodeLength; } //traverse the experimental units within each experiment foreach (LoggedExperimentViewModel exp in experiments) { foreach (LoggedExperimentalUnitViewModel expUnit in exp.ExperimentalUnits) { //take selection into account? is this exp. unit selected? bool expUnitContainsGroupByForks = expUnit.ContainsForks(GroupByForks); if ((!UseForkSelection || (UseForkSelection && expUnit.IsSelected)) && expUnitContainsGroupByForks) { resultTrackGroup = null; if (GroupByForks.Count != 0) { resultTrackGroup = GetTrackGroup(resultTracks, expUnit.ForkValues, exp.ExperimentName); if (resultTrackGroup != null) { //the track exists and we are using forks to group results Track trackData = LogFileUtils.LoadTrackData(expUnit, reports); if (trackData != null) { resultTrackGroup.AddTrackData(trackData); } //It is not the first track in the track group, so we consolidate it asap //to avoid using unnecessary amounts of memory //Consolidate selects a single track in each group using the in-group selection function //-max(avg(inGroupSelectionVariable)) or min(avg(inGroupSelectionVariable)) //and also names groups depending on the number of tracks in the group resultTrackGroup.Consolidate(InGroupSelectionFunction, InGroupSelectionVariable , InGroupSelectionReportType, GroupByForks); } } if (resultTrackGroup == null && expUnitContainsGroupByForks) //New track group { //No groups (each experimental unit is a track) or the track doesn't exist //Either way, we create a new track TrackGroup newResultTrackGroup = new TrackGroup(exp.ExperimentName); if (GroupByForks.Count == 0) { newResultTrackGroup.ForkValues = expUnit.ForkValues; } else { foreach (string forkName in GroupByForks) { //an experimental unit may not have a fork used to group if (expUnit.ForkValues.ContainsKey(forkName)) { newResultTrackGroup.ForkValues[forkName] = expUnit.ForkValues[forkName]; } else if (forkName == ReportsWindowViewModel.GroupByExperimentId) { newResultTrackGroup.ForkValues[forkName] = exp.ExperimentName; } } } //load data from the log file Track trackData = LogFileUtils.LoadTrackData(expUnit, reports); if (trackData != null) { //for now, we just ignore failed experiments. Maybe we could do something more sophisticated //for example, allow to choose only those parameter variations that lead to failed experiments if (trackData.HasData) { newResultTrackGroup.AddTrackData(trackData); } //we only consider those tracks with data loaded if (newResultTrackGroup.HasData) { resultTracks.Add(newResultTrackGroup); } } } //Limit the number of tracks asap //if we are using limitTo/orderBy, we have to select the best tracks/groups according to the given criteria if (LimitTracks) { if (resultTracks.Count > MaxNumTracks) { bool asc = (OrderByFunction == FunctionMin) || (OrderByFunction == FunctionAscBeauty); bool useBeauty = (OrderByFunction == FunctionDscBeauty) || (OrderByFunction == FunctionAscBeauty); resultTracks.Sort(new TrackGroupComparer(asc, useBeauty, OrderByVariable, OrderByReportType)); resultTracks.RemoveRange(MaxNumTracks, resultTracks.Count - MaxNumTracks); } } } OnExpUnitProcessed?.Invoke(expUnit.Model); } } }
public void OnTracksChanged(TrackGroupArray ignored, TrackSelectionArray trackSelections) { var mappedTrackInfo = trackSelector.CurrentMappedTrackInfo; if (mappedTrackInfo == null) { Log.Debug(TAG, "Tracks []"); return; } Log.Debug(TAG, "Tracks ["); // Log tracks associated to renderers. for (var rendererIndex = 0; rendererIndex < mappedTrackInfo.Length; rendererIndex++) { var rendererTrackGroups = mappedTrackInfo.GetTrackGroups(rendererIndex); var trackSelection = trackSelections.Get(rendererIndex); if (rendererTrackGroups.Length > 0) { Log.Debug(TAG, " Renderer:" + rendererIndex + " ["); for (int groupIndex = 0; groupIndex < rendererTrackGroups.Length; groupIndex++) { TrackGroup trackGroup = rendererTrackGroups.Get(groupIndex); var adaptiveSupport = getAdaptiveSupportString(trackGroup.Length, mappedTrackInfo.GetAdaptiveSupport(rendererIndex, groupIndex, false)); Log.Debug(TAG, " Group:" + groupIndex + ", adaptive_supported=" + adaptiveSupport + " ["); for (int trackIndex = 0; trackIndex < trackGroup.Length; trackIndex++) { var status = getTrackStatusString(trackSelection, trackGroup, trackIndex); var formatSupport = getFormatSupportString( mappedTrackInfo.GetTrackFormatSupport(rendererIndex, groupIndex, trackIndex)); Log.Debug(TAG, " " + status + " Track:" + trackIndex + ", " + Format.ToLogString(trackGroup.GetFormat(trackIndex)) + ", supported=" + formatSupport); } Log.Debug(TAG, " ]"); } // Log metadata for at most one of the tracks selected for the renderer. if (trackSelection != null) { for (var selectionIndex = 0; selectionIndex < trackSelection.Length(); selectionIndex++) { var metadata = trackSelection.GetFormat(selectionIndex).Metadata; if (metadata != null) { Log.Debug(TAG, " Metadata ["); printMetadata(metadata, " "); Log.Debug(TAG, " ]"); break; } } } Log.Debug(TAG, " ]"); } } // Log tracks not associated with a renderer. TrackGroupArray unassociatedTrackGroups = mappedTrackInfo.UnassociatedTrackGroups; if (unassociatedTrackGroups.Length > 0) { Log.Debug(TAG, " Renderer:None ["); for (int groupIndex = 0; groupIndex < unassociatedTrackGroups.Length; groupIndex++) { Log.Debug(TAG, " Group:" + groupIndex + " ["); var trackGroup = unassociatedTrackGroups.Get(groupIndex); for (int trackIndex = 0; trackIndex < trackGroup.Length; trackIndex++) { var status = getTrackStatusString(false); var formatSupport = getFormatSupportString( RendererCapabilities.FormatUnsupportedType); Log.Debug(TAG, " " + status + " Track:" + trackIndex + ", " + Format.ToLogString(trackGroup.GetFormat(trackIndex)) + ", supported=" + formatSupport); } Log.Debug(TAG, " ]"); } Log.Debug(TAG, " ]"); } Log.Debug(TAG, "]"); }
private static string getTrackStatusString(ITrackSelection selection, TrackGroup group, int trackIndex) { return(getTrackStatusString(selection != null && selection.TrackGroup == group && selection.IndexOf(trackIndex) != C.IndexUnset)); }
public void OnTracksChanged(TrackGroupArray trackGroups, TrackSelectionArray trackSelections) { for (int i = 0; i < trackGroups.Length; i++) { TrackGroup trackGroup = trackGroups.Get(i); for (int j = 0; j < trackGroup.Length; j++) { Metadata trackMetadata = trackGroup.GetFormat(j).Metadata; if (trackMetadata != null) { for (int v = 0; v < trackMetadata.Length(); v++) { Metadata.IEntry entry = trackMetadata.Get(v); switch (entry) { case ApicFrame apicFrame: byte[] bitmapData = apicFrame.PictureData.ToArray(); Bitmap bitmap = BitmapFactory.DecodeByteArray(bitmapData, 0, bitmapData.Length); var test1 = apicFrame.MimeType; break; case BinaryFrame binaryFrame: var test2 = binaryFrame.Data; break; case ChapterFrame chapterFrame: var test3 = chapterFrame.ChapterId; break; case ChapterTocFrame chapterTocFrame: var test4 = chapterTocFrame.IsRoot; break; case CommentFrame commentFrame: var test5 = commentFrame.Text; break; case GeobFrame geobFrame: var test6 = geobFrame.Data; break; case InternalFrame internalFrame: var test7 = internalFrame.Text; break; case PrivFrame privFrame: var test8 = privFrame.PrivateData; break; case TextInformationFrame textInformationFrame: var test9 = textInformationFrame.Value; break; case UrlLinkFrame urlLinkFrame: var test10 = urlLinkFrame.Url; break; default: break; } } } } } OnTracksChangedImpl?.Invoke(trackGroups, trackSelections); }