mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-08-11 02:02:22 +00:00
Fix to allow calculations to work when no point was added yet
This commit is contained in:
committed by
Bruno Perdigão
parent
d995e010cf
commit
8284ed0cdb
@@ -335,12 +335,16 @@ class WallPolylineDecorator:
|
||||
def calculate_distance_and_angle(cls, context, is_input_on):
|
||||
try:
|
||||
polyline_data = context.scene.BIMModelProperties.polyline_point
|
||||
snap_prop = context.scene.BIMModelProperties.snap_mouse_point[0]
|
||||
last_point_data = polyline_data[len(polyline_data) - 1]
|
||||
except:
|
||||
return
|
||||
last_point_data = None
|
||||
|
||||
last_point = Vector((last_point_data.x, last_point_data.y, last_point_data.z))
|
||||
snap_prop = context.scene.BIMModelProperties.snap_mouse_point[0]
|
||||
|
||||
if last_point_data:
|
||||
last_point = Vector((last_point_data.x, last_point_data.y, last_point_data.z))
|
||||
else:
|
||||
last_point = Vector((0, 0, 0,))
|
||||
|
||||
if is_input_on:
|
||||
snap_vector = Vector((float(cls.input_panel['X']), float(cls.input_panel['Y']), 0))
|
||||
|
||||
@@ -540,8 +540,6 @@ class DrawPolylineWall(bpy.types.Operator):
|
||||
if event.type == 'MOUSEMOVE':
|
||||
self.mousemove_count += 1
|
||||
tool.Blender.update_viewport()
|
||||
WallPolylineDecorator.set_mouse_position(context, event)
|
||||
self.input_panel = WallPolylineDecorator.calculate_distance_and_angle(context, self.is_input_on)
|
||||
self.is_input_on = False
|
||||
else:
|
||||
self.mousemove_count = 0
|
||||
@@ -553,6 +551,8 @@ class DrawPolylineWall(bpy.types.Operator):
|
||||
|
||||
if self.mousemove_count > 3:
|
||||
self.snaping_movement(context, event)
|
||||
WallPolylineDecorator.set_mouse_position(context, event)
|
||||
self.input_panel = WallPolylineDecorator.calculate_distance_and_angle(context, self.is_input_on)
|
||||
return {'RUNNING_MODAL'}
|
||||
|
||||
if event.value == 'RELEASE' and event.type == 'LEFTMOUSE':
|
||||
|
||||
Reference in New Issue
Block a user