From cd3366f6c4dab03a65e7db146beb662ffc12eaba Mon Sep 17 00:00:00 2001 From: Relintai Date: Wed, 13 Apr 2022 18:03:48 +0200 Subject: [PATCH] Implement the uv editor popup. --- .../uv_editor/mdr_uv_rect_editor_popup.cpp | 29 ++++++++++--------- .../uv_editor/mdr_uv_rect_editor_popup.h | 7 ++++- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/modules/mesh_data_resource/editor/uv_editor/mdr_uv_rect_editor_popup.cpp b/modules/mesh_data_resource/editor/uv_editor/mdr_uv_rect_editor_popup.cpp index 67368a224..9601e0be0 100644 --- a/modules/mesh_data_resource/editor/uv_editor/mdr_uv_rect_editor_popup.cpp +++ b/modules/mesh_data_resource/editor/uv_editor/mdr_uv_rect_editor_popup.cpp @@ -22,30 +22,31 @@ SOFTWARE. #include "mdr_uv_rect_editor_popup.h" +#include "mdr_uv_rect_editor.h" +#include "scene/gui/button.h" + void MDRUVRectEditorPopup::on_ok_pressed() { - //$UVEditor.ok_pressed() + _editor->ok_pressed(); } void MDRUVRectEditorPopup::on_cancel_pressed() { - //$UVEditor.cancel_pressed() -} - -void MDRUVRectEditorPopup::_notification(int p_what) { - /* - func _enter_tree(): - if !is_connected("confirmed", self, "on_ok_pressed"): - connect("confirmed", self, "on_ok_pressed") - - if !get_cancel().is_connected("pressed", self, "on_cancel_pressed"): - get_cancel().connect("pressed", self, "on_cancel_pressed") - - */ + _editor->cancel_pressed(); } MDRUVRectEditorPopup::MDRUVRectEditorPopup() { + _editor = memnew(MDRUVRectEditor); + + add_child(_editor); + + connect("confirmed", this, "on_ok_pressed"); + get_cancel()->connect("pressed", this, "on_cancel_pressed"); + + set_size(Vector2(700, 500)); } MDRUVRectEditorPopup::~MDRUVRectEditorPopup() { } void MDRUVRectEditorPopup::_bind_methods() { + ClassDB::bind_method(D_METHOD("on_ok_pressed"), &MDRUVRectEditorPopup::on_ok_pressed); + ClassDB::bind_method(D_METHOD("on_cancel_pressed"), &MDRUVRectEditorPopup::on_cancel_pressed); } diff --git a/modules/mesh_data_resource/editor/uv_editor/mdr_uv_rect_editor_popup.h b/modules/mesh_data_resource/editor/uv_editor/mdr_uv_rect_editor_popup.h index 49fe4007b..61ef74998 100644 --- a/modules/mesh_data_resource/editor/uv_editor/mdr_uv_rect_editor_popup.h +++ b/modules/mesh_data_resource/editor/uv_editor/mdr_uv_rect_editor_popup.h @@ -25,6 +25,8 @@ SOFTWARE. #include "scene/gui/dialogs.h" +class MDRUVRectEditor; + class MDRUVRectEditorPopup : public ConfirmationDialog { GDCLASS(MDRUVRectEditorPopup, ConfirmationDialog); @@ -32,12 +34,15 @@ public: void on_ok_pressed(); void on_cancel_pressed(); + MDRUVRectEditor *get_editor(); + MDRUVRectEditorPopup(); ~MDRUVRectEditorPopup(); protected: - void _notification(int p_what); static void _bind_methods(); + + MDRUVRectEditor *_editor; }; #endif