Polytool refactor for selecting plane and axis snap.

User can now select X, Y, Z to lock to an axis, and
S-X, S-Y and S-Z to lock to a plane.
This commit is contained in:
Bruno Perdigão
2024-08-26 13:32:02 -03:00
parent 3dde1b80b9
commit 6fa87a16ab
4 changed files with 82 additions and 26 deletions
@@ -2328,7 +2328,7 @@ class MeasureTool(bpy.types.Operator):
self.number_output = ""
self.number_is_negative = False
self.is_input_on = False
self.input_options = ["D", "A", "X", "Y", "Z"]
self.input_options = ["D", "A"]
self.input_type = "OFF"
self.input_value_xy = [None, None]
self.input_panel = {"D": "", "A": "", "X": "", "Y": "", "Z": ""}
@@ -2389,6 +2389,18 @@ class MeasureTool(bpy.types.Operator):
tool.Snap.insert_polyline_point(self.input_panel)
tool.Blender.update_viewport()
if event.value == "PRESS" and event.type == "X":
tool.Snap.set_snap_axis_method("X")
tool.Blender.update_viewport()
if event.value == "PRESS" and event.type == "Y":
tool.Snap.set_snap_axis_method("Y")
tool.Blender.update_viewport()
if event.value == "PRESS" and event.type == "Z":
tool.Snap.set_snap_axis_method("Z")
tool.Blender.update_viewport()
if event.value == "PRESS" and event.type == "C":
tool.Snap.close_polyline()
PolylineDecorator.set_input_panel(self.input_panel, self.input_type)
@@ -2500,7 +2512,7 @@ class MeasureTool(bpy.types.Operator):
PolylineDecorator.install(context)
tool.Snap.set_use_default_container(False)
PolylineDecorator.set_use_default_container(False)
tool.Snap.set_snap_plane_method("No Plane")
tool.Snap.set_snap_plane_method(None)
PolylineDecorator.set_input_panel(self.input_panel, self.input_type)
self.visible_objs = tool.Raycast.get_visible_objects(context)
for obj in self.visible_objs: