diff --git a/deform/lattice.py b/deform/lattice.py index 972564a..4825d3f 100644 --- a/deform/lattice.py +++ b/deform/lattice.py @@ -138,7 +138,6 @@ def modal(self, context, event): elif no_stream(self.lattice_points_w_input_stream) and self.key_ctrl: self.lattice_points_w += 1 self.dirty = True - elif self.key_step_down: if no_stream(self.lattice_points_u_input_stream) and self.uniform: @@ -165,6 +164,23 @@ def modal(self, context, event): elif self.key_movement_passthrough: return {'PASS_THROUGH'} + if get_preferences().enable_mouse_values: + if no_stream(self.lattice_points_u_input_stream) and self.uniform: + self.lattice_points_u = max(2, self.lattice_points_u + self.mouse_step) + self.lattice_points_v = self.lattice_points_u + self.lattice_points_w = self.lattice_points_u + self.dirty = True + elif not self.uniform: + if no_stream(self.lattice_points_u_input_stream) and self.key_no_modifiers: + self.lattice_points_u = max(2, self.lattice_points_u + self.mouse_step) + self.dirty = True + elif no_stream(self.lattice_points_v_input_stream) and self.key_alt: + self.lattice_points_v = max(2, self.lattice_points_v + self.mouse_step) + self.dirty = True + elif no_stream(self.lattice_points_w_input_stream) and self.key_ctrl: + self.lattice_points_w = max(2, self.lattice_points_w + self.mouse_step) + self.dirty = True + if self.dirty: self.operate(context) @@ -354,6 +370,7 @@ def draw_text_callback(self): "(±1)", active=(self.uniform or self.key_no_modifiers), alt_mode=False, + mouse_value=True, input_stream=self.lattice_points_u_input_stream) draw_property( @@ -362,6 +379,7 @@ def draw_text_callback(self): "Alt (±1)", active=(self.uniform or self.key_alt), alt_mode=False, + mouse_value=True, input_stream=self.lattice_points_v_input_stream) draw_property( @@ -370,6 +388,7 @@ def draw_text_callback(self): "Ctrl (±1)", active=(self.uniform or self.key_ctrl), alt_mode=False, + mouse_value=True, input_stream=self.lattice_points_w_input_stream) draw_hint( diff --git a/extrusion/screw.py b/extrusion/screw.py index 89d045f..2267d28 100644 --- a/extrusion/screw.py +++ b/extrusion/screw.py @@ -151,6 +151,9 @@ def modal(self, context, event): elif no_stream(self.angle_input_stream) and self.key_alt: self.angle = max(-360, min(360, self.angle + self.mouse_value_mag)) self.dirty = True + elif no_stream(self.segments_input_stream) and self.key_no_modifiers: + self.segments = max(3, self.segments + self.mouse_step) + self.dirty = True if self.dirty: self.operate(context) @@ -320,6 +323,7 @@ def draw_text_callback(self): "(±2) | Shift (±1)", active=self.key_no_modifiers, alt_mode=self.key_shift_no_modifiers, + mouse_value=True, input_stream=self.segments_input_stream) draw_property( diff --git a/lib/events.py b/lib/events.py index 988cdfd..96a28bf 100644 --- a/lib/events.py +++ b/lib/events.py @@ -80,7 +80,10 @@ def capture_modifier_keys(cls, event=None, mouse_x=0): cls.prev_mouse_travel_div = 0 if event == None else cls.mouse_travel_div cls.mouse_travel_div = cls.mouse_travel // get_preferences().mouse_value_steps - cls.mouse_step = int(1 * copysign(1, cls.mouse_travel)) if cls.prev_mouse_travel_div != cls.mouse_travel_div else 0 + if cls.prev_mouse_travel_div != cls.mouse_travel_div and abs(cls.mouse_travel) >= get_preferences().mouse_value_steps: + cls.mouse_step = int(1 * copysign(1, cls.mouse_travel)) + else: + cls.mouse_step = 0 if event == None or cls.mouse_warped: cls.mouse_delta = 0 diff --git a/replicate/array_cubed.py b/replicate/array_cubed.py index d4e5667..4dfa9f3 100644 --- a/replicate/array_cubed.py +++ b/replicate/array_cubed.py @@ -135,7 +135,20 @@ def modal(self, context, event): return {'PASS_THROUGH'} if get_preferences().enable_mouse_values: - if self.key_ctrl: + if self.key_no_modifiers and abs(self.mouse_step) > 0: + if self.mouse_step > 0: + new_count = self.axes[self.axis][1] + (1 if self.axes[self.axis][2] >= 0 else -1) + elif self.mouse_step < 0: + 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 + + self.dirty = True + elif self.key_ctrl: self.axes[self.axis][2] += self.mouse_value self.dirty = True @@ -262,6 +275,7 @@ def draw_text_callback(self): "Alt (±1)", active=self.key_no_modifiers, alt_mode=False, + mouse_value=True, input_stream=self.count_streams[self.axis]) draw_property( diff --git a/replicate/circular_array.py b/replicate/circular_array.py index cbd8962..5a9989d 100644 --- a/replicate/circular_array.py +++ b/replicate/circular_array.py @@ -150,6 +150,9 @@ def modal(self, context, event): elif no_stream(self.offset_input_stream) and self.key_ctrl: self.offset += self.mouse_value self.dirty = True + elif no_stream(self.count_input_stream) and self.key_no_modifiers: + self.count = max(2, self.count + self.mouse_step) + self.dirty = True if self.dirty: self.operate(context) @@ -403,6 +406,7 @@ def draw_text_callback(self): "(±2) | Shift (±1)", active=self.key_no_modifiers, alt_mode=self.key_shift_no_modifiers, + mouse_value=True, input_stream=self.count_input_stream) draw_property(