Make sure that polygon's changed method is called even when the control points were only moved.

This commit is contained in:
Relintai 2021-10-20 18:06:02 +02:00
parent 17d0dc99dd
commit bb7fee062c
3 changed files with 6 additions and 1 deletions

View File

@ -24,6 +24,9 @@ func _register_methods(mm_graph_node) -> void:
func get_property_value(uv : Vector2) -> float:
return SDF2D.sdPolygon(uv, points)
func polygon_changed() -> void:
_polygon_changed()
func _polygon_changed() -> void:
emit_changed()
output.emit_changed()

View File

@ -19,13 +19,14 @@ func _on_CurveDialog_popup_hide():
func _on_OK_pressed():
emit_signal("polygon_changed", polygon)
polygon.polygon_changed()
queue_free()
func _on_Cancel_pressed():
polygon.set_points(previous_points)
emit_signal("polygon_changed", polygon)
queue_free()
func edit_polygon(poly):

View File

@ -32,6 +32,7 @@ func update_controls() -> void:
func _on_ControlPoint_moved(index):
var control_point = get_child(index)
polygon.points[index] = reverse_transform_point(control_point.rect_position+control_point.OFFSET)
update()
emit_signal("value_changed", polygon)