Renamed the paint canvas getters/setters in PaintAction, and bound them.

This commit is contained in:
Relintai 2022-11-15 12:26:50 +01:00
parent 9da781e8b8
commit 1fac355760
2 changed files with 15 additions and 10 deletions

View File

@ -30,14 +30,14 @@ SOFTWARE.
#include "../nodes/paint_canvas.h"
PaintCanvas *PaintAction::get_canvas() {
return _canvas;
PaintCanvas *PaintAction::get_paint_canvas() {
return _paint_canvas;
}
void PaintAction::set_canvas(PaintCanvas *canvas) {
_canvas = canvas;
void PaintAction::set_paint_canvas(PaintCanvas *paint_canvas) {
_paint_canvas = paint_canvas;
}
void PaintAction::set_canvas_bind(Node *canvas) {
set_canvas(Object::cast_to<PaintCanvas>(canvas));
void PaintAction::set_paint_canvas_bind(Node *paint_canvas) {
set_paint_canvas(Object::cast_to<PaintCanvas>(paint_canvas));
}
Dictionary PaintAction::get_action_data_undo() {
@ -300,12 +300,17 @@ void PaintAction::_redo_action() {
}
PaintAction::PaintAction() {
_paint_canvas = NULL;
}
PaintAction::~PaintAction() {
}
void PaintAction::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_paint_canvas"), &PaintAction::get_paint_canvas);
ClassDB::bind_method(D_METHOD("set_paint_canvas", "canvas"), &PaintAction::set_paint_canvas_bind);
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "paint_canvas"), "set_paint_canvas", "get_paint_canvas");
ClassDB::bind_method(D_METHOD("get_action_data_undo"), &PaintAction::get_action_data_undo);
ClassDB::bind_method(D_METHOD("set_action_data_undo", "value"), &PaintAction::set_action_data_undo);
ADD_PROPERTY(PropertyInfo(Variant::DICTIONARY, "action_data_undo"), "set_action_data_undo", "get_action_data_undo");

View File

@ -42,9 +42,9 @@ class PaintAction : public Resource {
GDCLASS(PaintAction, Resource);
public:
PaintCanvas *get_canvas();
void set_canvas(PaintCanvas *canvas);
void set_canvas_bind(Node *canvas);
PaintCanvas *get_paint_canvas();
void set_paint_canvas(PaintCanvas *paint_canvas);
void set_paint_canvas_bind(Node *paint_canvas);
Dictionary get_action_data_undo();
void set_action_data_undo(const Dictionary &val);
@ -132,7 +132,7 @@ public:
protected:
static void _bind_methods();
PaintCanvas *_canvas;
PaintCanvas *_paint_canvas;
};
#endif