Polyline and Measure tool now use right-click to confirm input

This commit is contained in:
Bruno Perdigão
2024-08-21 23:01:06 -03:00
parent e8a7a032aa
commit 5575ea8296
2 changed files with 7 additions and 7 deletions
+4 -4
View File
@@ -439,14 +439,14 @@ class DrawPolylineWall(bpy.types.Operator):
PolylineDecorator.set_input_panel(self.input_panel, self.input_type) PolylineDecorator.set_input_panel(self.input_panel, self.input_type)
tool.Blender.update_viewport() tool.Blender.update_viewport()
if not self.is_input_on and event.value == "RELEASE" and event.type in {"RET", "NUMPAD_ENTER"}: if not self.is_input_on and event.value == "RELEASE" and event.type in {"RET", "NUMPAD_ENTER", "RIGHTMOUSE"}:
self.create_walls_from_polyline(context) self.create_walls_from_polyline(context)
PolylineDecorator.uninstall() PolylineDecorator.uninstall()
tool.Snap.clear_polyline() tool.Snap.clear_polyline()
tool.Blender.update_viewport() tool.Blender.update_viewport()
return {"FINISHED"} return {"FINISHED"}
if self.is_input_on and event.value == "RELEASE" and event.type in {"RET", "NUMPAD_ENTER"}: if self.is_input_on and event.value == "RELEASE" and event.type in {"RET", "NUMPAD_ENTER", "RIGHTMOUSE"}:
self.recalculate_inputs(context) self.recalculate_inputs(context)
tool.Snap.insert_polyline_point(float(self.input_panel["X"]), float(self.input_panel["Y"])) tool.Snap.insert_polyline_point(float(self.input_panel["X"]), float(self.input_panel["Y"]))
self.is_input_on = False self.is_input_on = False
@@ -460,13 +460,13 @@ class DrawPolylineWall(bpy.types.Operator):
return {"PASS_THROUGH"} return {"PASS_THROUGH"}
if self.is_input_on: if self.is_input_on:
if event.value == "RELEASE" and event.type in {"RIGHTMOUSE", "ESC"}: if event.value == "RELEASE" and event.type in {"ESC"}:
self.is_input_on = False self.is_input_on = False
self.input_type = "OFF" self.input_type = "OFF"
PolylineDecorator.set_input_panel(self.input_panel, self.input_type) PolylineDecorator.set_input_panel(self.input_panel, self.input_type)
tool.Blender.update_viewport() tool.Blender.update_viewport()
else: else:
if event.value == "RELEASE" and event.type in {"RIGHTMOUSE", "ESC"}: if event.value == "RELEASE" and event.type in {"ESC"}:
PolylineDecorator.uninstall() PolylineDecorator.uninstall()
tool.Snap.clear_polyline() tool.Snap.clear_polyline()
tool.Blender.update_viewport() tool.Blender.update_viewport()
@@ -2424,7 +2424,7 @@ class MeasureTool(bpy.types.Operator):
PolylineDecorator.set_input_panel(self.input_panel, self.input_type) PolylineDecorator.set_input_panel(self.input_panel, self.input_type)
tool.Blender.update_viewport() tool.Blender.update_viewport()
if self.is_input_on and event.value == "RELEASE" and event.type in {"RET", "NUMPAD_ENTER"}: if self.is_input_on and event.value == "RELEASE" and event.type in {"RET", "NUMPAD_ENTER", "RIGHTMOUSE"}:
self.recalculate_inputs(context) self.recalculate_inputs(context)
tool.Snap.insert_polyline_point( tool.Snap.insert_polyline_point(
float(self.input_panel["X"]), float(self.input_panel["Y"]), float(self.input_panel["Z"]) float(self.input_panel["X"]), float(self.input_panel["Y"]), float(self.input_panel["Z"])
@@ -2455,13 +2455,13 @@ class MeasureTool(bpy.types.Operator):
return {"PASS_THROUGH"} return {"PASS_THROUGH"}
if self.is_input_on: if self.is_input_on:
if event.value == "RELEASE" and event.type in {"RIGHTMOUSE", "ESC"}: if event.value == "RELEASE" and event.type in {"ESC"}:
self.is_input_on = False self.is_input_on = False
self.input_type = "OFF" self.input_type = "OFF"
PolylineDecorator.set_input_panel(self.input_panel, self.input_type) PolylineDecorator.set_input_panel(self.input_panel, self.input_type)
tool.Blender.update_viewport() tool.Blender.update_viewport()
else: else:
if event.value == "RELEASE" and event.type in {"RIGHTMOUSE", "ESC"}: if event.value == "RELEASE" and event.type in {"ESC"}:
PolylineDecorator.uninstall() PolylineDecorator.uninstall()
tool.Snap.clear_polyline() tool.Snap.clear_polyline()
tool.Blender.update_viewport() tool.Blender.update_viewport()