Polytool: added on screen snap information.

This commit is contained in:
Bruno Perdigão
2024-08-26 17:09:49 -03:00
parent 48b74ebb76
commit 32ae12b45a
2 changed files with 16 additions and 0 deletions
@@ -308,6 +308,7 @@ class PolylineDecorator:
angle_snap_loc = None
use_default_container = False
instructions = None
snap_info = None
@classmethod
def install(cls, context):
@@ -360,6 +361,10 @@ class PolylineDecorator:
def set_instructions(cls, instructions):
cls.instructions = instructions
@classmethod
def set_snap_info(cls, snap_info):
cls.snap_info = snap_info
@classmethod
def calculate_distance_and_angle(cls, context, is_input_on):
@@ -614,6 +619,11 @@ class PolylineDecorator:
blf.position(self.font_id, position, 10, 0)
blf.draw(self.font_id, self.instructions)
text_w, text_h = blf.dimensions(0, self.snap_info)
position = (region.width / 2) - (text_w / 2)
blf.position(self.font_id, position, 30, 0)
blf.draw(self.font_id, self.snap_info)
def __call__(self, context):
+6
View File
@@ -106,6 +106,11 @@ class Snap(bonsai.core.tool.Snap):
except:
snap_vertex = bpy.context.scene.BIMModelProperties.snap_mouse_point.add()
info = f"""Snap: {snap_type}
Axis:{cls.snap_axis_method}
Plane:{cls.snap_plane_method}
"""
PolylineDecorator.set_snap_info(info)
snap_vertex.x = snap_point[0]
snap_vertex.y = snap_point[1]
snap_vertex.z = snap_point[2]
@@ -456,6 +461,7 @@ class Snap(bonsai.core.tool.Snap):
detected_snaps.append({"Plane": intersection})
return detected_snaps
@classmethod