From bb7fee062ce160de709d1dd4c98c560daf56550e Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 20 Oct 2021 18:06:02 +0200 Subject: [PATCH] Make sure that polygon's changed method is called even when the control points were only moved. --- game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_polygon.gd | 3 +++ .../addons/mat_maker_gd/widgets/polygon_edit/polygon_dialog.gd | 3 ++- .../addons/mat_maker_gd/widgets/polygon_edit/polygon_editor.gd | 1 + 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_polygon.gd b/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_polygon.gd index daecf362..24049069 100644 --- a/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_polygon.gd +++ b/game/addons/mat_maker_gd/nodes/sdf2d/sd_shape_polygon.gd @@ -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() diff --git a/game/addons/mat_maker_gd/widgets/polygon_edit/polygon_dialog.gd b/game/addons/mat_maker_gd/widgets/polygon_edit/polygon_dialog.gd index be0a9fda..da96c7a5 100644 --- a/game/addons/mat_maker_gd/widgets/polygon_edit/polygon_dialog.gd +++ b/game/addons/mat_maker_gd/widgets/polygon_edit/polygon_dialog.gd @@ -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): diff --git a/game/addons/mat_maker_gd/widgets/polygon_edit/polygon_editor.gd b/game/addons/mat_maker_gd/widgets/polygon_edit/polygon_editor.gd index f9a31c98..90c9d017 100644 --- a/game/addons/mat_maker_gd/widgets/polygon_edit/polygon_editor.gd +++ b/game/addons/mat_maker_gd/widgets/polygon_edit/polygon_editor.gd @@ -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)