Fixed bugs related to shift and added Z as input option

This commit is contained in:
Bruno Perdigão
2024-08-19 13:32:34 -03:00
committed by Bruno Perdigão
parent 67733c4449
commit eb0ed7fe6b
2 changed files with 8 additions and 6 deletions
@@ -2308,7 +2308,7 @@ class MeasureTool(bpy.types.Operator):
self.number_output = ""
self.number_is_negative = False
self.is_input_on = False
self.input_options = ["X", "Y", "D", "A"]
self.input_options = ["X", "Y", "Z", "D", "A"]
self.input_type = "OFF"
self.input_value_xy = [None, None]
self.input_panel = {"X": "", "Y": "", "Z": "", "D": "", "A": "", "AREA": ""}
@@ -2396,7 +2396,7 @@ class MeasureTool(bpy.types.Operator):
PolylineDecorator.set_input_panel(self.input_panel, self.input_type)
tool.Blender.update_viewport()
if event.value == "RELEASE" and event.type in self.input_options:
if event.value == "RELEASE" and event.type in self.input_options and not event.shift:
self.recalculate_inputs(context)
self.is_input_on = True
self.input_type = event.type
@@ -2436,17 +2436,17 @@ class MeasureTool(bpy.types.Operator):
PolylineDecorator.set_input_panel(self.input_panel, self.input_type)
tool.Blender.update_viewport()
if event.shift and event.type == "X":
if event.shift and event.value == "PRESS" and event.type == "X":
tool.Snap.set_use_default_container(False)
PolylineDecorator.set_use_default_container(False)
tool.Snap.set_snap_plane_method("YZ")
if event.shift and event.type == "Y":
if event.shift and event.value == "PRESS" and event.type == "Y":
tool.Snap.set_use_default_container(False)
PolylineDecorator.set_use_default_container(False)
tool.Snap.set_snap_plane_method("XZ")
if event.shift and event.type == "Z":
if event.shift and event.value == "PRESS" and event.type == "Z":
tool.Snap.set_use_default_container(False)
PolylineDecorator.set_use_default_container(False)
tool.Snap.set_snap_plane_method("XY")
+3 -1
View File
@@ -384,6 +384,8 @@ class Snap(bonsai.core.tool.Snap):
PolylineDecorator.set_plane(plane_origin, plane_normal)
intersection = tool.Raycast.ray_cast_to_plane(context, event, plane_origin, plane_normal)
axis_start = None
axis_end = None
if cls.snap_plane_method in {"XY", "XZ", "YZ"}:
# Locks snap into an angle axis
if event.shift:
@@ -407,7 +409,7 @@ class Snap(bonsai.core.tool.Snap):
snap_point = cls.select_snap_point(snap_points, intersection, snap_threshold)
if snap_point:
if event.shift:
if event.shift and axis_start:
snap_result, snap_type = cls.mix_snap_and_axis(snap_point, axis_start, axis_end, elevation)
cls.update_snaping_point(snap_result, snap_type)
cls.update_snaping_ref(snap_point[0], snap_point[1])