diff --git a/Datamosh.cs b/Datamosh.cs index ce6f3e4..e767c2f 100644 --- a/Datamosh.cs +++ b/Datamosh.cs @@ -6,7 +6,7 @@ // License: MIT // Source: https://github.com/delthas/vegas-datamosh // Documentation: https://github.com/delthas/vegas-datamosh -// Version: 1.1.0 +// Version: 1.1.1 // using System; @@ -202,7 +202,7 @@ public void FromVegas(Vegas vegas) { }; var textLabel = new Label {Left = 10, Top = 10, Text = "Frame count"}; var inputBox = - new NumericUpDown {Left = 200, Top = 10, Width = 200, Value = defaultCount, Minimum = 1, Maximum = 1000000000}; + new NumericUpDown {Left = 200, Top = 10, Width = 200, Minimum = 1, Maximum = 1000000000, Value = defaultCount}; var textLabel2 = new Label {Left = 10, Top = 40, Text = "Frames repeats"}; var inputBox2 = new NumericUpDown { Left = 200, diff --git a/Datamosh.cs.config b/Datamosh.cs.config index ad57730..fbd7c0f 100644 --- a/Datamosh.cs.config +++ b/Datamosh.cs.config @@ -7,4 +7,5 @@ Microsoft.WindowsAPICodePack.Shell.dll Microsoft.WindowsAPICodePack.dll -debug -D:DEBUG + Datamosh.png \ No newline at end of file diff --git a/Datamosh14.cs b/Datamosh14.cs index c1d4db5..dd314c8 100644 --- a/Datamosh14.cs +++ b/Datamosh14.cs @@ -6,7 +6,7 @@ // License: MIT // Source: https://github.com/delthas/vegas-datamosh // Documentation: https://github.com/delthas/vegas-datamosh -// Version: 1.1.0 +// Version: 1.1.1 // using System; @@ -16,7 +16,7 @@ using System.Windows.Forms; using Microsoft.Win32; using Microsoft.WindowsAPICodePack.Dialogs; -using ScriptPortal.Vegas; +using Sony.Vegas; namespace VegasDatamosh { public class EntryPoint { @@ -202,7 +202,7 @@ public void FromVegas(Vegas vegas) { }; var textLabel = new Label {Left = 10, Top = 10, Text = "Frame count"}; var inputBox = - new NumericUpDown {Left = 200, Top = 10, Width = 200, Value = defaultCount, Minimum = 1, Maximum = 1000000000}; + new NumericUpDown {Left = 200, Top = 10, Width = 200, Minimum = 1, Maximum = 1000000000, Value = defaultCount}; var textLabel2 = new Label {Left = 10, Top = 40, Text = "Frames repeats"}; var inputBox2 = new NumericUpDown { Left = 200, diff --git a/Datamosh14.cs.config b/Datamosh14.cs.config index ad57730..fbd7c0f 100644 --- a/Datamosh14.cs.config +++ b/Datamosh14.cs.config @@ -7,4 +7,5 @@ Microsoft.WindowsAPICodePack.Shell.dll Microsoft.WindowsAPICodePack.dll -debug -D:DEBUG + Datamosh.png \ No newline at end of file diff --git a/Layer.cs b/Layer.cs index da4813a..649f202 100644 --- a/Layer.cs +++ b/Layer.cs @@ -6,7 +6,7 @@ // License: MIT // Source: https://github.com/delthas/vegas-datamosh // Documentation: https://github.com/delthas/vegas-datamosh -// Version: 1.1.0 +// Version: 1.1.1 // using System; @@ -14,6 +14,7 @@ using System.Diagnostics; using System.IO; using System.Windows.Forms; +using System.Windows.Forms.VisualStyles; using Microsoft.Win32; using Microsoft.WindowsAPICodePack.Dialogs; using Sony.Vegas; @@ -197,13 +198,13 @@ public void FromVegas(Vegas vegas) { Left = 200, Top = 10, Width = 200, - Value = defaultCount, Minimum = 1, - Maximum = 1000000000 + Maximum = 1000000000, + Value = defaultCount }; var textLabel2 = new Label {Left = 10, Top = 40, Text = "Layering offset"}; var inputBox2 = - new NumericUpDown {Left = 200, Top = 40, Width = 200, Minimum = 1, Text = "", Maximum = 1000000000}; + new NumericUpDown {Left = 200, Top = 40, Width = 200, Minimum = -1000000000, Maximum = 1000000000, Text = ""}; var textLabel3 = new Label {Left = 10, Top = 70, Text = "Render"}; var inputBox3 = new CheckBox { Left = 200, @@ -234,8 +235,8 @@ public void FromVegas(Vegas vegas) { var offset = (int) inputBox2.Value; var render = inputBox3.Checked; - if (offset <= 0) { - MessageBox.Show("Layering offset must be > 0!"); + if (offset == 0) { + MessageBox.Show("Layering offset must not be 0!"); return; } @@ -258,17 +259,23 @@ public void FromVegas(Vegas vegas) { var newTracks = new List(); var newEvents = new List(); var current = 0; + var baseOffset = offset > 0 ? 0 : -count * offset; for (var i = videoTrackIndex - 1; i >= 0 && current < count; i--) { var videoTrack = vegas.Project.Tracks[i] as VideoTrack; if (videoTrack == null) continue; - newEvents.Add((VideoEvent) videoEvent.Copy(videoTrack, Timecode.FromFrames(videoEvent.Start.FrameCount + (++current) * offset))); + newEvents.Add((VideoEvent) videoEvent.Copy(videoTrack, Timecode.FromFrames(videoEvent.Start.FrameCount + baseOffset + (++current) * offset))); } for (; current < count;) { var videoTrack = vegas.Project.AddVideoTrack(); newTracks.Add(videoTrack); - newEvents.Add((VideoEvent) videoEvent.Copy(videoTrack, Timecode.FromFrames(videoEvent.Start.FrameCount + (++current) * offset))); + newEvents.Add((VideoEvent) videoEvent.Copy(videoTrack, Timecode.FromFrames(videoEvent.Start.FrameCount + baseOffset + (++current) * offset))); + } + + var start = videoEvent.Start; + if (offset < 0) { + videoEvent.Start = Timecode.FromFrames(videoEvent.Start.FrameCount + baseOffset); } if (!render) return; @@ -313,8 +320,8 @@ public void FromVegas(Vegas vegas) { var renderArgs = new RenderArgs { OutputFile = path, - Start = Timecode.FromFrames(videoEvent.Start.FrameCount), - Length = Timecode.FromFrames(videoEvent.Length.FrameCount + count * offset), + Start = Timecode.FromFrames(start.FrameCount), + Length = Timecode.FromFrames(videoEvent.Length.FrameCount + count * Math.Abs(offset)), RenderTemplate = template }; var status = vegas.Render(renderArgs); @@ -326,8 +333,8 @@ public void FromVegas(Vegas vegas) { File.Delete(pathEncoded + ".sfl"); var media = vegas.Project.MediaPool.AddMedia(path); - var newVideoEvent = videoTrackStart.AddVideoEvent(videoEvent.Start, - Timecode.FromFrames(videoEvent.Length.FrameCount + count * offset)); + var newVideoEvent = videoTrackStart.AddVideoEvent(start, + Timecode.FromFrames(videoEvent.Length.FrameCount + count * Math.Abs(offset))); ((VideoStream) newVideoEvent.AddTake(media.GetVideoStreamByIndex(0)).MediaStream).AlphaChannel = VideoAlphaType.Straight; videoEvent.Track.Events.Remove(videoEvent); diff --git a/Layer.cs.config b/Layer.cs.config index ad57730..87d1874 100644 --- a/Layer.cs.config +++ b/Layer.cs.config @@ -7,4 +7,5 @@ Microsoft.WindowsAPICodePack.Shell.dll Microsoft.WindowsAPICodePack.dll -debug -D:DEBUG + Layer.png \ No newline at end of file diff --git a/Layer14.cs b/Layer14.cs index f7f58c2..f26c7c5 100644 --- a/Layer14.cs +++ b/Layer14.cs @@ -6,7 +6,7 @@ // License: MIT // Source: https://github.com/delthas/vegas-datamosh // Documentation: https://github.com/delthas/vegas-datamosh -// Version: 1.1.0 +// Version: 1.1.1 // using System; @@ -14,9 +14,10 @@ using System.Diagnostics; using System.IO; using System.Windows.Forms; +using System.Windows.Forms.VisualStyles; using Microsoft.Win32; using Microsoft.WindowsAPICodePack.Dialogs; -using ScriptPortal.Vegas; +using Sony.Vegas; namespace VegasLayering { public class EntryPoint { @@ -197,13 +198,13 @@ public void FromVegas(Vegas vegas) { Left = 200, Top = 10, Width = 200, - Value = defaultCount, Minimum = 1, - Maximum = 1000000000 + Maximum = 1000000000, + Value = defaultCount }; var textLabel2 = new Label {Left = 10, Top = 40, Text = "Layering offset"}; var inputBox2 = - new NumericUpDown {Left = 200, Top = 40, Width = 200, Minimum = 1, Text = "", Maximum = 1000000000}; + new NumericUpDown {Left = 200, Top = 40, Width = 200, Minimum = -1000000000, Maximum = 1000000000, Text = ""}; var textLabel3 = new Label {Left = 10, Top = 70, Text = "Render"}; var inputBox3 = new CheckBox { Left = 200, @@ -234,8 +235,8 @@ public void FromVegas(Vegas vegas) { var offset = (int) inputBox2.Value; var render = inputBox3.Checked; - if (offset <= 0) { - MessageBox.Show("Layering offset must be > 0!"); + if (offset == 0) { + MessageBox.Show("Layering offset must not be 0!"); return; } @@ -258,17 +259,23 @@ public void FromVegas(Vegas vegas) { var newTracks = new List(); var newEvents = new List(); var current = 0; + var baseOffset = offset > 0 ? 0 : -count * offset; for (var i = videoTrackIndex - 1; i >= 0 && current < count; i--) { var videoTrack = vegas.Project.Tracks[i] as VideoTrack; if (videoTrack == null) continue; - newEvents.Add((VideoEvent) videoEvent.Copy(videoTrack, Timecode.FromFrames(videoEvent.Start.FrameCount + (++current) * offset))); + newEvents.Add((VideoEvent) videoEvent.Copy(videoTrack, Timecode.FromFrames(videoEvent.Start.FrameCount + baseOffset + (++current) * offset))); } for (; current < count;) { var videoTrack = vegas.Project.AddVideoTrack(); newTracks.Add(videoTrack); - newEvents.Add((VideoEvent) videoEvent.Copy(videoTrack, Timecode.FromFrames(videoEvent.Start.FrameCount + (++current) * offset))); + newEvents.Add((VideoEvent) videoEvent.Copy(videoTrack, Timecode.FromFrames(videoEvent.Start.FrameCount + baseOffset + (++current) * offset))); + } + + var start = videoEvent.Start; + if (offset < 0) { + videoEvent.Start = Timecode.FromFrames(videoEvent.Start.FrameCount + baseOffset); } if (!render) return; @@ -313,8 +320,8 @@ public void FromVegas(Vegas vegas) { var renderArgs = new RenderArgs { OutputFile = path, - Start = Timecode.FromFrames(videoEvent.Start.FrameCount), - Length = Timecode.FromFrames(videoEvent.Length.FrameCount + count * offset), + Start = Timecode.FromFrames(start.FrameCount), + Length = Timecode.FromFrames(videoEvent.Length.FrameCount + count * Math.Abs(offset)), RenderTemplate = template }; var status = vegas.Render(renderArgs); @@ -326,8 +333,8 @@ public void FromVegas(Vegas vegas) { File.Delete(pathEncoded + ".sfl"); var media = vegas.Project.MediaPool.AddMedia(path); - var newVideoEvent = videoTrackStart.AddVideoEvent(videoEvent.Start, - Timecode.FromFrames(videoEvent.Length.FrameCount + count * offset)); + var newVideoEvent = videoTrackStart.AddVideoEvent(start, + Timecode.FromFrames(videoEvent.Length.FrameCount + count * Math.Abs(offset))); ((VideoStream) newVideoEvent.AddTake(media.GetVideoStreamByIndex(0)).MediaStream).AlphaChannel = VideoAlphaType.Straight; videoEvent.Track.Events.Remove(videoEvent); diff --git a/Layer14.cs.config b/Layer14.cs.config index ad57730..87d1874 100644 --- a/Layer14.cs.config +++ b/Layer14.cs.config @@ -7,4 +7,5 @@ Microsoft.WindowsAPICodePack.Shell.dll Microsoft.WindowsAPICodePack.dll -debug -D:DEBUG + Layer.png \ No newline at end of file diff --git a/README.md b/README.md index ac2bafa..6818ba9 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,8 @@ This does multilayering, by copying the select video clip/event N times, each ti To use, select a single video clip/event, then it will be multilayered automatically, and rendered transparently if specified. +*You can use a negative offset (eg -2 instead of 2), in which case the newest clips/events will be added at the back, instead of the front of the previous events.* + **If you choose to render automatically, the rendered file will support alpha/transparency, meaning you don't need to add a green screen and remove it after, the alpha is handled automatically.** ### Render diff --git a/Render.cs b/Render.cs index fa72062..3e7d766 100644 --- a/Render.cs +++ b/Render.cs @@ -6,7 +6,7 @@ // License: MIT // Source: https://github.com/delthas/vegas-datamosh // Documentation: https://github.com/delthas/vegas-datamosh -// Version: 1.1.0 +// Version: 1.1.1 // using System; diff --git a/Render.cs.config b/Render.cs.config index ad57730..cab7a5b 100644 --- a/Render.cs.config +++ b/Render.cs.config @@ -7,4 +7,5 @@ Microsoft.WindowsAPICodePack.Shell.dll Microsoft.WindowsAPICodePack.dll -debug -D:DEBUG + Render.png \ No newline at end of file diff --git a/Render14.cs b/Render14.cs index 76b46df..09f4b78 100644 --- a/Render14.cs +++ b/Render14.cs @@ -6,7 +6,7 @@ // License: MIT // Source: https://github.com/delthas/vegas-datamosh // Documentation: https://github.com/delthas/vegas-datamosh -// Version: 1.1.0 +// Version: 1.1.1 // using System; @@ -16,7 +16,7 @@ using System.Windows.Forms; using Microsoft.Win32; using Microsoft.WindowsAPICodePack.Dialogs; -using ScriptPortal.Vegas; +using Sony.Vegas; namespace VegasRender { public class EntryPoint { diff --git a/Render14.cs.config b/Render14.cs.config index ad57730..cab7a5b 100644 --- a/Render14.cs.config +++ b/Render14.cs.config @@ -7,4 +7,5 @@ Microsoft.WindowsAPICodePack.Shell.dll Microsoft.WindowsAPICodePack.dll -debug -D:DEBUG + Render.png \ No newline at end of file