Sawtooth mode

This commit is contained in:
Alex "mcmonkey" Goodwin
2023-06-21 18:34:41 -07:00
parent 023d3e51b1
commit 403fdb2d2d
2 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -37,8 +37,6 @@ class DynThresh:
scale *= 1.0 - math.pow(self.step / max, self.sched_val)
elif mode == "Linear Repeating":
portion = ((self.step / max) * self.sched_val) % 1.0
start = math.floor(portion)
portion -= start
scale *= (0.5 - portion) * 2 if portion < 0.5 else (portion - 0.5) * 2
elif mode == "Cosine Repeating":
curved = 1.0 - (math.cos((self.step / max) * 3.14159 * self.sched_val) * 0.5 + 0.5)
@@ -46,6 +44,8 @@ class DynThresh:
start = math.floor(portion)
portion -= start
scale *= (0.5 - portion) * 2 if portion < 0.5 else (portion - 0.5) * 2
elif mode == "Sawtooth":
scale *= ((self.step / max) * self.sched_val) % 1.0
scale += min
return scale
+2 -2
View File
@@ -20,8 +20,8 @@ except Exception as e:
print(f"\n\n======\nError! UniPC sampler support failed to load! Is your WebUI up to date?\n(Error: {e})\n======")
######################### Data values #########################
VALID_MODES = ["Constant", "Linear Down", "Cosine Down", "Half Cosine Down", "Linear Up", "Cosine Up", "Half Cosine Up", "Power Up", "Power Down", "Linear Repeating", "Cosine Repeating"]
MODES_WITH_VALUE = ["Power Up", "Power Down", "Linear Repeating", "Cosine Repeating"]
VALID_MODES = ["Constant", "Linear Down", "Cosine Down", "Half Cosine Down", "Linear Up", "Cosine Up", "Half Cosine Up", "Power Up", "Power Down", "Linear Repeating", "Cosine Repeating", "Sawtooth"]
MODES_WITH_VALUE = ["Power Up", "Power Down", "Linear Repeating", "Cosine Repeating", "Sawtooth"]
######################### Script class entrypoint #########################
class Script(scripts.Script):