Only Call Curve Changed Signal After Mouse Release

Godot Version

Godot 4.3

Question

Hey, I’m working on procedural mesh generation. One of the values I’m using is a Curve property:

@export var width : Curve

I’d like to update the mesh in the editor when I adjust the curve, I already tried this:

func _enter_tree():
	width.changed.connect(generate_mesh)

However this doesn’t work well, this calls the generate_mesh function every single frame you edit the curve.
It generates the mesh when the curve is slightly changed and stops the mouse input to change the curve further. (plus it’s too expensive)

I’d like to update the mesh after I release the mouse button when I edit the curve. How could I best approach this?

Solved!
I connected a function that just sets a local variable to true

func curve_update(): curves_changed = true

I then check in _process everytime the mouse button is not pressed anymore:

func _process(delta: float) -> void:
	if !Input.is_mouse_button_pressed(MOUSE_BUTTON_LEFT) && curves_changed: # only update curves once the left mouse button is released
		generate_mesh()
		curves_changed = false