From ee9144b1b5130398f35b36ab15c2aaa204de084d Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 15 Jun 2022 18:03:35 +0200 Subject: [PATCH] PolygonEdit should have inherited from Button, and connected the pressed signal. --- .../editor/widgets/polygon_edit/polygon_edit.cpp | 6 ++++++ .../editor/widgets/polygon_edit/polygon_edit.h | 8 +++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/modules/material_maker/editor/widgets/polygon_edit/polygon_edit.cpp b/modules/material_maker/editor/widgets/polygon_edit/polygon_edit.cpp index 93db9ed6a..9a60adbcb 100644 --- a/modules/material_maker/editor/widgets/polygon_edit/polygon_edit.cpp +++ b/modules/material_maker/editor/widgets/polygon_edit/polygon_edit.cpp @@ -55,6 +55,12 @@ PolygonEdit::PolygonEdit() { PolygonEdit::~PolygonEdit() { } +void PolygonEdit::_notification(int p_what) { + if (p_what == NOTIFICATION_POSTINITIALIZE) { + connect("pressed", this, "_on_PolygonEdit_pressed"); + } +} + void PolygonEdit::_bind_methods() { ADD_SIGNAL(MethodInfo("updated", PropertyInfo(Variant::OBJECT, "polygon", PROPERTY_HINT_RESOURCE_TYPE, "PolygonBase"))); diff --git a/modules/material_maker/editor/widgets/polygon_edit/polygon_edit.h b/modules/material_maker/editor/widgets/polygon_edit/polygon_edit.h index 1bc63526b..f4e573f65 100644 --- a/modules/material_maker/editor/widgets/polygon_edit/polygon_edit.h +++ b/modules/material_maker/editor/widgets/polygon_edit/polygon_edit.h @@ -3,13 +3,13 @@ #include "core/reference.h" -#include "scene/gui/control.h" +#include "scene/gui/button.h" class PolygonBase; class PolygonView; -class PolygonEdit : public Control { - GDCLASS(PolygonEdit, Control); +class PolygonEdit : public Button { + GDCLASS(PolygonEdit, Button); public: bool get_closed() const; @@ -25,6 +25,8 @@ public: ~PolygonEdit(); protected: + void _notification(int p_what); + static void _bind_methods(); bool closed;