diff --git a/modules/paint/SCsub b/modules/paint/SCsub index a76a30190..d8f80909d 100644 --- a/modules/paint/SCsub +++ b/modules/paint/SCsub @@ -9,16 +9,40 @@ module_env.add_source_files(env.modules_sources,"register_types.cpp") module_env.add_source_files(env.modules_sources,"paint_utilities.cpp") module_env.add_source_files(env.modules_sources,"actions/paint_action.cpp") +module_env.add_source_files(env.modules_sources,"actions/brighten_action.cpp") +module_env.add_source_files(env.modules_sources,"actions/brush_action.cpp") +module_env.add_source_files(env.modules_sources,"actions/bucket_action.cpp") +module_env.add_source_files(env.modules_sources,"actions/cut_action.cpp") +module_env.add_source_files(env.modules_sources,"actions/darken_action.cpp") +module_env.add_source_files(env.modules_sources,"actions/line_action.cpp") +module_env.add_source_files(env.modules_sources,"actions/multiline_action.cpp") +module_env.add_source_files(env.modules_sources,"actions/paste_cut_action.cpp") +module_env.add_source_files(env.modules_sources,"actions/pencil_action.cpp") +module_env.add_source_files(env.modules_sources,"actions/rainbow_action.cpp") +module_env.add_source_files(env.modules_sources,"actions/rect_action.cpp") +module_env.add_source_files(env.modules_sources,"dialogs/paint_canvas_dialog.cpp") +module_env.add_source_files(env.modules_sources,"dialogs/paint_change_grid_size_dialog.cpp") +module_env.add_source_files(env.modules_sources,"dialogs/paint_load_file_dialog.cpp") +module_env.add_source_files(env.modules_sources,"dialogs/paint_save_file_dialog.cpp") +module_env.add_source_files(env.modules_sources,"bush_prefabs.cpp") module_env.add_source_files(env.modules_sources,"paint_canvas_layer.cpp") - +module_env.add_source_files(env.modules_sources,"paint_canvas.cpp") module_env.add_source_files(env.modules_sources,"paint_canvas_outline.cpp") module_env.add_source_files(env.modules_sources,"paint_color_grid.cpp") + + module_env.add_source_files(env.modules_sources,"paint_layer_button.cpp") +module_env.add_source_files(env.modules_sources,"paint_navbar.cpp") +module_env.add_source_files(env.modules_sources,"paint_selection_box.cpp") +module_env.add_source_files(env.modules_sources,"paint_settings.cpp") +module_env.add_source_files(env.modules_sources,"paint_text_info.cpp") +module_env.add_source_files(env.modules_sources,"paint_utilities.cpp") -#module_env.add_source_files(env.modules_sources,"plugin/mdr_import_plugin_base.cpp") +module_env.add_source_files(env.modules_sources,"paint_visual_grid.cpp") +module_env.add_source_files(env.modules_sources,"paint_window.cpp") -#if 'TOOLS_ENABLED' in env["CPPDEFINES"]: -# module_env.add_source_files(env.modules_sources,"plugin_gltf/editor_import_gltf_mdr.cpp") +if 'TOOLS_ENABLED' in env["CPPDEFINES"]: + module_env.add_source_files(env.modules_sources,"paint_editor_plugin.cpp") diff --git a/modules/paint/bush_prefabs.cpp b/modules/paint/bush_prefabs.cpp index 628dda564..91aa8aa1e 100644 --- a/modules/paint/bush_prefabs.cpp +++ b/modules/paint/bush_prefabs.cpp @@ -38,89 +38,91 @@ const list = [ Vector2(-1, 0), Vector2(0, 0), Vector2(1, 0), ], [ Vector2(0, -1), - Vector2(0, 0), + Vector2(0, 0), Vector2(0, 1) ] ] */ PoolVector3iArray BrushPrefabs::get_brush(const BrushPrefabs::Type type, const int size) { -/* - var pixels = [] - if size < 1: - size = 1 - - match type: - Type.CIRCLE: - size += 1 - var center = Vector2.ZERO - var last = center - var radius = size / 2.0 - for x in range(size): - for y in range(size): - if Vector2(x - radius, y - radius).length() < size / 3.0: + /* + var pixels = [] + if size < 1: + size = 1 + + match type: + Type.CIRCLE: + size += 1 + var center = Vector2.ZERO + var last = center + var radius = size / 2.0 + for x in range(size): + for y in range(size): + if Vector2(x - radius, y - radius).length() < size / 3.0: + pixels.append(Vector2(x, y)) + + var avg = Vector2(size / 2, size / 2) + avg = Vector2(floor(avg.x), floor(avg.y)) + + for i in range(pixels.size()): + pixels[i] -= avg + + Type.RECT: + var center = Vector2.ZERO + var last = center + for x in range(size): + for y in range(size): pixels.append(Vector2(x, y)) - - var avg = Vector2(size / 2, size / 2) - avg = Vector2(floor(avg.x), floor(avg.y)) - - for i in range(pixels.size()): - pixels[i] -= avg - - Type.RECT: - var center = Vector2.ZERO - var last = center - for x in range(size): - for y in range(size): - pixels.append(Vector2(x, y)) - - var avg = Vector2.ZERO - for cell in pixels: - avg += cell - - avg.x /= pixels.size() - avg.y /= pixels.size() - - avg = Vector2(floor(avg.x), floor(avg.y)) - - for i in range(pixels.size()): - pixels[i] -= avg - - Type.V_LINE: - var center = Vector2.ZERO - var last = center - pixels.append(Vector2.ZERO) - - for i in range(size - 1): - var sig = sign(last.y) - if sig == 0: - sig = 1 - - if last.y < 0: - center.y = abs(last.y) * -sig - else: - center.y = abs(last.y+1) * -sig - last = center - pixels.append(center) - Type.H_LINE: - var center = Vector2.ZERO - var last = center - pixels.append(Vector2.ZERO) - - for i in range(size - 1): - var sig = sign(last.x) - if sig == 0: - sig = 1 - - if last.x < 0: - center.x = abs(last.x) * -sig - else: - center.x = abs(last.x+1) * -sig - last = center - pixels.append(center) - - return pixels -*/ + + var avg = Vector2.ZERO + for cell in pixels: + avg += cell + + avg.x /= pixels.size() + avg.y /= pixels.size() + + avg = Vector2(floor(avg.x), floor(avg.y)) + + for i in range(pixels.size()): + pixels[i] -= avg + + Type.V_LINE: + var center = Vector2.ZERO + var last = center + pixels.append(Vector2.ZERO) + + for i in range(size - 1): + var sig = sign(last.y) + if sig == 0: + sig = 1 + + if last.y < 0: + center.y = abs(last.y) * -sig + else: + center.y = abs(last.y+1) * -sig + last = center + pixels.append(center) + Type.H_LINE: + var center = Vector2.ZERO + var last = center + pixels.append(Vector2.ZERO) + + for i in range(size - 1): + var sig = sign(last.x) + if sig == 0: + sig = 1 + + if last.x < 0: + center.x = abs(last.x) * -sig + else: + center.x = abs(last.x+1) * -sig + last = center + pixels.append(center) + + return pixels + */ + + return PoolVector3iArray(); } BrushPrefabs::BrushPrefabs() { diff --git a/modules/paint/paint_canvas.cpp b/modules/paint/paint_canvas.cpp index 50a0d9508..81421b4c0 100644 --- a/modules/paint/paint_canvas.cpp +++ b/modules/paint/paint_canvas.cpp @@ -135,6 +135,7 @@ bool PaintCanvas::is_alpha_locked() { /* return active_layer.alpha_locked */ + return false; } Rect2 PaintCanvas::get_content_margin() { /* @@ -156,6 +157,8 @@ Rect2 PaintCanvas::get_content_margin() { return rect */ + + return Rect2(); } void PaintCanvas::crop_to_content() { /* @@ -179,11 +182,14 @@ Node *PaintCanvas::get_active_layer() { /* return active_layer */ + + return nullptr; } Node *PaintCanvas::get_preview_layer() { /* return preview_layer */ + return nullptr; } void PaintCanvas::clear_active_layer() { /* @@ -218,6 +224,7 @@ Node *PaintCanvas::remove_layer(const String &layer_name) { layers.erase(del_layer) return active_layer */ + return nullptr; } Node *PaintCanvas::add_new_layer(const String &layer_name) { /* @@ -246,6 +253,7 @@ Node *PaintCanvas::add_new_layer(const String &layer_name) { return layer */ + return nullptr; } Node *PaintCanvas::duplicate_layer(const String &layer_name, const String &new_layer_name) { /* @@ -258,6 +266,7 @@ Node *PaintCanvas::duplicate_layer(const String &layer_name, const String &new_l layer.image.copy_from(dup_layer.image) return layer */ + return nullptr; } void PaintCanvas::toggle_layer_visibility(const String &layer_name) { /* @@ -273,6 +282,7 @@ Node *PaintCanvas::find_layer_by_name(const String &layer_name) { return layer return null */ + return nullptr; } void PaintCanvas::toggle_lock_layer(const String &layer_name) { /* @@ -283,6 +293,8 @@ bool PaintCanvas::is_active_layer_locked() { /* return active_layer.locked */ + + return false; } void PaintCanvas::move_layer_forward(const String &layer_name) { /* @@ -321,6 +333,7 @@ bool PaintCanvas::is_inside_canvas(const int x, const int y) { return false return true */ + return false; } //Note: Arrays are always passed by reference. To get a copy of an array which @@ -358,6 +371,7 @@ Color PaintCanvas::get_pixel_v(const Vector2 &pos) { /* return get_pixel(pos.x, pos.y) */ + return Color(); } Color PaintCanvas::get_pixel(const int x, const int y) { /* @@ -365,6 +379,7 @@ Color PaintCanvas::get_pixel(const int x, const int y) { return active_layer.get_pixel(x, y) return null */ + return Color(); } void PaintCanvas::set_preview_pixel_v(const Vector2 &pos, const Color &color) { /* @@ -383,6 +398,7 @@ Color PaintCanvas::get_preview_pixel_v(const Vector2 &pos) { /* return get_preview_pixel(pos.x, pos.y) */ + return Color(); } Color PaintCanvas::get_preview_pixel(const int x, const int y) { @@ -391,6 +407,7 @@ Color PaintCanvas::get_preview_pixel(const int x, const int y) { return null return preview_layer.get_pixel(x, y) */ + return Color(); } void PaintCanvas::toggle_grid() { /* @@ -420,11 +437,14 @@ Array PaintCanvas::select_color(const int x, const int y) { same_color_pixels.append(color) return same_color_pixels */ + return Array(); } Array PaintCanvas::select_same_color(const int x, const int y) { /* return get_neighbouring_pixels(x, y) */ + + return Array(); } // returns array of Vector2 @@ -481,6 +501,7 @@ Array PaintCanvas::get_neighbouring_pixels(const int pos_x, const int pos_y) { return pixels */ + return Array(); } PaintCanvas::PaintCanvas() { diff --git a/modules/paint/paint_editor_plugin.cpp b/modules/paint/paint_editor_plugin.cpp index 71f396845..274743279 100644 --- a/modules/paint/paint_editor_plugin.cpp +++ b/modules/paint/paint_editor_plugin.cpp @@ -22,11 +22,6 @@ SOFTWARE. #include "paint_editor_plugin.h" -#include "../nodes/mesh_data_instance.h" -#include "mdi_ed.h" -#include "mdi_gizmo.h" -#include "mdi_gizmo_plugin.h" - void PaintEditorPlugin::make_visible(const bool visible) { /* if editor_scene: diff --git a/modules/paint/paint_navbar.cpp b/modules/paint/paint_navbar.cpp index 687d19c23..d076904ef 100644 --- a/modules/paint/paint_navbar.cpp +++ b/modules/paint/paint_navbar.cpp @@ -151,6 +151,8 @@ bool PaintNavbar::is_any_menu_open() { return true return false */ + + return false; } PaintNavbar::PaintNavbar() { diff --git a/modules/paint/paint_text_info.cpp b/modules/paint/paint_text_info.cpp index 8f5d1d295..d1e92d317 100644 --- a/modules/paint/paint_text_info.cpp +++ b/modules/paint/paint_text_info.cpp @@ -27,7 +27,7 @@ SOFTWARE. //TODO: To make reading the text easier, the text info with the longest text should have it's length applied to all the //the other text infos -void PaintTextInfo::add_text_info(String text_name, Node *custom_node) { +void PaintTextInfo::add_text_info(const String &text_name, Node *custom_node) { /* var last_text_info_child = null var child_count = get_child_count() @@ -50,7 +50,7 @@ void PaintTextInfo::add_text_info(String text_name, Node *custom_node) { add_child(label) */ } -void PaintTextInfo::update_text_info(String text_name, Node *text_value, Node *node, Node *node_target_value, Node *node_value) { +void PaintTextInfo::update_text_info(const String &text_name, Node *text_value, Node *node, Node *node_target_value, Node *node_value) { /* var text_label = self.get_node(text_name) if text_label == null: diff --git a/modules/paint/paint_window.cpp b/modules/paint/paint_window.cpp index dc874788f..5a77747a6 100644 --- a/modules/paint/paint_window.cpp +++ b/modules/paint/paint_window.cpp @@ -24,6 +24,9 @@ SOFTWARE. #include "paint_window.h" +#include "paint_canvas_layer.h" +#include "actions/paint_action.h" + void PaintWindow::_input(const Ref &event) { /* if is_any_menu_open(): @@ -446,6 +449,8 @@ Ref PaintWindow::get_action() { #print("no tool!") return null */ + + return Ref(); } void PaintWindow::set_selected_color(const Color &color) { @@ -592,6 +597,8 @@ Ref PaintWindow::add_new_layer() { #print("added layer: ", layer.name) return layer */ + + return Ref(); } void PaintWindow::remove_active_layer() { /* @@ -703,6 +710,8 @@ bool PaintWindow::is_position_in_canvas(const Vector2 &pos) { return true return false */ + + return false; } bool PaintWindow::is_mouse_in_canvas() { @@ -712,6 +721,7 @@ bool PaintWindow::is_mouse_in_canvas() { else: return false */ + return false; } bool PaintWindow::is_any_menu_open() { @@ -723,6 +733,7 @@ bool PaintWindow::is_any_menu_open() { $SaveFileDialog.visible or \ find_node("Navbar").is_any_menu_open() */ + return false; } void PaintWindow::_on_LockAlpha_pressed() {