diff --git a/modules/paint/ui/paint_canvas_background.cpp b/modules/paint/ui/paint_canvas_background.cpp index e5de04050..42b1b1751 100644 --- a/modules/paint/ui/paint_canvas_background.cpp +++ b/modules/paint/ui/paint_canvas_background.cpp @@ -24,8 +24,6 @@ SOFTWARE. #include "paint_canvas_background.h" -#include "../nodes/paint_node.h" - int PaintCanvasBackground::get_grid_size() const { return _grid_size; } @@ -53,22 +51,6 @@ void PaintCanvasBackground::set_grid_white(const Color &val) { update(); } -PaintNode *PaintCanvasBackground::get_paint_node() { - Node *p = this; - - while (p) { - PaintNode *pn = Object::cast_to(p); - - if (pn) { - return pn; - } - - p = p->get_parent(); - } - - return NULL; -} - PaintCanvasBackground::PaintCanvasBackground() { _grid_size = 8; @@ -83,7 +65,7 @@ void PaintCanvasBackground::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case PaintNode::NOTIFICATION_PARENT_PAINT_NODE_RESIZED: { - PaintNode *pn = get_paint_node(); + PaintNode *pn = get_parent_paint_node(); if (pn) { set_size(pn->get_size()); diff --git a/modules/paint/ui/paint_canvas_background.h b/modules/paint/ui/paint_canvas_background.h index 1c2ce2a5b..3fae2d785 100644 --- a/modules/paint/ui/paint_canvas_background.h +++ b/modules/paint/ui/paint_canvas_background.h @@ -25,17 +25,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "scene/gui/texture_rect.h" +#include "../nodes/paint_node.h" -#include "core/object/reference.h" - -class ShaderMaterial; -class Shader; -class Image; -class PaintNode; - -class PaintCanvasBackground : public TextureRect { - GDCLASS(PaintCanvasBackground, TextureRect); +class PaintCanvasBackground : public PaintNode { + GDCLASS(PaintCanvasBackground, PaintNode); public: int get_grid_size() const; @@ -46,9 +39,7 @@ public: Color get_grid_white() const; void set_grid_white(const Color &val); - - PaintNode *get_paint_node(); - + PaintCanvasBackground(); ~PaintCanvasBackground(); diff --git a/modules/paint/ui/paint_visual_grid.cpp b/modules/paint/ui/paint_visual_grid.cpp index 2128e70f1..f44751e8d 100644 --- a/modules/paint/ui/paint_visual_grid.cpp +++ b/modules/paint/ui/paint_visual_grid.cpp @@ -24,8 +24,6 @@ SOFTWARE. #include "paint_visual_grid.h" -#include "../nodes/paint_node.h" - int PaintVisualGrid::get_grid_size() { return _grid_size; } @@ -42,27 +40,11 @@ void PaintVisualGrid::set_grid_color(const Color &val) { update(); } -PaintNode *PaintVisualGrid::get_paint_node() { - Node *p = this; - - while (p) { - PaintNode *pn = Object::cast_to(p); - - if (pn) { - return pn; - } - - p = p->get_parent(); - } - - return NULL; -} - void PaintVisualGrid::_notification(int p_what) { switch (p_what) { case NOTIFICATION_ENTER_TREE: case PaintNode::NOTIFICATION_PARENT_PAINT_NODE_RESIZED: { - PaintNode *pn = get_paint_node(); + PaintNode *pn = get_parent_paint_node(); if (pn) { set_size(pn->get_size()); diff --git a/modules/paint/ui/paint_visual_grid.h b/modules/paint/ui/paint_visual_grid.h index a583360c2..731e15dca 100644 --- a/modules/paint/ui/paint_visual_grid.h +++ b/modules/paint/ui/paint_visual_grid.h @@ -25,12 +25,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "scene/gui/control.h" +#include "../nodes/paint_node.h" -class PaintNode; - -class PaintVisualGrid : public Control { - GDCLASS(PaintVisualGrid, Control); +class PaintVisualGrid : public PaintNode { + GDCLASS(PaintVisualGrid, PaintNode); public: int get_grid_size(); @@ -39,8 +37,6 @@ public: Color get_grid_color(); void set_grid_color(const Color &val); - PaintNode *get_paint_node(); - PaintVisualGrid(); ~PaintVisualGrid();