From 9138c665ec00fb62a24b9664e1f5d2008fb0b47c Mon Sep 17 00:00:00 2001 From: Tristan Strathearn Date: Fri, 22 Apr 2022 15:55:46 +1000 Subject: [PATCH] feat: allow array_cubed count to roll faux negative --- power_mods/array_cubed.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/power_mods/array_cubed.py b/power_mods/array_cubed.py index 827e18a..096a81c 100644 --- a/power_mods/array_cubed.py +++ b/power_mods/array_cubed.py @@ -52,7 +52,13 @@ def modal(self, context, event): if self.key_no_modifiers: self.axis = (self.axis + 1) % 3 elif self.key_alt: - self.axes[self.axis][1] += 1 + new_count = self.axes[self.axis][1] + (1 if self.axes[self.axis][2] >= 0 else -1) + + if new_count == 1: + self.axes[self.axis][1] = 1 + self.axes[self.axis][2] = self.axes[self.axis][2] * -1 + else: + self.axes[self.axis][1] = new_count elif self.key_ctrl: self.axes[self.axis][2] += offset_factor @@ -62,7 +68,13 @@ def modal(self, context, event): if self.key_no_modifiers: self.axis = (self.axis - 1) % 3 elif self.key_alt: - self.axes[self.axis][1] = max(1, self.axes[self.axis][1] - 1) + new_count = self.axes[self.axis][1] - (1 if self.axes[self.axis][2] >= 0 else -1) + + if new_count == 0: + self.axes[self.axis][1] = 2 + self.axes[self.axis][2] = self.axes[self.axis][2] * -1 + else: + self.axes[self.axis][1] = new_count elif self.key_ctrl: self.axes[self.axis][2] -= offset_factor