Removed PaintCanvasOutline and PaintColorGrid aswell.

This commit is contained in:
Relintai 2022-11-20 21:17:41 +01:00
parent 5c9aa754d7
commit ff1dbced6d
8 changed files with 0 additions and 299 deletions

View File

@ -19,12 +19,10 @@ 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,"ui/paint_canvas_outline.cpp")
module_env.add_source_files(env.modules_sources,"ui/paint_canvas_background.cpp")
module_env.add_source_files(env.modules_sources,"ui/paint_selection_box.cpp")
module_env.add_source_files(env.modules_sources,"ui/paint_visual_grid.cpp")
module_env.add_source_files(env.modules_sources,"ui/property_inspectors/paint_color_grid.cpp")
module_env.add_source_files(env.modules_sources,"ui/property_inspectors/paint_custom_property_inspector.cpp")
module_env.add_source_files(env.modules_sources,"ui/property_inspectors/paint_tools_property_inspector.cpp")
module_env.add_source_files(env.modules_sources,"ui/property_inspectors/paint_project_property_inspector.cpp")

View File

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -26,7 +26,6 @@ SOFTWARE.
#include "editor/editor_settings.h"
#include "editor/plugins/canvas_item_editor_plugin.h"
#include "ui/property_inspectors/paint_color_grid.h"
#include "./editor/paint_inspector_plugin.h"
#include "nodes/paint_node.h"

View File

@ -37,11 +37,9 @@ SOFTWARE.
#include "actions/rect_action.h"
#include "ui/paint_canvas_background.h"
#include "ui/paint_canvas_outline.h"
#include "ui/paint_selection_box.h"
#include "ui/paint_visual_grid.h"
#include "ui/property_inspectors/paint_color_grid.h"
#include "ui/property_inspectors/paint_custom_property_inspector.h"
#include "ui/property_inspectors/paint_project_property_inspector.h"
#include "ui/property_inspectors/paint_project_tools_property_inspector.h"
@ -71,11 +69,9 @@ void register_paint_types() {
ClassDB::register_class<RectAction>();
ClassDB::register_class<PaintCanvasBackground>();
ClassDB::register_class<PaintCanvasOutline>();
ClassDB::register_class<PaintSelectionBox>();
ClassDB::register_class<PaintVisualGrid>();
ClassDB::register_class<PaintColorGrid>();
ClassDB::register_class<PaintCustomPropertyInspector>();
ClassDB::register_class<PaintToolsPropertyInspector>();
ClassDB::register_class<PaintProjectPropertyInspector>();

View File

@ -1,73 +0,0 @@
/*
Copyright (c) 2019 Flairieve
Copyright (c) 2020-2022 cobrapitz
Copyright (c) 2022 Péter Magyar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "paint_canvas_outline.h"
void PaintCanvasOutline::draw_outline_box(const Vector2 &pos, const Vector2 &size, const Color &color, const int width) {
//Top line
draw_line(pos, pos + Vector2(size.x, 0), color, width);
//Left line
draw_line(pos, pos + Vector2(0, size.y), color, width);
//Bottom line
draw_line(pos + Vector2(0, size.y), pos + Vector2(size.x, size.y), color, width);
//Right line
draw_line(pos + Vector2(size.x, 0), pos + Vector2(size.x, size.y), color, width);
}
void PaintCanvasOutline::_notification(int p_what) {
switch(p_what) {
/*
case NOTIFICATION_PROCESS: {
if (!is_visible_in_tree()) {
return;
}
update();
} break;
*/
case NOTIFICATION_DRAW: {
//Control *pc = get_parent_control();
//if (!pc) {
// return;
//}
//Vector2 size = pc.rect_size;
//var pos = Vector2(); //get_parent().rect_global_position
draw_outline_box(Vector2(), get_size(), color, 1);
} break;
}
}
PaintCanvasOutline::PaintCanvasOutline() {
color = Color(0, 1, 0, 1);
}
PaintCanvasOutline::~PaintCanvasOutline() {
}
void PaintCanvasOutline::_bind_methods() {
ClassDB::bind_method(D_METHOD("draw_outline_box", "pos", "size", "color", "width"), &PaintCanvasOutline::draw_outline_box);
}

View File

