mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-10 17:58:20 +00:00
Fixed decorator for mixed snaping
This commit is contained in:
committed by
Bruno Perdigão
parent
95fc51da76
commit
2f4093f958
@@ -477,15 +477,24 @@ class WallPolylineDecorator:
|
||||
gpu.state.point_size_set(10)
|
||||
|
||||
snap_prop = context.scene.BIMModelProperties.snap_mouse_point[0]
|
||||
default_container_elevation = tool.Ifc.get_object(tool.Root.get_default_container()).location.z
|
||||
|
||||
# Point related to the mouse
|
||||
mouse_point = [Vector((snap_prop.x, snap_prop.y, snap_prop.z))]
|
||||
|
||||
try:
|
||||
snap_ref = context.scene.BIMModelProperties.snap_mouse_ref[0]
|
||||
ref_point = [Vector((snap_ref.x, snap_ref.y, snap_ref.z))]
|
||||
except:
|
||||
ref_point = None
|
||||
|
||||
if snap_prop.snap_type in ["Face", "Plane"]:
|
||||
self.draw_batch("POINTS", mouse_point, decorator_color_unselected)
|
||||
else:
|
||||
self.draw_batch("POINTS", mouse_point, (1.0, 0.6, 0.0, 1.0))
|
||||
|
||||
if ref_point:
|
||||
self.draw_batch("POINTS", ref_point, (1.0, 0.6, 0.0, 1.0))
|
||||
|
||||
default_container_elevation = tool.Ifc.get_object(tool.Root.get_default_container()).location.z
|
||||
projection_point = []
|
||||
if self.use_default_container:
|
||||
# When a point is above the plane it projects the point
|
||||
|
||||
@@ -204,6 +204,7 @@ class BIMModelProperties(PropertyGroup):
|
||||
type_name: bpy.props.StringProperty(name="Name", default="TYPEX")
|
||||
boundary_class: bpy.props.EnumProperty(items=get_boundary_class, name="Boundary Class")
|
||||
snap_mouse_point: bpy.props.CollectionProperty(type=SnapMousePoint)
|
||||
snap_mouse_ref: bpy.props.CollectionProperty(type=SnapMousePoint)
|
||||
polyline_point: bpy.props.CollectionProperty(type=PolylinePoint)
|
||||
|
||||
|
||||
|
||||
@@ -528,6 +528,7 @@ class DrawPolylineWall(bpy.types.Operator):
|
||||
self.is_input_on = False
|
||||
self.input_type = "OFF"
|
||||
WallPolylineDecorator.set_input_panel(self.input_panel, self.input_type)
|
||||
tool.Snap.clear_snaping_ref()
|
||||
tool.Blender.update_viewport()
|
||||
else:
|
||||
self.mousemove_count = 0
|
||||
|
||||
@@ -104,6 +104,22 @@ class Snap(bonsai.core.tool.Snap):
|
||||
snap_vertex.z = snap_point[2]
|
||||
snap_vertex.snap_type = snap_type
|
||||
|
||||
@classmethod
|
||||
def update_snaping_ref(cls, snap_point, snap_type):
|
||||
try:
|
||||
snap_vertex = bpy.context.scene.BIMModelProperties.snap_mouse_ref[0]
|
||||
except:
|
||||
snap_vertex = bpy.context.scene.BIMModelProperties.snap_mouse_ref.add()
|
||||
|
||||
snap_vertex.x = snap_point[0]
|
||||
snap_vertex.y = snap_point[1]
|
||||
snap_vertex.z = snap_point[2]
|
||||
snap_vertex.snap_type = snap_type
|
||||
|
||||
@classmethod
|
||||
def clear_snaping_ref(cls):
|
||||
bpy.context.scene.BIMModelProperties.snap_mouse_ref.clear()
|
||||
|
||||
@classmethod
|
||||
def insert_polyline_point(cls, x=None, y=None, z=None):
|
||||
snap_vertex = bpy.context.scene.BIMModelProperties.snap_mouse_point[0]
|
||||
@@ -227,7 +243,7 @@ class Snap(bonsai.core.tool.Snap):
|
||||
else:
|
||||
best_result = result_2
|
||||
|
||||
return best_result, "Axis"
|
||||
return best_result, "Mix"
|
||||
|
||||
# except Exception as e:
|
||||
# cls.update_snaping_point(snap_point[0], snap_point[1])
|
||||
@@ -334,6 +350,7 @@ class Snap(bonsai.core.tool.Snap):
|
||||
if event.shift:
|
||||
snap_result, snap_type = cls.mix_snap_and_axis(snap_point, axis_start, axis_end, elevation)
|
||||
cls.update_snaping_point(snap_result, snap_type)
|
||||
cls.update_snaping_ref(snap_point[0], snap_point[1])
|
||||
else:
|
||||
cls.update_snaping_point(snap_point[0], snap_point[1])
|
||||
elif rot_intersection:
|
||||
|
||||
Reference in New Issue
Block a user