Skip to content

Commit

Permalink
Update to 4.28.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
otomad committed Apr 3, 2023
1 parent 8a58e11 commit ce47b04
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<h1>VegasScripts</h1>
<p>
<img src="https://img.shields.io/badge/STATE-STABLE-green?style=flat-square" alt="State" />
<img src="https://img.shields.io/badge/VERSION-4.28.1.0-orange?style=flat-square" alt="Version" />
<img src="https://img.shields.io/badge/VERSION-4.28.3.0-orange?style=flat-square" alt="Version" />
<img src="https://img.shields.io/github/downloads/otomad/OtomadHelper/total.svg?style=flat-square&label=DOWNLOADS" alt="Downloads">
</p>
</div>
Expand Down
30 changes: 23 additions & 7 deletions otomad_helper/Otomad Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ namespace Otomad.VegasScript.OtomadHelper.V4 {
/// </summary>
public class EntryPoint {
/// <summary>版本号</summary>
public static readonly Version VERSION = new Version(4, 28, 1, 0);
public static readonly Version VERSION = new Version(4, 28, 3, 0);
/// <summary>修订日期</summary>
public static readonly DateTime REVISION_DATE = new DateTime(2023, 4, 1);
public static readonly DateTime REVISION_DATE = new DateTime(2023, 4, 3);

// 配置参数变量
#region 视频属性
Expand Down Expand Up @@ -11095,16 +11095,15 @@ private Track FindASuitableTrack<T>(Timecode start, Timecode length, IEnumerable
if (typeof(T) == typeof(AudioEvent) && NoAudio || typeof(T) == typeof(VideoEvent) && NoVideo) return null;
Track track = null;
IEnumerable<Track> tracks = IsAudio<T>() ? audioTracks.Cast<Track>() : videoTracks.Cast<Track>();
Timecode end = start + length;
if (!IsSingleTrack<T>()) {
Timecode end = start + length;
foreach (Track otherTrack in tracks) {
if (exceptTracks != null && exceptTracks.Contains(otherTrack)) continue;
TrackOtherInfo info = GetTrackOtherInfo(otherTrack);
if (length.ToMilliseconds() == 0) goto ok;
if (info.length > Round(start)) continue;
if (!IsAlwaysNewTrack<T>()) {
bool _;
List<TrackEvent> inEvents = FindEventsAlmostIn(otherTrack, start, end, out _, EXAMPLE_EVENT_NAME, true);
List<TrackEvent> inEvents = FindEventsAlmostIn(otherTrack, start, end, EXAMPLE_EVENT_NAME, true);
if (inEvents.Count != 0) continue;
}
ok:
Expand All @@ -11113,11 +11112,28 @@ private Track FindASuitableTrack<T>(Timecode start, Timecode length, IEnumerable
break;
}
} else track = tracks.FirstOrDefault();
if (track == null)
if (track == null) {
track = IsAudio<T>() ? AddAudioTrackAfter() as Track : AddVideoTrackBefore() as Track;
GetTrackOtherInfo(track).Length = end;
}
return track;
}

/// <summary>
/// 查找轨道中不完全在指定的时间范围内的所有事件。
/// </summary>
/// <remarks>注意:使用本函数会非常地慢。</remarks>
/// <param name="track">轨道。</param>
/// <param name="start">开始时间。</param>
/// <param name="end">结束时间。</param>
/// <param name="exceptName">如事件名称为此的话则排除在外。</param>
/// <param name="justFindOne">只找一个,用于仅判断是否有内容而不是获取内容,以节约性能。</param>
/// <returns>在指定的时间范围内的所有轨道事件。</returns>
public static List<TrackEvent> FindEventsAlmostIn(Track track, Timecode start, Timecode end, string exceptName = null, bool justFindOne = false) {
bool _;
return FindEventsAlmostIn(track, start, end, out _, exceptName, justFindOne);
}

/// <summary>
/// 查找轨道中不完全在指定的时间范围内的所有事件。
/// </summary>
Expand Down Expand Up @@ -11151,7 +11167,7 @@ public static List<TrackEvent> FindEventsAlmostIn(Track track, Timecode start, T
private readonly static Dictionary<Track, TrackOtherInfo> trackOtherInfos = new Dictionary<Track, TrackOtherInfo>();
private class TrackOtherInfo {
public List<TrackEvent> originalEvents;
public int length = -1;
public int length = 0;
public Timecode Length {
set {
int ms = Round(value);
Expand Down

0 comments on commit ce47b04

Please sign in to comment.