From a087d92725553b783aabd61d2899288bfae56cd4 Mon Sep 17 00:00:00 2001 From: Whiplash Date: Mon, 17 Oct 2016 15:33:21 +0200 Subject: [PATCH 1/2] Framebased Delay Framebased Delay added for Addonpack --- .../Delay (Animation Framebased) help.v4p | 233 ++++++++++++++++++ .../DelayFramebased/DelayFramebased.csproj | 54 ++++ .../DelayFramebased/DelayFramebasedNode.cs | 151 ++++++++++++ .../Properties/AssemblyInfo.cs | 31 +++ 4 files changed, 469 insertions(+) create mode 100644 vvvv45/addonpack/lib/nodes/plugins/Delay (Animation Framebased) help.v4p create mode 100644 vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebased.csproj create mode 100644 vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebasedNode.cs create mode 100644 vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/Properties/AssemblyInfo.cs diff --git a/vvvv45/addonpack/lib/nodes/plugins/Delay (Animation Framebased) help.v4p b/vvvv45/addonpack/lib/nodes/plugins/Delay (Animation Framebased) help.v4p new file mode 100644 index 000000000..a13dad8e4 --- /dev/null +++ b/vvvv45/addonpack/lib/nodes/plugins/Delay (Animation Framebased) help.v4p @@ -0,0 +1,233 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebased.csproj b/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebased.csproj new file mode 100644 index 000000000..f9f2438ee --- /dev/null +++ b/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebased.csproj @@ -0,0 +1,54 @@ + + + + {6A0AFB1F-8219-4A08-85F7-B7F19B66AC16} + Debug + x86 + Library + VVVV.Nodes + ValueFrameDelayAdvanced + v4.0 + bin\$(Platform)\$(Configuration)\ + True + ..\..\..\..\..\OmniPlus\DATA\vvvv_45beta34.2_x86\lib\core\;..\..\..\..\..\OmniPlus\DATA\vvvv_45beta34.2_x86\lib\nodes\plugins\;..\..\vvvv_45beta34.2_x86\lib\core\;..\..\vvvv_45beta34.2_x86\lib\nodes\plugins\ + + + DEBUG;TRACE + False + True + Full + True + + + TRACE + True + False + None + False + + + AnyCPU + + + x86 + + + x64 + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebasedNode.cs b/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebasedNode.cs new file mode 100644 index 000000000..4e55e6c8c --- /dev/null +++ b/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebasedNode.cs @@ -0,0 +1,151 @@ +#region usings +using System; +using System.ComponentModel.Composition; + +using System.Collections.Generic; +using System.Collections; + +using VVVV.PluginInterfaces.V1; +using VVVV.PluginInterfaces.V2; +using VVVV.Utils.VColor; +using VVVV.Utils.VMath; + +using VVVV.Core.Logging; +#endregion usings + +namespace VVVV.Nodes +{ + #region PluginInfo + [PluginInfo(Name = "Delay", Category = "Animation", Version ="Framebased", Help = "Framebased delay with adjustable frame count.", Tags = "Whiplash/joshuavh")] + #endregion PluginInfo + public class DelayFramebased : IPluginEvaluate + { + #region fields & pins + [Input("Input", DefaultValue = 1.0)] + public ISpread FInput; + + [Input("Skip", IsBang = false)] + public ISpread skip; + + [Input("Reset", IsBang = false)] + public ISpread reset; + + [Input("Delay", DefaultValue = 1.0, MinValue = 0)] + public ISpread delayFrames; + + + [Output("Output")] + public ISpread FOutput; + + + + [Import()] + public ILogger FLogger; + #endregion fields & pins + + +//////////////////////////////////////////////////////////////////////////// + + + List> listOfQueue = new List>(); + + +//////////////////////////////////////////////////////////////////////////// + + //called when data for any output pin is requested + + public void Evaluate(int SpreadMax) + { + + + FOutput.SliceCount = SpreadMax; + + + if(SpreadMax != listOfQueue.Count){ + + int difference = SpreadMax - listOfQueue.Count; + + + + if(difference < 0){ + + int temp = difference * -1; + listOfQueue.RemoveRange(SpreadMax-1,temp); + + } + + if(difference > 0){ + for(int i = 0; i()); + } + } + + + } + + + for(int index = 0; index=0){ + setDelayQueue(index, SpreadMax, difference); + } + + else{ + FOutput[index] = FInput[index]; + } + + } + + if(reset[index]){ + listOfQueue[index].Clear(); + } + + listOfQueue[index].Enqueue(FInput[index]); + + if(skip[index]){ + FOutput[index] = FInput[index]; + } + + else{ + FOutput[index] = listOfQueue[index].Dequeue(); + } + } + + + } + + +//////////////////////////////////////////////////////////////////////////// + + + public void setDelayQueue(int index, int SMax, int diff){ + + + if(diff > 0){ + for(int i = 0; i < diff; i++){ + listOfQueue[index].Enqueue(FInput[index]); + } + } + + if(diff < 0){ + + int temp = diff * -1; + + for(int i = 0; i Date: Thu, 27 Oct 2016 10:51:02 +0200 Subject: [PATCH 2/2] Delay Framebased minor changes --- .../Delay (Animation Framebased) help.v4p | 8 +- .../DelayFramebased/DelayFramebased.csproj | 4 +- .../DelayFramebased/DelayFramebasedNode.cs | 74 +++++-------------- 3 files changed, 26 insertions(+), 60 deletions(-) diff --git a/vvvv45/addonpack/lib/nodes/plugins/Delay (Animation Framebased) help.v4p b/vvvv45/addonpack/lib/nodes/plugins/Delay (Animation Framebased) help.v4p index a13dad8e4..f919f76a9 100644 --- a/vvvv45/addonpack/lib/nodes/plugins/Delay (Animation Framebased) help.v4p +++ b/vvvv45/addonpack/lib/nodes/plugins/Delay (Animation Framebased) help.v4p @@ -143,7 +143,7 @@ - + @@ -155,9 +155,9 @@ - + - + @@ -205,7 +205,7 @@ - + diff --git a/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebased.csproj b/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebased.csproj index f9f2438ee..391d8ef78 100644 --- a/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebased.csproj +++ b/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebased.csproj @@ -6,7 +6,7 @@ x86 Library VVVV.Nodes - ValueFrameDelayAdvanced + DelayFramebased v4.0 bin\$(Platform)\$(Configuration)\ True @@ -47,8 +47,8 @@ - + \ No newline at end of file diff --git a/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebasedNode.cs b/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebasedNode.cs index 4e55e6c8c..26ec48dbd 100644 --- a/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebasedNode.cs +++ b/vvvv45/addonpack/src/nodes/plugins/Animation/DelayFramebased/DelayFramebasedNode.cs @@ -16,7 +16,7 @@ namespace VVVV.Nodes { #region PluginInfo - [PluginInfo(Name = "Delay", Category = "Animation", Version ="Framebased", Help = "Framebased delay with adjustable frame count.", Tags = "Whiplash/joshuavh")] + [PluginInfo(Name = "Delay", Category = "Animation", Version ="Framebased", Help = "Framebased delay with adjustable frame count")] #endregion PluginInfo public class DelayFramebased : IPluginEvaluate { @@ -24,91 +24,68 @@ public class DelayFramebased : IPluginEvaluate [Input("Input", DefaultValue = 1.0)] public ISpread FInput; - [Input("Skip", IsBang = false)] - public ISpread skip; + [Input("Skip")] + public ISpread FSkip; - [Input("Reset", IsBang = false)] - public ISpread reset; + [Input("Reset")] + public ISpread FReset; [Input("Delay", DefaultValue = 1.0, MinValue = 0)] - public ISpread delayFrames; - - + public ISpread FDelayFrames; + [Output("Output")] public ISpread FOutput; - - [Import()] public ILogger FLogger; #endregion fields & pins - -//////////////////////////////////////////////////////////////////////////// - - List> listOfQueue = new List>(); - -//////////////////////////////////////////////////////////////////////////// - - //called when data for any output pin is requested - public void Evaluate(int SpreadMax) { - - FOutput.SliceCount = SpreadMax; if(SpreadMax != listOfQueue.Count){ int difference = SpreadMax - listOfQueue.Count; - - - + if(difference < 0){ int temp = difference * -1; - listOfQueue.RemoveRange(SpreadMax-1,temp); - + listOfQueue.RemoveRange(SpreadMax-1,temp); } if(difference > 0){ for(int i = 0; i()); } - } - - + } } - for(int index = 0; index=0){ - setDelayQueue(index, SpreadMax, difference); + if(FDelayFrames[index]>=0){ + SetDelayQueue(index, SpreadMax, difference); } else{ FOutput[index] = FInput[index]; } - } - if(reset[index]){ + if(FReset[index]){ listOfQueue[index].Clear(); } listOfQueue[index].Enqueue(FInput[index]); - if(skip[index]){ + if(FSkip[index]){ FOutput[index] = FInput[index]; } @@ -116,16 +93,9 @@ public void Evaluate(int SpreadMax) FOutput[index] = listOfQueue[index].Dequeue(); } } - - } - -//////////////////////////////////////////////////////////////////////////// - - - public void setDelayQueue(int index, int SMax, int diff){ - + public void SetDelayQueue(int index, int SMax, int diff){ if(diff > 0){ for(int i = 0; i < diff; i++){ @@ -140,12 +110,8 @@ public void setDelayQueue(int index, int SMax, int diff){ for(int i = 0; i