From 2afb087b7a786700f4e4d2156627e405ff7bdbc2 Mon Sep 17 00:00:00 2001 From: Emmanouil Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Sat, 1 Jun 2024 12:59:22 +0300 Subject: [PATCH] When switching projects and the curve tool is active, clear it Instead of applying it. This also fixes a crash when the curve tool is active and the current project closes --- src/Tools/DesignTools/CurveTool.gd | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Tools/DesignTools/CurveTool.gd b/src/Tools/DesignTools/CurveTool.gd index 231e20079..7e76adade 100644 --- a/src/Tools/DesignTools/CurveTool.gd +++ b/src/Tools/DesignTools/CurveTool.gd @@ -10,7 +10,7 @@ var _last_mouse_position := Vector2.INF ## The last position of the mouse func _init() -> void: - Global.project_about_to_switch.connect(_draw_shape) # To prevent tool from remaining active + Global.project_about_to_switch.connect(_clear) # To prevent tool from remaining active _drawer.color_op = Drawer.ColorOp.new() update_indicator() @@ -174,10 +174,14 @@ func _draw_shape() -> void: v.y = y if Geometry2D.is_point_in_polygon(v, points): draw_tool(v) + _clear() + commit_undo() + + +func _clear() -> void: _curve.clear_points() _drawing = false _editing_out_control_point = false - commit_undo() ## Get the [member _curve]'s baked points, and draw lines between them using [method _fill_gap].