From f1806586826f33c7155f1a447695ac5192e169dc Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 14 Jun 2022 17:16:26 +0200 Subject: [PATCH] Fixed smaller issues and added all of mat maker's widgets to the build. --- modules/material_maker/SCsub | 14 +++++++++----- .../image_picker_button/image_picker_button.cpp | 2 ++ .../widgets/polygon_edit/polygon_control_point.cpp | 7 +++++-- .../widgets/polygon_edit/polygon_control_point.h | 4 ++++ .../editor/widgets/polygon_edit/polygon_editor.cpp | 1 + 5 files changed, 21 insertions(+), 7 deletions(-) diff --git a/modules/material_maker/SCsub b/modules/material_maker/SCsub index 3d9c08b0c..c62bc8fec 100644 --- a/modules/material_maker/SCsub +++ b/modules/material_maker/SCsub @@ -41,11 +41,15 @@ sources = [ "editor/widgets/gradient_editor/gradient_editor.cpp", "editor/widgets/gradient_editor/gradient_popup.cpp", - #"editor/widgets//.cpp", - #"editor/widgets//.cpp", - #"editor/widgets//.cpp", - #"editor/widgets//.cpp", - #"editor/widgets//.cpp", + "editor/widgets/image_picker_button/image_picker_button.cpp", + + "editor/widgets/mm_dnd_color_picker_button/mm_dnd_color_picker_button.cpp", + + "editor/widgets/polygon_edit/polygon_control_point.cpp", + "editor/widgets/polygon_edit/polygon_dialog.cpp", + "editor/widgets/polygon_edit/polygon_edit.cpp", + "editor/widgets/polygon_edit/polygon_editor.cpp", + "editor/widgets/polygon_edit/polygon_view.cpp", ] diff --git a/modules/material_maker/editor/widgets/image_picker_button/image_picker_button.cpp b/modules/material_maker/editor/widgets/image_picker_button/image_picker_button.cpp index 370a65cc1..10d179087 100644 --- a/modules/material_maker/editor/widgets/image_picker_button/image_picker_button.cpp +++ b/modules/material_maker/editor/widgets/image_picker_button/image_picker_button.cpp @@ -5,6 +5,8 @@ #include "core/io/resource_loader.h" #include "scene/resources/texture.h" +#include "scene/resources/bit_map.h" + String ImagePickerButton::get_image_path() { return image_path; } 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 544eb8373..c0715b046 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 @@ -1,6 +1,8 @@ #include "polygon_control_point.h" +#include "polygon_editor.h" + bool PolygonControlPoint::get_moving() const { return moving; } @@ -17,7 +19,7 @@ void PolygonControlPoint::_draw() { } void PolygonControlPoint::initialize(const Vector2 &p) { - set_rect_position(get_parent().transform_point(p) - OFFSET); + set_position(polygon_editor->transform_point(p) - OFFSET); } void PolygonControlPoint::_on_ControlPoint_gui_input(const Ref &event) { @@ -30,7 +32,7 @@ void PolygonControlPoint::_on_ControlPoint_gui_input(const Ref &even moving = true; } else { moving = false; - get_parent().update_controls(); + polygon_editor->update_controls(); } } else if (iemb->get_button_index() == BUTTON_RIGHT && event->is_pressed()) { emit_signal("removed", get_index()); @@ -44,6 +46,7 @@ void PolygonControlPoint::_on_ControlPoint_gui_input(const Ref &even } PolygonControlPoint::PolygonControlPoint() { + polygon_editor = nullptr; moving = false; set_custom_minimum_size(Vector2(7, 7)); diff --git a/modules/material_maker/editor/widgets/polygon_edit/polygon_control_point.h b/modules/material_maker/editor/widgets/polygon_edit/polygon_control_point.h index f295798e8..f59900c17 100644 --- a/modules/material_maker/editor/widgets/polygon_edit/polygon_control_point.h +++ b/modules/material_maker/editor/widgets/polygon_edit/polygon_control_point.h @@ -5,6 +5,8 @@ #include "core/os/input_event.h" +class PolygonEditor; + class PolygonControlPoint : public Control { GDCLASS(PolygonControlPoint, Control); @@ -20,6 +22,8 @@ public: PolygonControlPoint(); ~PolygonControlPoint(); + PolygonEditor *polygon_editor; + const Vector2 OFFSET = Vector2(3, 3); protected: 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 3da3434e7..87d6e126c 100644 --- a/modules/material_maker/editor/widgets/polygon_edit/polygon_editor.cpp +++ b/modules/material_maker/editor/widgets/polygon_edit/polygon_editor.cpp @@ -26,6 +26,7 @@ void PolygonEditor::update_controls() { Vector2 p = points[i]; PolygonControlPoint *control_point = memnew(PolygonControlPoint); + control_point->polygon_editor = this; add_child(control_point); control_point->initialize(p);