Bindings for the rest of the actions.

This commit is contained in:
Relintai 2022-06-21 18:47:22 +02:00
parent d68d3fa340
commit 1f3ef7782f
10 changed files with 136 additions and 1 deletions

View File

@ -28,6 +28,13 @@ SOFTWARE.
#include "../paint_canvas_layer.h"
#include "../paint_utilities.h"
float BrightenAction::get_brighten_color() {
return brighten_color;
}
void BrightenAction::set_brighten_color(const float val) {
brighten_color = val;
}
void BrightenAction::do_action(PaintCanvas *canvas, const Array &data) {
PaintAction::do_action(canvas, data);
@ -69,4 +76,7 @@ BrightenAction::~BrightenAction() {
}
void BrightenAction::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_brighten_color"), &BrightenAction::get_brighten_color);
ClassDB::bind_method(D_METHOD("set_brighten_color", "value"), &BrightenAction::set_brighten_color);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "brighten_color"), "set_", "get_brighten_color");
}

View File

@ -33,6 +33,9 @@ class BrightenAction : public PaintAction {
GDCLASS(BrightenAction, PaintAction);
public:
float get_brighten_color();
void set_brighten_color(const float val);
void do_action(PaintCanvas *canvas, const Array &data);
BrightenAction();

View File

@ -28,6 +28,34 @@ SOFTWARE.
#include "../paint_canvas_layer.h"
#include "../paint_utilities.h"
Color CutAction::get_selection_color() {
return selection_color;
}
void CutAction::set_selection_color(const Color &val) {
selection_color = val;
}
Vector2i CutAction::get_mouse_start_pos() {
return mouse_start_pos;
}
void CutAction::set_mouse_start_pos(const Vector2i &val) {
mouse_start_pos = val;
}
Vector2i CutAction::get_mouse_end_pos() {
return mouse_end_pos;
}
void CutAction::set_mouse_end_pos(const Vector2i &val) {
mouse_end_pos = val;
}
bool CutAction::get_mouse_start_pos_set() {
return mouse_start_pos_set;
}
void CutAction::set_mouse_start_pos_set(const bool val) {
mouse_start_pos_set = val;
}
bool CutAction::can_commit() {
return false; //ugly way of handling a cut
}
@ -116,4 +144,19 @@ CutAction::~CutAction() {
}
void CutAction::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_selection_color"), &CutAction::get_selection_color);
ClassDB::bind_method(D_METHOD("set_selection_color", "value"), &CutAction::set_selection_color);
ADD_PROPERTY(PropertyInfo(Variant::COLOR, "selection_color"), "set_selection_color", "get_selection_color");
ClassDB::bind_method(D_METHOD("get_mouse_start_pos"), &CutAction::get_mouse_start_pos);
ClassDB::bind_method(D_METHOD("set_mouse_start_pos", "value"), &CutAction::set_mouse_start_pos);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "mouse_start_pos"), "set_mouse_start_pos", "get_mouse_start_pos");
ClassDB::bind_method(D_METHOD("get_mouse_end_pos"), &CutAction::get_mouse_end_pos);
ClassDB::bind_method(D_METHOD("set_mouse_end_pos", "value"), &CutAction::set_mouse_end_pos);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "mouse_end_pos"), "set_mouse_end_pos", "get_mouse_end_pos");
ClassDB::bind_method(D_METHOD("get_mouse_start_pos_set"), &CutAction::get_mouse_start_pos_set);
ClassDB::bind_method(D_METHOD("set_mouse_start_pos_set", "value"), &CutAction::set_mouse_start_pos_set);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "mouse_start_pos_set"), "set_mouse_start_pos_set", "get_mouse_start_pos_set");
}

View File

