JD2022-TU1/main/tools/apps/DanceEditor/Source/TestData.cs

67 lines
No EOL
2.1 KiB
C#

using System;
using JD.Timeline.Document;
using TeaBox;
using System.Linq;
using JD.Serialization;
namespace DanceEditor
{
/// <summary>
/// Allows to open generated content to test the editor.
/// </summary>
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(MotionClip)
// };
// 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();
}
}
}