From d8185be48f7bc2a3b3929cfbc8c2be106a13b9c8 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 20 Jun 2022 21:06:44 +0200 Subject: [PATCH] Fix the initial canvas size for the paint module. --- modules/paint/paint_canvas.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/modules/paint/paint_canvas.cpp b/modules/paint/paint_canvas.cpp index e10b33234..c6a5c04d1 100644 --- a/modules/paint/paint_canvas.cpp +++ b/modules/paint/paint_canvas.cpp @@ -543,9 +543,9 @@ PoolVector2iArray PaintCanvas::get_neighbouring_pixels(const int pos_x, const in } void PaintCanvas::resize(int width, int height) { - if (get_canvas_width() == width && get_canvas_height() == height) { - return; - } + //if (get_canvas_width() == width && get_canvas_height() == height) { + // return; + // } if (width < 0) { width = 1; @@ -587,14 +587,15 @@ void PaintCanvas::_notification(int p_what) { preview_layer = add_new_layer("Preview"); tool_layer = add_new_layer("Tool"); - //hack - _canvas_width = 0; - _canvas_height = 0; - - resize(64, 64); + ////hack + //_canvas_width = 0; + //_canvas_height = 0; set_process(true); } break; + case NOTIFICATION_ENTER_TREE: { + resize(64, 64); + } break; case NOTIFICATION_PROCESS: { _process(get_process_delta_time()); } break;