@ -33,6 +33,18 @@ class CutAction : public PaintAction {
GDCLASS(CutAction, PaintAction);
public:
Color get_selection_color();
void set_selection_color(const Color &val);
Vector2i get_mouse_start_pos();
void set_mouse_start_pos(const Vector2i &val);
Vector2i get_mouse_end_pos();
void set_mouse_end_pos(const Vector2i &val);
bool get_mouse_start_pos_set();
void set_mouse_start_pos_set(const bool val);
bool can_commit();
void do_action(PaintCanvas *canvas, const Array &data);

View File

@ -28,6 +28,13 @@ SOFTWARE.
#include "../paint_canvas_layer.h"
#include "../paint_utilities.h"
float DarkenAction::get_dark_factor() {
return dark_factor;
}
void DarkenAction::set_dark_factor(const float val) {
dark_factor = val;
}
void DarkenAction::do_action(PaintCanvas *canvas, const Array &data) {
PaintAction::do_action(canvas, data);
@ -70,4 +77,7 @@ DarkenAction::~DarkenAction() {
}
void DarkenAction::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_dark_factor"), &DarkenAction::get_dark_factor);
ClassDB::bind_method(D_METHOD("set_dark_factor", "value"), &DarkenAction::set_dark_factor);
ADD_PROPERTY(PropertyInfo(Variant::REAL, "dark_factor"), "set_dark_factor", "get_dark_factor");
}

View File

@ -33,6 +33,9 @@ class DarkenAction : public PaintAction {
GDCLASS(DarkenAction, PaintAction);
public:
float get_dark_factor();
void set_dark_factor(const float val);
void do_action(PaintCanvas *canvas, const Array &data);
DarkenAction();

View File

@ -28,6 +28,20 @@ SOFTWARE.
#include "../paint_canvas_layer.h"
#include "../paint_utilities.h"
Vector2i LineAction::get_mouse_start_pos() {
return mouse_start_pos;
}
void LineAction::set_mouse_start_pos(const Vector2i &val) {
mouse_start_pos = val;
}
bool LineAction::get_mouse_start_pos_set() {
return mouse_start_pos_set;
}
void LineAction::set_mouse_start_pos_set(const bool val) {
mouse_start_pos_set = val;
}
void LineAction::do_action(PaintCanvas *canvas, const Array &data) {
PaintAction::do_action(canvas, data);
@ -96,4 +110,11 @@ LineAction::~LineAction() {
}
void LineAction::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_mouse_start_pos"), &LineAction::get_mouse_start_pos);
ClassDB::bind_method(D_METHOD("set_mouse_start_pos", "value"), &LineAction::set_mouse_start_pos);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "mouse_start_pos"), "set_mouse_start_pos", "get_mouse_start_pos");
ClassDB::bind_method(D_METHOD("get_mouse_start_pos_set"), &LineAction::get_mouse_start_pos_set);
ClassDB::bind_method(D_METHOD("set_mouse_start_pos_set", "value"), &LineAction::set_mouse_start_pos_set);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "mouse_start_pos_set"), "set_mouse_start_pos_set", "get_mouse_start_pos_set");
}

View File

@ -33,6 +33,12 @@ class LineAction : public PaintAction {
GDCLASS(LineAction, PaintAction);
public:
Vector2i get_mouse_start_pos();
void set_mouse_start_pos(const Vector2i &val);
bool get_mouse_start_pos_set();
void set_mouse_start_pos_set(const bool val);
void do_action(PaintCanvas *canvas, const Array &data);
void commit_action(PaintCanvas *canvas);
bool can_commit();

View File

@ -28,6 +28,20 @@ SOFTWARE.
#include "../paint_canvas_layer.h"
#include "../paint_utilities.h"
Vector2i RectAction::get_mouse_start_pos() {
return mouse_start_pos;
}
void RectAction::set_mouse_start_pos(const Vector2i &val) {
mouse_start_pos = val;
}
bool RectAction::get_mouse_start_pos_set() {
return mouse_start_pos_set;
}
void RectAction::set_mouse_start_pos_set(const bool val) {
mouse_start_pos_set = val;
}
void RectAction::do_action(PaintCanvas *canvas, const Array &data) {
PaintAction::do_action(canvas, data);
@ -103,4 +117,11 @@ RectAction::~RectAction() {
}
void RectAction::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_mouse_start_pos"), &RectAction::get_mouse_start_pos);
ClassDB::bind_method(D_METHOD("set_mouse_start_pos", "value"), &RectAction::set_mouse_start_pos);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2I, "mouse_start_pos"), "set_mouse_start_pos", "get_mouse_start_pos");
ClassDB::bind_method(D_METHOD("get_mouse_start_pos_set"), &RectAction::get_mouse_start_pos_set);
ClassDB::bind_method(D_METHOD("set_mouse_start_pos_set", "value"), &RectAction::set_mouse_start_pos_set);
ADD_PROPERTY(PropertyInfo(Variant::BOOL, "mouse_start_pos_set"), "set_mouse_start_pos_set", "get_mouse_start_pos_set");
}

View File

@ -33,6 +33,12 @@ class RectAction : public PaintAction {
GDCLASS(RectAction, PaintAction);
public:
Vector2i get_mouse_start_pos();
void set_mouse_start_pos(const Vector2i &val);
bool get_mouse_start_pos_set();
void set_mouse_start_pos_set(const bool val);
void do_action(PaintCanvas *canvas, const Array &data);
void commit_action(PaintCanvas *canvas);
bool can_commit();