From 1fac35576091e370cad6d9089bd6d755ce6b4e74 Mon Sep 17 00:00:00 2001 From: Relintai Date: Tue, 15 Nov 2022 12:26:50 +0100 Subject: [PATCH] Renamed the paint canvas getters/setters in PaintAction, and bound them. --- modules/paint/actions/paint_action.cpp | 17 +++++++++++------ modules/paint/actions/paint_action.h | 8 ++++---- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/modules/paint/actions/paint_action.cpp b/modules/paint/actions/paint_action.cpp index a9b76a39e..ff9d287c5 100644 --- a/modules/paint/actions/paint_action.cpp +++ b/modules/paint/actions/paint_action.cpp @@ -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(canvas)); +void PaintAction::set_paint_canvas_bind(Node *paint_canvas) { + set_paint_canvas(Object::cast_to(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"); diff --git a/modules/paint/actions/paint_action.h b/modules/paint/actions/paint_action.h index cf25958f2..448c882c8 100644 --- a/modules/paint/actions/paint_action.h +++ b/modules/paint/actions/paint_action.h @@ -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