@ -1,46 +0,0 @@
#ifndef PAINT_CANVAS_OUTLINE_H
#define PAINT_CANVAS_OUTLINE_H
/*
Copyright (c) 2019 Flairieve
Copyright (c) 2020-2022 cobrapitz
Copyright (c) 2022 Péter Magyar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "scene/gui/control.h"
class PaintCanvasOutline : public Control {
GDCLASS(PaintCanvasOutline, Control);
public:
void draw_outline_box(const Vector2 &pos, const Vector2 &size, const Color &color, const int width);
PaintCanvasOutline();
~PaintCanvasOutline();
Color color;
protected:
void _notification(int p_what);
static void _bind_methods();
};
#endif

View File

@ -1,115 +0,0 @@
/*
Copyright (c) 2019 Flairieve
Copyright (c) 2020-2022 cobrapitz
Copyright (c) 2022 Péter Magyar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "paint_color_grid.h"
#include "scene/gui/button.h"
#include "scene/gui/grid_container.h"
#include "scene/gui/scroll_container.h"
#include "scene/resources/style_box.h"
#include "../../nodes/paint_node.h"
#include "../../nodes/paint_project.h"
void PaintColorGrid::change_color_to(const Color &color) {
emit_signal("color_change_request", color);
PaintProject *proj = Object::cast_to<PaintProject>(ObjectDB::get_instance(_current_paint_project));
if (proj) {
proj->set_current_color(color);
}
}
void PaintColorGrid::add_color_prefab(const Color &color) {
Button *button = memnew(Button);
button->set_custom_minimum_size(Size2(25, 25));
button->set_h_size_flags(SIZE_EXPAND_FILL);
button->set_v_size_flags(SIZE_EXPAND_FILL);
_grid->add_child(button);
_grid->move_child(button, 0);
Ref<StyleBoxFlat> style_box;
style_box.instance();
style_box->set("bg_color", color);
button->set("custom_styles/normal", style_box);
Vector<Variant> binds;
binds.push_back(color);
button->connect("pressed", this, "change_color_to", binds);
}
void PaintColorGrid::_on_paint_node_selected(Node *p_paint_node) {
PaintNode *paint_node = Object::cast_to<PaintNode>(p_paint_node);
_current_paint_node = 0;
_current_paint_project = 0;
if (!paint_node) {
return;
}
_current_paint_node = paint_node->get_instance_id();
PaintProject *proj = paint_node->get_paint_project();
if (proj) {
_current_paint_project = proj->get_instance_id();
}
}
PaintColorGrid::PaintColorGrid() {
_current_paint_node = 0;
_current_paint_project = 0;
ScrollContainer *scroll_container = memnew(ScrollContainer);
scroll_container->set_custom_minimum_size(Size2(0, 145));
scroll_container->set_enable_h_scroll(false);
add_child(scroll_container);
_grid = memnew(GridContainer);
scroll_container->add_child(_grid);
_grid->set_columns(5);
//_grid->set_custom_minimum_size(Size2(0, 145));
_grid->set_h_size_flags(SIZE_EXPAND_FILL);
_grid->set_v_size_flags(SIZE_EXPAND_FILL);
for (int i = 0; i < 24; ++i) {
add_color_prefab(Color(Math::randf(), Math::randf(), Math::randf()));
}
}
PaintColorGrid::~PaintColorGrid() {
}
void PaintColorGrid::_bind_methods() {
ADD_SIGNAL(MethodInfo("color_change_request", PropertyInfo(Variant::COLOR, "color")));
ClassDB::bind_method(D_METHOD("change_color_to"), &PaintColorGrid::change_color_to);
ClassDB::bind_method(D_METHOD("add_color_prefab"), &PaintColorGrid::add_color_prefab);
}

View File

@ -1,58 +0,0 @@
#ifndef PAINT_COLOR_GRID_H
#define PAINT_COLOR_GRID_H
/*
Copyright (c) 2019 Flairieve
Copyright (c) 2020-2022 cobrapitz
Copyright (c) 2022 Péter Magyar
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
#include "paint_custom_property_inspector.h"
#include "core/object/object_id.h"
//TODO remove
class GridContainer;
class PaintNode;
class PaintProject;
class PaintColorGrid : public PaintCustomPropertyInspector {
GDCLASS(PaintColorGrid, PaintCustomPropertyInspector);
public:
void change_color_to(const Color &color);
void add_color_prefab(const Color &color);
void _on_paint_node_selected(Node *paint_node);
PaintColorGrid();
~PaintColorGrid();
protected:
static void _bind_methods();
GridContainer *_grid;
ObjectID _current_paint_node;
ObjectID _current_paint_project;
};
#endif