Raycast now filters objects that are not in the active local view.

This commit is contained in:
Bruno Perdigão
2024-08-27 18:18:30 -03:00
parent 89d27bdf5f
commit 0faacccf6d
+6 -1
View File
@@ -294,6 +294,7 @@ class Snap(bonsai.core.tool.Snap):
def detect_snapping_points(cls, context, event, objs_2d_bbox):
region = context.region
rv3d = context.region_data
space = context.space_data
cls.mouse_pos = event.mouse_region_x, event.mouse_region_y
detected_snaps = []
@@ -382,7 +383,11 @@ class Snap(bonsai.core.tool.Snap):
for obj, bbox_2d in objs_2d_bbox:
if obj.type == "MESH" and bbox_2d:
if tool.Raycast.in_view_2d_bounding_box(cls.mouse_pos, bbox_2d):
objs_to_raycast.append(obj)
if space.local_view:
if obj.local_view_get(context.space_data):
objs_to_raycast.append(obj)
else:
objs_to_raycast.append(obj)
# Obj
snap_obj, hit, face_index = cast_rays_and_get_best_object(objs_to_raycast)
if hit is not None: