|
1 | 1 | //YTPMVE
|
2 |
| -//20250127 |
| 2 | +//20250129 |
3 | 3 | using System;
|
4 | 4 | using System.IO;
|
5 | 5 | using System.Collections.Generic;
|
@@ -662,7 +662,48 @@ public void FromVegas(Vegas vegas)
|
662 | 662 | {
|
663 | 663 | source_event.Track.Events.Remove(source_event);
|
664 | 664 | }
|
665 |
| - |
| 665 | + |
| 666 | + //Distribute overlapping duplicates to multiple tracks as needed |
| 667 | + Track current_track = null; |
| 668 | + Track track_below = null; |
| 669 | + TrackEvent current_event = null; |
| 670 | + TrackEvent next_event = null; |
| 671 | + for (int i = 0; i < this_application.Project.Tracks.Count - 1; i++) |
| 672 | + { |
| 673 | + current_track = this_application.Project.Tracks[i]; |
| 674 | + for (int j = 0; j < current_track.Events.Count - 1; j++) |
| 675 | + { |
| 676 | + current_event = current_track.Events[j]; |
| 677 | + next_event = current_track.Events[current_event.Index + 1]; |
| 678 | + if (current_event.Start > next_event.Start || current_event.Start < next_event.End) |
| 679 | + { |
| 680 | + if (track_below != null) |
| 681 | + { |
| 682 | + //move to track_below |
| 683 | + current_event.Copy(this_application.Project.Tracks[track_below.Index], current_event.Start); |
| 684 | + current_event.Track.Events.Remove(current_event); |
| 685 | + } |
| 686 | + else |
| 687 | + { |
| 688 | + //MessageBox.Show("before creating track", "Warning" , MessageBoxButtons.OK, MessageBoxIcon.Warning); |
| 689 | + //create track_below |
| 690 | + if(current_track.IsVideo()){ |
| 691 | + track_below = new VideoTrack(current_track.Index+1, current_track.Name); |
| 692 | + } |
| 693 | + if(current_track.IsAudio()){ |
| 694 | + track_below = new AudioTrack(current_track.Index+1, current_track.Name); |
| 695 | + } |
| 696 | + this_application.Project.Tracks.Add(track_below); |
| 697 | + //MessageBox.Show("after creating track", "Warning" , MessageBoxButtons.OK, MessageBoxIcon.Warning); |
| 698 | + //move to track_below |
| 699 | + current_event.Copy(this_application.Project.Tracks[track_below.Index], current_event.Start); |
| 700 | + current_event.Track.Events.Remove(current_event); |
| 701 | + } |
| 702 | + } |
| 703 | + } |
| 704 | + //Set the variable to null to ensure a new track is created on the next loop |
| 705 | + track_below = null; |
| 706 | + } |
666 | 707 |
|
667 | 708 | //In this second loop, all other effects would be applied.
|
668 | 709 | iterator = -1;
|
|
0 commit comments