diff --git a/modules/paint/nodes/paint_node.cpp b/modules/paint/nodes/paint_node.cpp index 9fb893f9f..4e8748baf 100644 --- a/modules/paint/nodes/paint_node.cpp +++ b/modules/paint/nodes/paint_node.cpp @@ -1,5 +1,6 @@ #include "paint_node.h" +#include "../paint_utilities.h" #include "paint_project.h" Vector2i PaintNode::get_size() { @@ -9,6 +10,30 @@ void PaintNode::set_size(const Vector2i &size) { _size = size; } +PoolVector2iArray PaintNode::util_get_pixels_in_line(const Vector2i &from, const Vector2i &to) { + return PaintUtilities::get_pixels_in_line(from, to); +} + +int PaintNode::util_to_1d_v(const Vector2i &p, int w) { + return PaintUtilities::to_1D_v(p, w); +} +int PaintNode::util_to_1d(int x, int y, int w) { + return PaintUtilities::to_1D(x, y, w); +} +Vector2i PaintNode::util_to_2d(int idx, int w) { + return PaintUtilities::to_2D(idx, w); +} + +Color PaintNode::util_color_from_array(const PoolRealArray &color_array) { + return PaintUtilities::color_from_array(color_array); +} +Color PaintNode::util_random_color() { + return PaintUtilities::random_color(); +} +Color PaintNode::util_random_color_alt() { + return PaintUtilities::random_color_alt(); +} + PaintProject *PaintNode::get_paint_project() { PaintNode *p = this; @@ -52,5 +77,15 @@ void PaintNode::_bind_methods() { ClassDB::bind_method(D_METHOD("set_size", "size"), &PaintNode::set_size); ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "size"), "set_size", "get_size"); + ClassDB::bind_method(D_METHOD("util_get_pixels_in_line", "from", "to"), &PaintNode::util_get_pixels_in_line); + + ClassDB::bind_method(D_METHOD("util_to_1d_v", "p", "w"), &PaintNode::util_to_1d_v); + ClassDB::bind_method(D_METHOD("util_to_1d", "x", "y", "w"), &PaintNode::util_to_1d); + ClassDB::bind_method(D_METHOD("util_to_2d", "idx", "w"), &PaintNode::util_to_2d); + + ClassDB::bind_method(D_METHOD("util_color_from_array", "color_array"), &PaintNode::util_color_from_array); + ClassDB::bind_method(D_METHOD("util_random_color"), &PaintNode::util_random_color); + ClassDB::bind_method(D_METHOD("util_random_color_alt"), &PaintNode::util_random_color_alt); + ClassDB::bind_method(D_METHOD("get_paint_project"), &PaintNode::get_paint_project); } diff --git a/modules/paint/nodes/paint_node.h b/modules/paint/nodes/paint_node.h index 6d237503b..cd21cf77d 100644 --- a/modules/paint/nodes/paint_node.h +++ b/modules/paint/nodes/paint_node.h @@ -14,6 +14,16 @@ public: Vector2i get_size(); void set_size(const Vector2i &size); + PoolVector2iArray util_get_pixels_in_line(const Vector2i &from, const Vector2i &to); + + int util_to_1d_v(const Vector2i &p, int w); + int util_to_1d(int x, int y, int w); + Vector2i util_to_2d(int idx, int w); + + Color util_color_from_array(const PoolRealArray &color_array); + Color util_random_color(); + Color util_random_color_alt(); + PaintProject *get_paint_project(); String get_configuration_warning() const;