mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-24 20:00:02 +00:00
Snap - filter visible objects before creating the 2d bouding box
This commit is contained in:
@@ -52,7 +52,14 @@ class Raycast(bonsai.core.tool.Raycast):
|
|||||||
else: # Usual object
|
else: # Usual object
|
||||||
obj = dup.object
|
obj = dup.object
|
||||||
all_objs.append(obj)
|
all_objs.append(obj)
|
||||||
return all_objs
|
|
||||||
|
visible_objs = []
|
||||||
|
for obj in all_objs:
|
||||||
|
if obj.type in {"MESH", "EMPTY", "CURVE"} and (
|
||||||
|
obj.visible_in_viewport_get(bpy.context.space_data) or obj.library
|
||||||
|
): # Check for local view and local collections for this viewport and object
|
||||||
|
visible_objs.append(obj)
|
||||||
|
return visible_objs
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_on_screen_2d_bounding_boxes(cls, context: bpy.types.Context, obj: bpy.types.Object):
|
def get_on_screen_2d_bounding_boxes(cls, context: bpy.types.Context, obj: bpy.types.Object):
|
||||||
@@ -386,12 +393,9 @@ class Raycast(bonsai.core.tool.Raycast):
|
|||||||
mouse_pos = event.mouse_region_x, event.mouse_region_y
|
mouse_pos = event.mouse_region_x, event.mouse_region_y
|
||||||
objs_to_raycast = []
|
objs_to_raycast = []
|
||||||
for obj, bbox_2d in objs_2d_bbox:
|
for obj, bbox_2d in objs_2d_bbox:
|
||||||
if obj.type in {"MESH", "EMPTY", "CURVE"} and bbox_2d:
|
if bbox_2d:
|
||||||
if tool.Raycast.intersect_mouse_2d_bounding_box(mouse_pos, bbox_2d):
|
if tool.Raycast.intersect_mouse_2d_bounding_box(mouse_pos, bbox_2d):
|
||||||
if (
|
objs_to_raycast.append(obj)
|
||||||
obj.visible_in_viewport_get(bpy.context.space_data) or obj.library
|
|
||||||
): # Check for local view and local collections for this viewport and object
|
|
||||||
objs_to_raycast.append(obj)
|
|
||||||
return objs_to_raycast
|
return objs_to_raycast
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user