From d73d3981552855b2fcbc7408ce5e64ba43f28cc4 Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 15 Jun 2022 18:52:55 +0200 Subject: [PATCH] Connect PolygonControlpoint's gui input method. --- .../editor/widgets/polygon_edit/polygon_control_point.cpp | 3 +++ .../editor/widgets/polygon_edit/polygon_editor.cpp | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/modules/material_maker/editor/widgets/polygon_edit/polygon_control_point.cpp b/modules/material_maker/editor/widgets/polygon_edit/polygon_control_point.cpp index c0715b046..3d230c6d5 100644 --- a/modules/material_maker/editor/widgets/polygon_edit/polygon_control_point.cpp +++ b/modules/material_maker/editor/widgets/polygon_edit/polygon_control_point.cpp @@ -57,6 +57,9 @@ PolygonControlPoint::~PolygonControlPoint() { void PolygonControlPoint::_notification(int p_what) { switch (p_what) { + case NOTIFICATION_POSTINITIALIZE: { + connect("gui_input", this, "_on_ControlPoint_gui_input"); + } break; case NOTIFICATION_DRAW: { _draw(); } break; diff --git a/modules/material_maker/editor/widgets/polygon_edit/polygon_editor.cpp b/modules/material_maker/editor/widgets/polygon_edit/polygon_editor.cpp index 92f793394..ba1bfe164 100644 --- a/modules/material_maker/editor/widgets/polygon_edit/polygon_editor.cpp +++ b/modules/material_maker/editor/widgets/polygon_edit/polygon_editor.cpp @@ -42,9 +42,7 @@ void PolygonEditor::_on_ControlPoint_moved(const int index) { PolygonControlPoint *control_point = Object::cast_to(get_child(index)); PoolVector2Array points = polygon->get_points(); - points.set(index, reverse_transform_point(control_point->get_position() + control_point->OFFSET)); - polygon->set_points(points); update();