From 7ea84cb246fc382695bef7eef905934c85a3c446 Mon Sep 17 00:00:00 2001 From: John Roper Date: Fri, 28 Jul 2017 21:48:08 -0400 Subject: [PATCH] Added time multiplyer --- cm_bpyNodes.py | 6 +++++- cm_channels/cm_noiseChannels.py | 4 ++-- cm_nodeFunctions.py | 2 +- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/cm_bpyNodes.py b/cm_bpyNodes.py index 03b0d6f..830502d 100644 --- a/cm_bpyNodes.py +++ b/cm_bpyNodes.py @@ -199,6 +199,7 @@ class NewInputNode(LogicNode): ("SINWAVE", "Sine Wave", "", 3)]) SineWaveAmplitude = FloatProperty(name="Amplitude", default=5.0) + SineWaveTimeMul = FloatProperty(name="Time Multiplier", default=1.0) PathName = StringProperty(name="Path Name") PathOptions = EnumProperty(name="Path Options", @@ -285,7 +286,9 @@ def draw_buttons(self, context, layout): elif self.InputSource == "NOISE": layout.prop(self, "NoiseOptions") if self.NoiseOptions == "SINWAVE": - layout.prop(self, "SineWaveAmplitude") + row = layout.row(expand=True) + row.prop(self, "SineWaveAmplitude") + row.prop(self, "SineWaveTimeMul") elif self.InputSource == "PATH": layout.prop_search( self, "PathName", context.scene.cm_paths, "coll") @@ -343,6 +346,7 @@ def getSettings(self, node): elif self.InputSource == "NOISE": node.settings["NoiseOptions"] = self.NoiseOptions node.settings["SineWaveAmplitude"] = self.SineWaveAmplitude + node.settings["SineWaveTimeMul"] = self.SineWaveTimeMul elif self.InputSource == "PATH": node.settings["PathName"] = self.PathName node.settings["PathOptions"] = self.PathOptions diff --git a/cm_channels/cm_noiseChannels.py b/cm_channels/cm_noiseChannels.py index 2e561bd..4a8a0f5 100644 --- a/cm_channels/cm_noiseChannels.py +++ b/cm_channels/cm_noiseChannels.py @@ -51,6 +51,6 @@ def agentRandom(self, offset=0): return result @timeChannel("Noise") - def sinWave(self, swa=5): + def sinWave(self, swtm=1.0, swa=5): """Returns a sine wave section in range -1 - 1 based on the current frame""" - return np.cos(bpy.context.scene.frame_current * 3.14 / swa) + return np.cos((bpy.context.scene.frame_current * swtm) * 3.14 / swa) diff --git a/cm_nodeFunctions.py b/cm_nodeFunctions.py index 76ef073..18e2c61 100644 --- a/cm_nodeFunctions.py +++ b/cm_nodeFunctions.py @@ -131,7 +131,7 @@ def core(self, inps, settings): elif settings["NoiseOptions"] == "AGENTRANDOM": return {"None": noise.agentRandom(offset=hash(self))} elif settings["NoiseOptions"] == "SINWAVE": - return {"None": noise.sinWave(self.settings["SineWaveAplitude"])} + return {"None": noise.sinWave(self.settings["SineWaveTimeMul"], self.settings["SineWaveAplitude"])} elif settings["InputSource"] == "PATH": if settings["PathOptions"] == "RZ":