Skip to content

Commit

Permalink
Added time multiplyer
Browse files Browse the repository at this point in the history
  • Loading branch information
johnroper100 committed Jul 29, 2017
1 parent cdc510d commit 7ea84cb
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion cm_bpyNodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions cm_channels/cm_noiseChannels.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion cm_nodeFunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand Down

0 comments on commit 7ea84cb

Please sign in to comment.