using System; using System.ComponentModel; using JD.Timeline.Document; using JD.Timeline.Model; using TeaBox; using TeaBox.ObjectModel; using System.Linq; using JD.Serialization; using IdGenerator = JD.Serialization.IdGenerator; namespace TRec { /// /// Allows to open generated content to test the editor. /// internal class NewDemoTapeHandler : ActionHandler { public override void Execute(ActionExecutionContext context) { base.Execute(context); // OpenTestTape(); } //public static void OpenTestTape() //{ // const int trackCount = 5; // const int eventCountPerTrack = 4; // const int maxDuration = 300; // TODO : figure out an appropriate MusiclTrack.tpl file path to pickup for test // const string waveFile = @"\\ubisoft.org\projects\JD5\VERSIONS_MILESTONES\2012_10_28_TechDemo1\Tracks\GangnamStyle.trk"; // var availableTrackItems = new[] // { // typeof(AlphaClip), // typeof(AnimationClip), // typeof(ColorClip), // typeof(FXClip), // typeof(PivotClip), // typeof(ProportionClip), // typeof(RotationClip), // typeof(SizeClip), // typeof(TranslationClip) // }; // var random = new Random(); // var tape = new Tape{ Id = @"c:\test\tapeTest.tape" }; // tape.SetWave(Wave.LoadFromTrackFile(waveFile, Wave.LoadingMode.Asynchronous)); // for (int i = 0; i < trackCount; i++) // { // var track = new TapeTrack() {Id = (uint)(i + 1)}; // tape.Tracks.Add(track); // int currentFrame = 0; // for (int j = 0; j < eventCountPerTrack; j++) // { // currentFrame += random.Next(0, maxDuration); // var eventType = availableTrackItems[random.Next(0, availableTrackItems.Count() - 1)]; // var newEvent = Clip.Instantiate(eventType); // newEvent.Duration = random.Next(40, maxDuration); // newEvent.StartFrame = currentFrame; // newEvent.TrackId = track.Id; // tape.Clips.Add(newEvent); // currentFrame += newEvent.Duration; // } // } // OpenDocument(tape); //} //private static void OpenDocument(Tape tape) //{ // tape.OpenDocument(); //} } }