Skip to content

Commit 5721a8b

Browse files
committed
Snap: improve performance of wireframe objects intersection.
Enhances the performance of mouse intersection checks for wireframe objects. Details: - Calculated the intersection with the mouse in 2D pixels first. - Converted objects to a BVH Tree to reduce the number of edges checked against the mouse position.
1 parent f820214 commit 5721a8b

3 files changed

Lines changed: 414 additions & 15 deletions

File tree

src/bonsai/bonsai/bim/module/model/polyline.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def handle_mouse_move(
421421
tool.Polyline.calculate_x_y_and_z(context, self.input_ui, self.tool_state)
422422

423423
tool.Blender.update_viewport()
424-
return {"RUNNING_MODAL"}
424+
return {"RUNNING_MODAL"}
425425

426426
def set_offset(self, context: bpy.types.Context, relating_type: ifcopenshell.entity_instance) -> None:
427427
props = tool.Model.get_model_props()
@@ -461,6 +461,7 @@ def invoke(self, context: bpy.types.Context, event: bpy.types.Event) -> None:
461461
self.tool_state.axis_method = None
462462
self.tool_state.plane_method = None
463463
self.tool_state.mode = "Mouse"
464+
tool.Raycast.clear_snap_objs()
464465
self.visible_objs = tool.Raycast.get_visible_objects(context)
465466
for obj in self.visible_objs:
466467
if bbox_2d := tool.Raycast.get_on_screen_2d_bounding_boxes(context, obj):

0 commit comments

Comments
 (0)