mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-30 20:19:59 +00:00
Fix small issue with snap axis when using measure tool with different planes
This commit is contained in:
@@ -124,20 +124,20 @@ class PolylineOperator:
|
|||||||
|
|
||||||
def choose_axis(self, event, x=True, y=True, z=False):
|
def choose_axis(self, event, x=True, y=True, z=False):
|
||||||
if x:
|
if x:
|
||||||
if event.value == "PRESS" and event.type == "X":
|
if not event.shift and event.value == "PRESS" and event.type == "X":
|
||||||
self.tool_state.axis_method = "X" if self.tool_state.axis_method != event.type else None
|
self.tool_state.axis_method = "X" if self.tool_state.axis_method != event.type else None
|
||||||
self.tool_state.lock_axis = False if self.tool_state.lock_axis else True
|
self.tool_state.lock_axis = False if self.tool_state.lock_axis else True
|
||||||
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
|
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
|
||||||
tool.Blender.update_viewport()
|
tool.Blender.update_viewport()
|
||||||
|
|
||||||
if y:
|
if y:
|
||||||
if event.value == "PRESS" and event.type == "Y":
|
if not event.shift and event.value == "PRESS" and event.type == "Y":
|
||||||
self.tool_state.axis_method = "Y" if self.tool_state.axis_method != event.type else None
|
self.tool_state.axis_method = "Y" if self.tool_state.axis_method != event.type else None
|
||||||
self.tool_state.lock_axis = False if self.tool_state.lock_axis else True
|
self.tool_state.lock_axis = False if self.tool_state.lock_axis else True
|
||||||
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
|
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
|
||||||
tool.Blender.update_viewport()
|
tool.Blender.update_viewport()
|
||||||
if z:
|
if z:
|
||||||
if event.value == "PRESS" and event.type == "Z":
|
if not event.shift and event.value == "PRESS" and event.type == "Z":
|
||||||
self.tool_state.axis_method = "Z" if self.tool_state.axis_method != event.type else None
|
self.tool_state.axis_method = "Z" if self.tool_state.axis_method != event.type else None
|
||||||
self.tool_state.lock_axis = False if self.tool_state.lock_axis else True
|
self.tool_state.lock_axis = False if self.tool_state.lock_axis else True
|
||||||
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
|
PolylineDecorator.update(event, self.tool_state, self.input_ui, self.snapping_points[0])
|
||||||
|
|||||||
@@ -336,7 +336,6 @@ class DrawPolylineWall(bpy.types.Operator, PolylineOperator):
|
|||||||
|
|
||||||
self.choose_axis(event)
|
self.choose_axis(event)
|
||||||
|
|
||||||
|
|
||||||
self.handle_snap_selection(context, event)
|
self.handle_snap_selection(context, event)
|
||||||
|
|
||||||
if (
|
if (
|
||||||
|
|||||||
@@ -2394,7 +2394,7 @@ class MeasureTool(bpy.types.Operator, PolylineOperator):
|
|||||||
BACKSPACE: Remove Point
|
BACKSPACE: Remove Point
|
||||||
X, Y, Z: Choose Axis
|
X, Y, Z: Choose Axis
|
||||||
S-X, S-Y, S-Z: Choose Plane
|
S-X, S-Y, S-Z: Choose Plane
|
||||||
SHIFT: Lock axis
|
L: Lock axis
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def modal(self, context, event):
|
def modal(self, context, event):
|
||||||
@@ -2413,7 +2413,6 @@ class MeasureTool(bpy.types.Operator, PolylineOperator):
|
|||||||
|
|
||||||
self.choose_axis(event, z=True)
|
self.choose_axis(event, z=True)
|
||||||
|
|
||||||
|
|
||||||
self.choose_plane(event)
|
self.choose_plane(event)
|
||||||
|
|
||||||
self.handle_snap_selection(context, event)
|
self.handle_snap_selection(context, event)
|
||||||
|
|||||||
@@ -185,7 +185,10 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
|
|
||||||
# Get axis that are closer than the stick factor threshold
|
# Get axis that are closer than the stick factor threshold
|
||||||
elegible_axis = []
|
elegible_axis = []
|
||||||
|
|
||||||
for axis in snap_axis:
|
for axis in snap_axis:
|
||||||
|
if not axis:
|
||||||
|
continue
|
||||||
rot_mat = Matrix.Rotation(math.radians(360 - axis), 3, pivot_axis)
|
rot_mat = Matrix.Rotation(math.radians(360 - axis), 3, pivot_axis)
|
||||||
rot_intersection = rot_mat @ translated_intersection
|
rot_intersection = rot_mat @ translated_intersection
|
||||||
proximity = rot_intersection.y
|
proximity = rot_intersection.y
|
||||||
@@ -200,7 +203,8 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
# Get the elegible axis with the lowest proximity
|
# Get the elegible axis with the lowest proximity
|
||||||
if elegible_axis:
|
if elegible_axis:
|
||||||
proximity, axis = sorted(elegible_axis)[0]
|
proximity, axis = sorted(elegible_axis)[0]
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
# If lock axis is on it will use the snap angle so there is no need to search for elegible axis
|
# If lock axis is on it will use the snap angle so there is no need to search for elegible axis
|
||||||
if elegible_axis or tool_state.lock_axis:
|
if elegible_axis or tool_state.lock_axis:
|
||||||
|
|||||||
Reference in New Issue
Block a user