mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-25 17:57:02 +00:00
Added support to snap on empty objects.
This commit is contained in:
@@ -331,6 +331,8 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
best_face_index = None
|
best_face_index = None
|
||||||
|
|
||||||
for obj in objs_to_raycast:
|
for obj in objs_to_raycast:
|
||||||
|
if obj.type != "MESH":
|
||||||
|
continue
|
||||||
hit, normal, face_index = tool.Raycast.obj_ray_cast(context, event, obj)
|
hit, normal, face_index = tool.Raycast.obj_ray_cast(context, event, obj)
|
||||||
if hit is None:
|
if hit is None:
|
||||||
# Tried original mouse position. Now it will try the offsets.
|
# Tried original mouse position. Now it will try the offsets.
|
||||||
@@ -361,7 +363,7 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
|
|
||||||
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 == "MESH" and bbox_2d:
|
if obj.type in {"MESH", "EMPTY"} and bbox_2d:
|
||||||
if tool.Raycast.intersect_mouse_2d_bounding_box(mouse_pos, bbox_2d, offset):
|
if tool.Raycast.intersect_mouse_2d_bounding_box(mouse_pos, bbox_2d, offset):
|
||||||
if space.local_view:
|
if space.local_view:
|
||||||
if obj.local_view_get(context.space_data):
|
if obj.local_view_get(context.space_data):
|
||||||
@@ -375,12 +377,16 @@ class Snap(bonsai.core.tool.Snap):
|
|||||||
|
|
||||||
# Edge-Vertex
|
# Edge-Vertex
|
||||||
for obj in objs_to_raycast:
|
for obj in objs_to_raycast:
|
||||||
if len(obj.data.polygons) == 0:
|
if obj.type == "MESH":
|
||||||
options = tool.Raycast.ray_cast_by_proximity(context, event, obj)
|
if len(obj.data.polygons) == 0:
|
||||||
snap_obj = obj
|
options = tool.Raycast.ray_cast_by_proximity(context, event, obj)
|
||||||
if options:
|
snap_obj = obj
|
||||||
detected_snaps.append({"Edge-Vertex": (snap_obj, options)})
|
if options:
|
||||||
break
|
detected_snaps.append({"Edge-Vertex": (snap_obj, options)})
|
||||||
|
break
|
||||||
|
if obj.type == "EMPTY":
|
||||||
|
snap_point = [(obj.location, "Vertex")]
|
||||||
|
detected_snaps.append({"Edge-Vertex": (obj, snap_point)})
|
||||||
# Polyline
|
# Polyline
|
||||||
try:
|
try:
|
||||||
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
polyline_data = bpy.context.scene.BIMPolylineProperties.polyline_point
|
||||||
|
|||||||
Reference in New Issue
Block a user