Implement the uv editor popup.

This commit is contained in:
Relintai 2022-04-13 18:03:48 +02:00
parent f930ee6063
commit cd3366f6c4
2 changed files with 21 additions and 15 deletions

View File

@ -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);
}

View File

@ -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